@@ -2,58 +2,52 @@ import path from 'path'
22
33import { wrap } from 'jest-snapshot-serializer-raw'
44
5- import runJest , { onNodeVersions } from '../run-jest'
5+ import runJest from '../run-jest'
66import { extractSummary } from '../utils'
77
88const DIR = path . resolve ( __dirname , '..' , 'native-esm-js' , 'non-isolated' )
99const ISOLATED_MODULES_DIR = path . resolve ( __dirname , '..' , 'native-esm-js' , 'isolated' )
1010
11- // The versions where vm.Module exists and commonjs with "exports" is not broken
12- onNodeVersions ( '>=14.15.0' , ( ) => {
13- test ( 'runs test with native ESM and isolatedModules: false' , ( ) => {
14- const { exitCode, stderr, stdout } = runJest ( DIR , [ 'native-esm.spec.ts' ] , {
15- nodeOptions : '--experimental-vm-modules --no-warnings' ,
16- } )
17- const { summary } = extractSummary ( stderr )
18-
19- expect ( wrap ( summary ) ) . toMatchSnapshot ( )
20- expect ( stdout ) . toBe ( '' )
21- expect ( exitCode ) . toBe ( 0 )
11+ test ( 'runs test with native ESM and isolatedModules: false' , ( ) => {
12+ const { exitCode, stderr, stdout } = runJest ( DIR , [ 'native-esm.spec.ts' ] , {
13+ nodeOptions : '--experimental-vm-modules --no-warnings' ,
2214 } )
15+ const { summary } = extractSummary ( stderr )
2316
24- test ( 'runs test with native ESM and isolatedModules: true' , ( ) => {
25- const { exitCode, stderr, stdout } = runJest ( ISOLATED_MODULES_DIR , [ 'native-esm.spec.ts' ] , {
26- nodeOptions : '--experimental-vm-modules --no-warnings' ,
27- } )
28- const { summary } = extractSummary ( stderr )
17+ expect ( wrap ( summary ) ) . toMatchSnapshot ( )
18+ expect ( stdout ) . toBe ( '' )
19+ expect ( exitCode ) . toBe ( 0 )
20+ } )
2921
30- expect ( wrap ( summary ) ) . toMatchSnapshot ( )
31- expect ( stdout ) . toBe ( '' )
32- expect ( exitCode ) . toBe ( 0 )
22+ test ( 'runs test with native ESM and isolatedModules: true' , ( ) => {
23+ const { exitCode , stderr , stdout } = runJest ( ISOLATED_MODULES_DIR , [ 'native-esm.spec.ts' ] , {
24+ nodeOptions : '--experimental-vm-modules --no-warnings' ,
3325 } )
26+ const { summary } = extractSummary ( stderr )
27+
28+ expect ( wrap ( summary ) ) . toMatchSnapshot ( )
29+ expect ( stdout ) . toBe ( '' )
30+ expect ( exitCode ) . toBe ( 0 )
3431} )
3532
36- // The versions where Top-Level Await is supported
37- onNodeVersions ( '>=14.3.0' , ( ) => {
38- test ( 'supports top-level await and isolatedModules: false' , ( ) => {
39- const { exitCode, stderr, stdout } = runJest ( DIR , [ 'native-esm-tla.spec.ts' ] , {
40- nodeOptions : '--experimental-vm-modules --no-warnings' ,
41- } )
42- const { summary } = extractSummary ( stderr )
43-
44- expect ( wrap ( summary ) ) . toMatchSnapshot ( )
45- expect ( stdout ) . toBe ( '' )
46- expect ( exitCode ) . toBe ( 0 )
33+ test ( 'supports top-level await and isolatedModules: false' , ( ) => {
34+ const { exitCode, stderr, stdout } = runJest ( DIR , [ 'native-esm-tla.spec.ts' ] , {
35+ nodeOptions : '--experimental-vm-modules --no-warnings' ,
4736 } )
37+ const { summary } = extractSummary ( stderr )
4838
49- test ( 'supports top-level await and isolatedModules: true' , ( ) => {
50- const { exitCode, stderr, stdout } = runJest ( ISOLATED_MODULES_DIR , [ 'native-esm-tla.spec.ts' ] , {
51- nodeOptions : '--experimental-vm-modules --no-warnings' ,
52- } )
53- const { summary } = extractSummary ( stderr )
39+ expect ( wrap ( summary ) ) . toMatchSnapshot ( )
40+ expect ( stdout ) . toBe ( '' )
41+ expect ( exitCode ) . toBe ( 0 )
42+ } )
5443
55- expect ( wrap ( summary ) ) . toMatchSnapshot ( )
56- expect ( stdout ) . toBe ( '' )
57- expect ( exitCode ) . toBe ( 0 )
44+ test ( 'supports top-level await and isolatedModules: true' , ( ) => {
45+ const { exitCode , stderr , stdout } = runJest ( ISOLATED_MODULES_DIR , [ 'native-esm-tla.spec.ts' ] , {
46+ nodeOptions : '--experimental-vm-modules --no-warnings' ,
5847 } )
48+ const { summary } = extractSummary ( stderr )
49+
50+ expect ( wrap ( summary ) ) . toMatchSnapshot ( )
51+ expect ( stdout ) . toBe ( '' )
52+ expect ( exitCode ) . toBe ( 0 )
5953} )
0 commit comments