test_runner: fix --require with --experimental-loader

PR-URL: https://github.com/nodejs/node/pull/47751
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Moshe Atlow authored and Michaël Zasso committed 2023-05-03 08:34:24 +02:00
1 parent 606523d37e
commit e5251e31eb
2 files changed
+19

No files matched your search

+3
View File
@@ -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));
+16
View File
@@ -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/);
}