Skip to content

Commit 6a38d32

Browse files
fixup!: add import cjs case
1 parent cd6d33f commit 6a38d32

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/parallel/test-runner-no-isolation-hooks.mjs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const order = [
4545
'after two: <root>',
4646
].join('\n');
4747

48-
test('Using --require to define global hooks works', async (t) => {
48+
test('use --require to define global hooks', async (t) => {
4949
const { stdout } = await common.spawnPromisified(process.execPath, [
5050
...testArguments,
5151
'--require', fixtures.path('test-runner', 'no-isolation', 'global-hooks.cjs'),
@@ -57,7 +57,19 @@ test('Using --require to define global hooks works', async (t) => {
5757
t.assert.equal(testHookOutput, order);
5858
});
5959

60-
test('Using --import to define global hooks works', async (t) => {
60+
test('use --import (CJS) to define global hooks', async (t) => {
61+
const { stdout } = await common.spawnPromisified(process.execPath, [
62+
...testArguments,
63+
'--import', fixtures.fileURL('test-runner', 'no-isolation', 'global-hooks.cjs'),
64+
...testFiles,
65+
]);
66+
67+
const testHookOutput = stdout.split('\n▶')[0];
68+
69+
t.assert.equal(testHookOutput, order);
70+
});
71+
72+
test('use --import (ESM) to define global hooks', async (t) => {
6173
const { stdout } = await common.spawnPromisified(process.execPath, [
6274
...testArguments,
6375
'--import', fixtures.fileURL('test-runner', 'no-isolation', 'global-hooks.mjs'),

0 commit comments

Comments
 (0)