Skip to content

Commit e5251e3

Browse files
MoLowtargos
authored andcommitted
test_runner: fix --require with --experimental-loader
PR-URL: #47751 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 606523d commit e5251e3

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎src/api/environment.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
529529
CHECK_NOT_NULL(env);
530530
if (name == nullptr) name = "";
531531
CHECK_NE(thread_id.id, static_cast<uint64_t>(-1));
532+
if (!env->should_create_inspector()) {
533+
returnnullptr;
534+
}
532535
#if HAVE_INSPECTOR
533536
return std::make_unique<InspectorParentHandleImpl>(
534537
env->inspector_agent()->GetParentHandle(thread_id.id, url, name));

‎test/parallel/test-runner-cli.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,19 @@ const testFixtures = fixtures.path('test-runner');
185185
assert.match(stdout,/#tests1/);
186186
assert.match(stdout,/#pass1/);
187187
}
188+
189+
{
190+
// Use test with --loader and --require.
191+
// This case is common since vscode uses --require to load the debugger.
192+
constargs=['--no-warnings',
193+
'--experimental-loader','data:text/javascript,',
194+
'--require',fixtures.path('empty.js'),
195+
'--test',join(testFixtures,'index.test.js')];
196+
constchild=spawnSync(process.execPath,args);
197+
198+
assert.strictEqual(child.stderr.toString(),'');
199+
assert.strictEqual(child.status,0);
200+
assert.strictEqual(child.signal,null);
201+
conststdout=child.stdout.toString();
202+
assert.match(stdout,/ok1-thisshouldpass/);
203+
}

0 commit comments

Comments
 (0)