jest: no need to clear mock for integration tests

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2024-06-17 22:04:28 +02:00
parent 7b876a9e95
commit 5c3fc146af
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
4 changed files with 3 additions and 16 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License. * 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 fs from 'fs';
import * as path from 'path'; 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; 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', () => { maybe('getDefinition', () => {
// prettier-ignore // prettier-ignore
test.each([ test.each([

View File

@ -14,7 +14,7 @@
* limitations under the License. * 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 fs from 'fs';
import * as path from 'path'; 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; 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', () => { maybe('exportBuild', () => {
// prettier-ignore // prettier-ignore
test.each([ test.each([

View File

@ -14,7 +14,7 @@
* limitations under the License. * 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 fs from 'fs';
import * as path from 'path'; 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; 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', () => { maybe('uploadArtifact', () => {
it('uploads an artifact', async () => { it('uploads an artifact', async () => {
const res = await GitHub.uploadArtifact({ const res = await GitHub.uploadArtifact({

View File

@ -33,7 +33,6 @@ process.env = Object.assign({}, process.env, {
}; };
module.exports = { module.exports = {
clearMocks: true,
testEnvironment: 'node', testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'], moduleFileExtensions: ['js', 'ts'],
setupFiles: ['dotenv/config'], setupFiles: ['dotenv/config'],