MCPcopy Index your code
hub / github.com/nodejs/node / runInParentContext

Function runInParentContext

lib/internal/test_runner/harness.js:390–421  ·  view source on GitHub ↗
(Factory)

Source from the content-addressed store, hash-verified

388}
389
390function runInParentContext(Factory) {
391 function run(name, options, fn, overrides) {
392 const parent = testResources.get(executionAsyncId()) || lazyBootstrapRoot();
393 const subtest = parent.createSubtest(Factory, name, options, fn, overrides);
394 if (parent instanceof Suite) {
395 return PromiseResolve();
396 }
397
398 return startSubtestAfterBootstrap(subtest);
399 }
400
401 const test = (name, options, fn) => {
402 const overrides = {
403 __proto__: null,
404 loc: getCallerLocation(),
405 };
406
407 return run(name, options, fn, overrides);
408 };
409 ArrayPrototypeForEach(['expectFailure', 'skip', 'todo', 'only'], (keyword) => {
410 test[keyword] = (name, options, fn) => {
411 const overrides = {
412 __proto__: null,
413 [keyword]: true,
414 loc: getCallerLocation(),
415 };
416
417 return run(name, options, fn, overrides);
418 };
419 });
420 return test;
421}
422
423function hook(hook) {
424 return (fn, options) => {

Callers 1

harness.jsFile · 0.85

Calls 1

runFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…