From 5c3fc146af83442e5a787e43057c397024bbfb2d Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:04:28 +0200 Subject: [PATCH] jest: no need to clear mock for integration tests Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- __tests__/buildx/bake.test.itg.ts | 6 +----- __tests__/buildx/history.test.itg.ts | 6 +----- __tests__/github.test.itg.ts | 6 +----- jest.config.itg.ts | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/__tests__/buildx/bake.test.itg.ts b/__tests__/buildx/bake.test.itg.ts index c9b900d..f4499f2 100644 --- a/__tests__/buildx/bake.test.itg.ts +++ b/__tests__/buildx/bake.test.itg.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {beforeEach, describe, expect, jest, test} from '@jest/globals'; +import {describe, expect, test} from '@jest/globals'; import * as fs from 'fs'; import * as path from 'path'; @@ -25,10 +25,6 @@ const fixturesDir = path.join(__dirname, '..', 'fixtures'); const maybe = !process.env.GITHUB_ACTIONS || (process.env.GITHUB_ACTIONS === 'true' && process.env.ImageOS && process.env.ImageOS.startsWith('ubuntu')) ? describe : describe.skip; -beforeEach(() => { - jest.clearAllMocks(); -}); - maybe('getDefinition', () => { // prettier-ignore test.each([ diff --git a/__tests__/buildx/history.test.itg.ts b/__tests__/buildx/history.test.itg.ts index 009056b..78188c3 100644 --- a/__tests__/buildx/history.test.itg.ts +++ b/__tests__/buildx/history.test.itg.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {beforeEach, describe, expect, jest, test} from '@jest/globals'; +import {describe, expect, test} from '@jest/globals'; import * as fs from 'fs'; import * as path from 'path'; @@ -31,10 +31,6 @@ const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-history-jest'); const maybe = !process.env.GITHUB_ACTIONS || (process.env.GITHUB_ACTIONS === 'true' && process.env.ImageOS && process.env.ImageOS.startsWith('ubuntu')) ? describe : describe.skip; -beforeEach(() => { - jest.clearAllMocks(); -}); - maybe('exportBuild', () => { // prettier-ignore test.each([ diff --git a/__tests__/github.test.itg.ts b/__tests__/github.test.itg.ts index 852e0a6..2163a76 100644 --- a/__tests__/github.test.itg.ts +++ b/__tests__/github.test.itg.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {beforeEach, describe, expect, it, jest, test} from '@jest/globals'; +import {describe, expect, it, test} from '@jest/globals'; import fs from 'fs'; import * as path from 'path'; @@ -32,10 +32,6 @@ const tmpDir = path.join(process.env.TEMP || '/tmp', 'github-jest'); const maybe = !process.env.GITHUB_ACTIONS || (process.env.GITHUB_ACTIONS === 'true' && process.env.ImageOS && process.env.ImageOS.startsWith('ubuntu')) ? describe : describe.skip; -beforeEach(() => { - jest.clearAllMocks(); -}); - maybe('uploadArtifact', () => { it('uploads an artifact', async () => { const res = await GitHub.uploadArtifact({ diff --git a/jest.config.itg.ts b/jest.config.itg.ts index 9628c49..0e1365e 100644 --- a/jest.config.itg.ts +++ b/jest.config.itg.ts @@ -33,7 +33,6 @@ process.env = Object.assign({}, process.env, { }; module.exports = { - clearMocks: true, testEnvironment: 'node', moduleFileExtensions: ['js', 'ts'], setupFiles: ['dotenv/config'],