Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8398bca

Browse filesBrowse files
committed
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 4729d30 commit 8398bca
Copy full SHA for 8398bca

File tree

Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Open diff view settings
Collapse file

‎src/api/environment.cc‎

Copy file name to clipboardExpand all lines: src/api/environment.cc
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
462462
CHECK_NOT_NULL(env);
463463
if (name == nullptr) name = "";
464464
CHECK_NE(thread_id.id, static_cast<uint64_t>(-1));
465+
if (!env->should_create_inspector()) {
466+
return nullptr;
467+
}
465468
#if HAVE_INSPECTOR
466469
return std::make_unique<InspectorParentHandleImpl>(
467470
env->inspector_agent()->GetParentHandle(thread_id.id, url, name));
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-runner-cli.js
+16Lines 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, /# tests 1/);
186186
assert.match(stdout, /# pass 1/);
187187
}
188+
189+
{
190+
// Use test with --loader and --require.
191+
// This case is common since vscode uses --require to load the debugger.
192+
const args = ['--no-warnings',
193+
'--experimental-loader', 'data:text/javascript,',
194+
'--require', fixtures.path('empty.js'),
195+
'--test', join(testFixtures, 'index.test.js')];
196+
const child = spawnSync(process.execPath, args);
197+
198+
assert.strictEqual(child.stderr.toString(), '');
199+
assert.strictEqual(child.status, 0);
200+
assert.strictEqual(child.signal, null);
201+
const stdout = child.stdout.toString();
202+
assert.match(stdout, /ok 1 - this should pass/);
203+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.