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

Method runJsTests

test/common/wpt.js:670–855  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

668 // TODO(joyeecheung): work with the upstream to port more tests in .html
669 // to .js.
670 async runJsTests() {
671 const queue = this.buildQueue();
672
673 const run = limit(this.concurrency);
674
675 for (const spec of queue) {
676 const content = spec.getContent();
677 const meta = spec.getMeta(content);
678
679 const absolutePath = spec.getAbsolutePath();
680 const relativePath = spec.getRelativePath();
681 const harnessPath = fixtures.path('wpt', 'resources', 'testharness.js');
682
683 // Scripts specified with the `// META: script=` header
684 const scriptsToRun = meta.script?.map((script) => {
685 const obj = {
686 filename: this.resource.toRealFilePath(relativePath, script),
687 code: this.resource.read(relativePath, script),
688 };
689 this.scriptsModifier?.(obj);
690 return obj;
691 }) ?? [];
692 // The actual test
693 const obj = {
694 code: content,
695 filename: absolutePath,
696 };
697 this.scriptsModifier?.(obj);
698 scriptsToRun.push(obj);
699
700 run(async () => {
701 const worker = new Worker(workerPath, {
702 execArgv: this.flags,
703 workerData: {
704 testRelativePath: relativePath,
705 wptRunner: __filename,
706 wptPath: this.path,
707 initScript: this.fullInitScript(spec),
708 harness: {
709 code: fs.readFileSync(harnessPath, 'utf8'),
710 filename: harnessPath,
711 },
712 scriptsToRun,
713 needsGc: !!meta.script?.find((script) => script === '/common/gc.js'),
714 skippedTests: spec.skippedTests,
715 },
716 });
717 this.inProgress.add(spec);
718 this.workers.set(spec, worker);
719
720 const reportResult = this.report?.getResult(spec);
721 worker.on('message', (message) => {
722 switch (message.type) {
723 case 'result':
724 return this.resultCallback(spec, message.result, reportResult);
725 case 'skip':
726 return this.skipTest(spec, { name: message.name }, reportResult);
727 case 'completion':

Callers 15

test-atob.jsFile · 0.80
test-url.jsFile · 0.80
test-urlpattern.jsFile · 0.80
test-timers.jsFile · 0.80
test-blob.jsFile · 0.80
test-encoding.jsFile · 0.80
test-web-locks.jsFile · 0.80
test-webcrypto.jsFile · 0.80

Calls 15

buildQueueMethod · 0.95
fullInitScriptMethod · 0.95
resultCallbackMethod · 0.95
skipTestMethod · 0.95
completionCallbackMethod · 0.95
failMethod · 0.95
limitFunction · 0.85
getContentMethod · 0.80
getMetaMethod · 0.80
getAbsolutePathMethod · 0.80
getRelativePathMethod · 0.80
toRealFilePathMethod · 0.80

Tested by

no test coverage detected