mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
tests/node-parallel/run.mjs builds files from a Node.js checkout's test/parallel with scriptc, runs each executable in that directory, and compares its exit status with Node's, writing a pass, fail or refused verdict and the first error line per file (results.json, results.md). --common minimal (the default) runs the files against a minimal test/common (common/index.cjs, common/wpt.cjs) whose helpers keep Node's semantics, so a verdict measures the module under test; --common node uses Node's own test/common.
33 lines
852 B
JavaScript
33 lines
852 B
JavaScript
"use strict";
|
|
// The harness object of Node's test/common/wpt.js, without its WPT runner.
|
|
const assert = require("assert");
|
|
|
|
const harness = {
|
|
test: (fn, desc) => {
|
|
try {
|
|
fn();
|
|
} catch (err) {
|
|
console.error(`In ${desc}:`);
|
|
throw err;
|
|
}
|
|
},
|
|
assert_equals: assert.strictEqual,
|
|
assert_true: (value, message) => assert.strictEqual(value, true, message),
|
|
assert_false: (value, message) => assert.strictEqual(value, false, message),
|
|
assert_throws: (code, func, desc) => {
|
|
assert.throws(
|
|
func,
|
|
function (err) {
|
|
return typeof err === "object" && "name" in err && err.name.startsWith(code.name);
|
|
},
|
|
desc,
|
|
);
|
|
},
|
|
assert_array_equals: assert.deepStrictEqual,
|
|
assert_unreached(desc) {
|
|
assert.fail(`Reached unreachable code: ${desc}`);
|
|
},
|
|
};
|
|
|
|
module.exports = { harness };
|