diff options
author | 2023-06-01 00:19:33 -0700 | |
---|---|---|
committer | 2023-06-01 00:19:33 -0700 | |
commit | a4ccd4e0b4cc19f534bf639f30b7e4218400e1e8 (patch) | |
tree | 250f89bddd6e6c920645db2ad39bb7edf576edf0 /packages/bun-internal-test/src/runner.node.mjs | |
parent | cb0f76aa73f6b85667b57015a77ac39d9c78aa0b (diff) | |
parent | 689434e012a47b9be897f6d90d6aa211b13dfc19 (diff) | |
download | bun-jarred/port.tar.gz bun-jarred/port.tar.zst bun-jarred/port.zip |
Merge branch 'main' into jarred/portjarred/port
Diffstat (limited to '')
-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"))) { |