Skip to content

Commit

Permalink
jest: no need to clear mock for integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Jun 18, 2024
1 parent 7b876a9 commit 5c3fc14
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions __tests__/buildx/bake.test.itg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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([
Expand Down
6 changes: 1 addition & 5 deletions __tests__/buildx/history.test.itg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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([
Expand Down
6 changes: 1 addition & 5 deletions __tests__/github.test.itg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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({
Expand Down
1 change: 0 additions & 1 deletion jest.config.itg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ process.env = Object.assign({}, process.env, {
};

module.exports = {
clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
setupFiles: ['dotenv/config'],
Expand Down

0 comments on commit 5c3fc14

Please sign in to comment.