diff options
Diffstat (limited to 'packages/bun-internal-test/src/runner.node.mjs')
-rw-r--r-- | packages/bun-internal-test/src/runner.node.mjs | 82 |
1 files changed, 1 insertions, 81 deletions
diff --git a/packages/bun-internal-test/src/runner.node.mjs b/packages/bun-internal-test/src/runner.node.mjs index f540b424f..4ded315ff 100644 --- a/packages/bun-internal-test/src/runner.node.mjs +++ b/packages/bun-internal-test/src/runner.node.mjs @@ -23,30 +23,6 @@ function* findTests(dir, query) { } } -function dump(buf) { - var offset = 0, - length = buf.byteLength; - while (offset < length) { - try { - const wrote = writeSync(1, buf); - offset += wrote; - if (offset < length) { - try { - fsyncSync(1); - } catch (e) {} - - buf = buf.slice(wrote); - } - } catch (e) { - if (e.code === "EAGAIN") { - continue; - } - - throw e; - } - } -} - var failingTests = []; async function runTest(path) { @@ -58,7 +34,7 @@ async function runTest(path) { status: exitCode, error: timedOut, } = spawnSync("bun", ["test", path], { - stdio: ["ignore", "pipe", "pipe"], + stdio: "inherit", timeout: 1000 * 60 * 3, env: { ...process.env, @@ -75,64 +51,8 @@ async function runTest(path) { failingTests.push(name); if (timedOut) console.error(timedOut); } - - if (isAction && !passed) { - findErrors(stdout); - findErrors(stderr); - } - - if (isAction) { - const prefix = passed ? "PASS" : `FAIL`; - action.startGroup(`${prefix} - ${name}`); - } - - stdout && stdout?.byteLength && dump(stdout); - stderr && stderr?.byteLength && dump(stderr); - - if (isAction) { - action.endGroup(); - } } -function findErrors(data) { - const text = new StringDecoder().write(new Buffer(data.buffer)).replaceAll(/\u001b\[.*?m/g, ""); - let index = 0; - do { - index = text.indexOf("error: ", index); - if (index === -1) { - break; - } - - const messageEnd = text.indexOf("\n", index); - if (messageEnd === -1) { - break; - } - const message = text.slice(index + 7, messageEnd); - index = text.indexOf("at ", index); - if (index === -1) { - break; - } - const startAt = index; - index = text.indexOf("\n", index); - if (index === -1) { - break; - } - const at = text.slice(startAt + 3, index); - let file = at.slice(0, at.indexOf(":")); - if (file.length === 0) { - continue; - } - - const startLine = at.slice(at.indexOf(":") + 1, at.indexOf(":") + 1 + at.slice(at.indexOf(":") + 1).indexOf(":")); - const startColumn = at.slice(at.indexOf(":") + 1 + at.slice(at.indexOf(":") + 1).indexOf(":") + 1); - - if (file.startsWith("/")) { - file = relative(cwd, file); - } - - action.error(message, { file, startLine, startColumn }); - } while (index !== -1); -} var tests = []; var testFileNames = []; for (const path of findTests(resolve(cwd, "test"))) { |