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

Method constructor

lib/internal/test_runner/test.js:568–839  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

566 #tagsArray = null;
567
568 constructor(options) {
569 super('Test');
570
571 let { fn, name, parent } = options;
572 const { concurrency, entryFile, expectFailure, loc, only, timeout, todo, skip, signal, plan } = options;
573 const rawTags = options.tags;
574
575 if (typeof fn !== 'function') {
576 fn = noop;
577 }
578
579 if (typeof name !== 'string' || name === '') {
580 name = fn.name || '<anonymous>';
581 }
582
583 if (!(parent instanceof Test)) {
584 parent = null;
585 }
586
587 this.name = name;
588 this.parent = parent;
589 this.testNumber = 0;
590 this.outputSubtestCount = 0;
591 this.diagnostics = [];
592 this.filtered = false;
593 this.filteredByName = false;
594 this.filteredByTag = false;
595 this.hasOnlyTests = false;
596
597 // Hooks pass no tags option, so rawTags is undefined for them.
598 const ownTags = rawTags !== undefined ?
599 validateAndCanonicalizeTagValues(rawTags, 'options.tags') :
600 kEmptyTagArray;
601
602 const ownTagSet = new SafeSet(ownTags);
603 this.tagSet = parent !== null && parent.tagSet.size > 0 ?
604 SetPrototypeUnion(parent.tagSet, ownTagSet) :
605 ownTagSet;
606
607 if (parent === null) {
608 this.root = this;
609 this.harness = options.harness;
610 this.config = this.harness.config;
611 this.concurrency = 1;
612 this.nesting = 0;
613 this.only = this.config.only;
614 this.reporter = new TestsStream();
615 this.runOnlySubtests = this.only;
616 this.childNumber = 0;
617 this.timeout = kDefaultTimeout;
618 this.entryFile = entryFile;
619 this.testDisambiguator = new SafeMap();
620 this.nextTestId = 1;
621 this.testId = 0;
622 } else {
623 const nesting = parent.parent === null ? parent.nesting :
624 parent.nesting + 1;
625 const { config, isFilteringByName, isFilteringByOnly, isFilteringByTags } = parent.root.harness;

Callers

nothing calls this directly

Calls 15

willBeFilteredByNameMethod · 0.95
diagnosticMethod · 0.95
createSubtestMethod · 0.95
evaluateTagFiltersFunction · 0.85
validateAbortSignalFunction · 0.85
parseExpectFailureFunction · 0.85
createSeededGeneratorFunction · 0.85
lazyFindSourceMapFunction · 0.85
fileURLToPathFunction · 0.85
relativeFunction · 0.85
hrtimeFunction · 0.85

Tested by

no test coverage detected