Skip to content

Commit

Permalink
chore: remove node 13 as condition in some tests (#11880)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 16, 2021
1 parent d7f0975 commit 2f135d3
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 40 deletions.
12 changes: 6 additions & 6 deletions e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`on node >=14.3.0 supports top-level await 1`] = `
exports[`on node >=12.16.0 runs test with native ESM 1`] = `
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Tests: 21 passed, 21 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching /native-esm.tla.test.js/i.
Ran all test suites matching /native-esm.test.js/i.
`;
exports[`on node ^12.16.0 || >=13.7.0 runs test with native ESM 1`] = `
exports[`on node >=14.3.0 supports top-level await 1`] = `
Test Suites: 1 passed, 1 total
Tests: 21 passed, 21 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching /native-esm.test.js/i.
Ran all test suites matching /native-esm.tla.test.js/i.
`;
2 changes: 1 addition & 1 deletion e2e/__tests__/customEsmTestSequencers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {extractSummary} from '../Utils';
import runJest from '../runJest';
const dir = path.resolve(__dirname, '../custom-esm-test-sequencer');

onNodeVersions('^12.16.0 || >=13.7.0', () => {
onNodeVersions('>=12.16.0', () => {
test('run prioritySequence', () => {
const result = runJest(dir, ['-i'], {
nodeOptions: '--experimental-vm-modules --no-warnings',
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/customReporters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Custom Reporters Integration', () => {
expect(exitCode).toBe(1);
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
test('supports reporter written in ESM', () => {
writeFiles(DIR, {
'__tests__/test.test.js': `test('test', () => {});`,
Expand Down
4 changes: 2 additions & 2 deletions e2e/__tests__/detectOpenHandles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ it('does not report crypto random data', () => {
expect(textAfterTest).toBe('');
});

onNodeVersions('>=11.10.0', () => {
onNodeVersions('>=12', () => {
it('does not report ELD histograms', () => {
const {stderr} = runJest('detect-open-handles', [
'histogram',
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('notify', () => {
});
});

onNodeVersions('>=11', () => {
onNodeVersions('>=12', () => {
it('does not report timeouts using unref', () => {
// The test here is basically that it exits cleanly without reporting anything (does not need `until`)
const {stderr} = runJest('detect-open-handles', [
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/esmConfigFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('reads config from cjs file', () => {
});
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
test('reads config from mjs file', () => {
const {configs} = getConfig('esm-config/mjs', [], {
skipPkgJsonCheck: true,
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/globalSetup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ test('properly handle rejections', () => {
expect(stderr).toContain('reason: undefined');
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
test('globalSetup works with ESM modules', () => {
const {exitCode} = runJest('global-setup-esm', [`--no-cache`], {
nodeOptions: '--experimental-vm-modules --no-warnings',
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/globalTeardown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ test('globalTeardown throws with named export', () => {
);
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
test('globalTeardown works with ESM modules', () => {
const {exitCode} = runJest('global-teardown-esm', [`--no-cache`], {
nodeOptions: '--experimental-vm-modules --no-warnings',
Expand Down
4 changes: 0 additions & 4 deletions e2e/__tests__/nativeAsyncMock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import runJest from '../runJest';
const dir = path.resolve(__dirname, '..', 'native-async-mock');

test('mocks async functions', () => {
if (process.versions.node < '7.6.0') {
return;
}

runYarnInstall(dir);

// --no-cache because babel can cache stuff and result in false green
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/nativeEsm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('test config is without transform', () => {
});

// The versions where vm.Module exists and commonjs with "exports" is not broken
onNodeVersions('^12.16.0 || >=13.7.0', () => {
onNodeVersions('>=12.16.0', () => {
test('runs test with native ESM', () => {
const {exitCode, stderr, stdout} = runJest(DIR, ['native-esm.test.js'], {
nodeOptions: '--experimental-vm-modules --no-warnings',
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/nativeEsmTypescript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {json as runJest} from '../runJest';
const DIR = resolve(__dirname, '../native-esm-typescript');

// The versions where vm.Module exists and commonjs with "exports" is not broken
onNodeVersions('^12.16.0 || >=13.7.0', () => {
onNodeVersions('>=12.16.0', () => {
test('runs TS test with native ESM', () => {
const {exitCode, json} = runJest(DIR, [], {
nodeOptions: '--experimental-vm-modules --no-warnings',
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/presets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.each(['js', 'cjs'])('supports %s preset', presetDir => {
expect(result.exitCode).toBe(0);
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
// eslint-disable-next-line jest/no-identical-title
test.each(['mjs', 'js-type-module'])('supports %s preset', presetDir => {
const result = runJest(`presets/${presetDir}`);
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/resolveConditions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ beforeAll(() => {
});

// The versions where vm.Module exists and commonjs with "exports" is not broken
onNodeVersions('^12.16.0 || >=13.7.0', () => {
onNodeVersions('>=12.16.0', () => {
test('resolves package exports correctly with custom resolver', () => {
// run multiple times to ensure there are no caching errors
for (let i = 0; i < 5; i++) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/testEnvironmentEsm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {onNodeVersions} from '@jest/test-utils';
import runJest from '../runJest';

// The versions where vm.Module exists and commonjs with "exports" is not broken
onNodeVersions('^12.16.0 || >=13.7.0', () => {
onNodeVersions('>=12.16.0', () => {
it('support test environment written in ESM', () => {
const DIR = resolve(__dirname, '../test-environment-esm');
const {exitCode} = runJest(DIR);
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe('transform-testrunner', () => {
});
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
describe('esm-transformer', () => {
const dir = path.resolve(__dirname, '../transform/esm-transformer');

Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/watch-plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.each(['js', 'cjs'])('supports %s watch plugins', async watchPluginDir => {
await testRun.end();
});

onNodeVersions('^12.17.0 || >=13.2.0', () => {
onNodeVersions('>=12.17.0', () => {
test.each(['mjs', 'js-type-module'])(
// eslint-disable-next-line jest/no-identical-title
'supports %s watch plugins',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import assert from 'assert';
import fc from 'fast-check';
import {onNodeVersions} from '@jest/test-utils';
import expect from '..';
import {
anythingSettings,
Expand Down Expand Up @@ -58,20 +57,18 @@ describe('toStrictEqual', () => {
);
});

onNodeVersions('>=9', () => {
it('should be equivalent to Node deepStrictEqual', () => {
fc.assert(
fc.property(
fc.anything(anythingSettings),
fc.anything(anythingSettings),
(a, b) => {
expect(safeExpectStrictEqual(a, b)).toBe(
safeAssertDeepStrictEqual(a, b),
);
},
),
assertSettings,
);
});
it('should be equivalent to Node deepStrictEqual', () => {
fc.assert(
fc.property(
fc.anything(anythingSettings),
fc.anything(anythingSettings),
(a, b) => {
expect(safeExpectStrictEqual(a, b)).toBe(
safeAssertDeepStrictEqual(a, b),
);
},
),
assertSettings,
);
});
});

0 comments on commit 2f135d3

Please sign in to comment.