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

Method completionCallback

test/common/wpt.js:895–924  ·  view source on GitHub ↗

* Report the status of each WPT test (one per file) * @param {WPTTestSpec} spec * @param {object} harnessStatus - The status object returned by WPT harness. * @param {ReportResult} reportResult The report result object

(spec, harnessStatus, reportResult)

Source from the content-addressed store, hash-verified

893 * @param {ReportResult} reportResult The report result object
894 */
895 completionCallback(spec, harnessStatus, reportResult) {
896 const status = this.getTestStatus(harnessStatus.status);
897
898 // Treat it like a test case failure
899 if (status === kTimeout) {
900 // No need to record this synthetic failure with wpt.fyi.
901 this.fail(spec, { name: 'WPT testharness timeout' }, kTimeout);
902 // Mark the whole test as TIMEOUT in wpt.fyi report.
903 reportResult?.finish('TIMEOUT');
904 } else if (status !== kPass) {
905 // No need to record this synthetic failure with wpt.fyi.
906 this.fail(spec, {
907 status: status,
908 name: 'WPT test harness error',
909 message: harnessStatus.message,
910 stack: harnessStatus.stack,
911 }, status);
912 // Mark the whole test as ERROR in wpt.fyi report.
913 reportResult?.finish('ERROR');
914 } else {
915 reportResult?.finish();
916 }
917 this.inProgress.delete(spec);
918 // Write report incrementally so results survive even if the process
919 // is killed before the exit handler runs.
920 this.report?.write();
921 // Always force termination of the worker. Some tests allocate resources
922 // that would otherwise keep it alive.
923 this.workers.get(spec).terminate();
924 }
925
926 addTestResult(spec, item) {
927 let result = this.results[spec.filename];

Callers 1

runJsTestsMethod · 0.95

Calls 7

getTestStatusMethod · 0.95
failMethod · 0.95
deleteMethod · 0.65
getMethod · 0.65
finishMethod · 0.45
writeMethod · 0.45
terminateMethod · 0.45

Tested by

no test coverage detected