Skip to content

Commit

Permalink
test_runner: repro
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Apr 27, 2023
1 parent 8b66dc6 commit 27e08d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Empty file.
7 changes: 7 additions & 0 deletions test/fixtures/test-runner/esm/loader.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function resolve(specifier, context, next) {
return next(specifier);
}

export function load(href, context, next) {
return next(href);
}
14 changes: 14 additions & 0 deletions test/parallel/test-runner-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,17 @@ const testFixtures = fixtures.path('test-runner');
assert.match(stdout, /# tests 1/);
assert.match(stdout, /# pass 1/);
}

{
// Use test with --loader and --require.
const args = ['--no-warnings', '--trace-uncaught', '--loader', join(testFixtures, 'esm', 'loader.mjs'), '--test', join(testFixtures, 'index.test.js')];
const child = spawnSync(process.execPath, args, {
env: { NODE_OPTIONS: `--require="${join(testFixtures, 'esm', 'bootloader.js')}"` }
});

assert.strictEqual(child.stderr.toString(), '');
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
const stdout = child.stdout.toString();
assert.match(stdout, /ok 1 - this should pass/);
}

0 comments on commit 27e08d4

Please sign in to comment.