Skip to content

Commit

Permalink
test_runner: fix --require with --experimental-loader
Browse files Browse the repository at this point in the history
PR-URL: #47751
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
MoLow authored and targos committed May 3, 2023
1 parent 606523d commit e5251e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
CHECK_NOT_NULL(env);
if (name == nullptr) name = "";
CHECK_NE(thread_id.id, static_cast<uint64_t>(-1));
if (!env->should_create_inspector()) {
return nullptr;
}
#if HAVE_INSPECTOR
return std::make_unique<InspectorParentHandleImpl>(
env->inspector_agent()->GetParentHandle(thread_id.id, url, name));
Expand Down
16 changes: 16 additions & 0 deletions test/parallel/test-runner-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,19 @@ const testFixtures = fixtures.path('test-runner');
assert.match(stdout, /# tests 1/);
assert.match(stdout, /# pass 1/);
}

{
// Use test with --loader and --require.
// This case is common since vscode uses --require to load the debugger.
const args = ['--no-warnings',
'--experimental-loader', 'data:text/javascript,',
'--require', fixtures.path('empty.js'),
'--test', join(testFixtures, 'index.test.js')];
const child = spawnSync(process.execPath, args);

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 e5251e3

Please sign in to comment.