@@ -2,58 +2,52 @@ import path from 'path'
2
2
3
3
import { wrap } from 'jest-snapshot-serializer-raw'
4
4
5
- import runJest , { onNodeVersions } from '../run-jest'
5
+ import runJest from '../run-jest'
6
6
import { extractSummary } from '../utils'
7
7
8
8
const DIR = path . resolve ( __dirname , '..' , 'native-esm-js' , 'non-isolated' )
9
9
const ISOLATED_MODULES_DIR = path . resolve ( __dirname , '..' , 'native-esm-js' , 'isolated' )
10
10
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' ,
22
14
} )
15
+ const { summary } = extractSummary ( stderr )
23
16
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
+ } )
29
21
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' ,
33
25
} )
26
+ const { summary } = extractSummary ( stderr )
27
+
28
+ expect ( wrap ( summary ) ) . toMatchSnapshot ( )
29
+ expect ( stdout ) . toBe ( '' )
30
+ expect ( exitCode ) . toBe ( 0 )
34
31
} )
35
32
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' ,
47
36
} )
37
+ const { summary } = extractSummary ( stderr )
48
38
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
+ } )
54
43
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' ,
58
47
} )
48
+ const { summary } = extractSummary ( stderr )
49
+
50
+ expect ( wrap ( summary ) ) . toMatchSnapshot ( )
51
+ expect ( stdout ) . toBe ( '' )
52
+ expect ( exitCode ) . toBe ( 0 )
59
53
} )
0 commit comments