|
6 | 6 | */ |
7 | 7 |
|
8 | 8 | import {onNodeVersions} from '@jest/test-utils'; |
9 | | -import {json as runWithJson} from '../runJest'; |
| 9 | +import {getConfig} from '../runJest'; |
10 | 10 |
|
11 | 11 | test('reads config from cjs file', () => { |
12 | | - const {json, exitCode} = runWithJson('esm-config/cjs', ['--show-config'], { |
| 12 | + const {configs} = getConfig('esm-config/cjs', [], { |
13 | 13 | skipPkgJsonCheck: true, |
14 | 14 | }); |
15 | 15 |
|
16 | | - expect(exitCode).toBe(0); |
17 | | - expect(json.configs).toHaveLength(1); |
18 | | - expect(json.configs[0].displayName).toEqual({ |
| 16 | + expect(configs).toHaveLength(1); |
| 17 | + expect(configs[0].displayName).toEqual({ |
19 | 18 | color: 'white', |
20 | 19 | name: 'Config from cjs file', |
21 | 20 | }); |
22 | 21 | }); |
23 | 22 |
|
24 | 23 | // not unflagged for other versions yet. Update this range if that changes |
25 | | -onNodeVersions('^13.2.0', () => { |
| 24 | +onNodeVersions('>=13.2.0', () => { |
26 | 25 | test('reads config from mjs file', () => { |
27 | | - const {json, exitCode} = runWithJson('esm-config/mjs', ['--show-config'], { |
| 26 | + const {configs} = getConfig('esm-config/mjs', [], { |
28 | 27 | skipPkgJsonCheck: true, |
29 | 28 | }); |
30 | 29 |
|
31 | | - expect(exitCode).toBe(0); |
32 | | - expect(json.configs).toHaveLength(1); |
33 | | - expect(json.configs[0].displayName).toEqual({ |
| 30 | + expect(configs).toHaveLength(1); |
| 31 | + expect(configs[0].displayName).toEqual({ |
34 | 32 | color: 'white', |
35 | 33 | name: 'Config from mjs file', |
36 | 34 | }); |
37 | 35 | }); |
38 | 36 |
|
39 | 37 | test('reads config from js file when package.json#type=module', () => { |
40 | | - const {json, exitCode} = runWithJson('esm-config/js', ['--show-config'], { |
| 38 | + const {configs} = getConfig('esm-config/js', [], { |
41 | 39 | skipPkgJsonCheck: true, |
42 | 40 | }); |
43 | 41 |
|
44 | | - expect(exitCode).toBe(0); |
45 | | - expect(json.configs).toHaveLength(1); |
46 | | - expect(json.configs[0].displayName).toEqual({ |
| 42 | + expect(configs).toHaveLength(1); |
| 43 | + expect(configs[0].displayName).toEqual({ |
47 | 44 | color: 'white', |
48 | 45 | name: 'Config from js file', |
49 | 46 | }); |
|
0 commit comments