Skip to content

Commit 6d44cbc

Browse files
committed
revert
1 parent 4725ae3 commit 6d44cbc

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed
Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
11
'use strict';
22
require('../common');
3+
const { spawnSyncAndAssert } = require('../common/child_process');
34
const fixtures = require('../common/fixtures');
45

56
// This is a minimum integration test for CJS transpiled from ESM that tries to load real ESM.
67

7-
const { spawnSync } = require('child_process');
8-
const result = spawnSync(process.execPath, [
8+
spawnSyncAndAssert(process.execPath, [
99
'--experimental-require-module',
1010
fixtures.path('es-modules', 'transpiled-cjs-require-module', 'dist', 'import-both.cjs'),
1111
], {
12-
encoding: 'utf8',
12+
trim: true,
13+
stdout: 'import both',
1314
});
14-
if (!result.stdout.includes('import both')) {
15-
throw new Error(`stdout did not include 'import both':\n${result.stdout}`);
16-
}
1715

18-
const resultNamed = spawnSync(process.execPath, [
16+
spawnSyncAndAssert(process.execPath, [
1917
'--experimental-require-module',
2018
fixtures.path('es-modules', 'transpiled-cjs-require-module', 'dist', 'import-named.cjs'),
2119
], {
22-
encoding: 'utf8',
20+
trim: true,
21+
stdout: 'import named',
2322
});
24-
if (!resultNamed.stdout.includes('import named')) {
25-
throw new Error(`stdout did not include 'import named':\n${resultNamed.stdout}`);
26-
}
2723

28-
const resultDefault = spawnSync(process.execPath, [
24+
spawnSyncAndAssert(process.execPath, [
2925
'--experimental-require-module',
3026
fixtures.path('es-modules', 'transpiled-cjs-require-module', 'dist', 'import-default.cjs'),
3127
], {
32-
encoding: 'utf8',
28+
trim: true,
29+
stdout: 'import default',
3330
});
34-
if (!resultDefault.stdout.includes('import default')) {
35-
throw new Error(`stdout did not include 'import default':\n${resultDefault.stdout}`);
36-
}

0 commit comments

Comments
 (0)