diff options
author | 2023-03-04 18:58:10 -0800 | |
---|---|---|
committer | 2023-03-04 18:58:10 -0800 | |
commit | 0b4e7179b578f0a07111ea15b76725c9682c08c9 (patch) | |
tree | 612b8f28f3ce914edd8908dda6176faf0f9827c1 | |
parent | c34b92d16b526bd21b464fc7cf3a2d454c71c91c (diff) | |
download | bun-0b4e7179b578f0a07111ea15b76725c9682c08c9.tar.gz bun-0b4e7179b578f0a07111ea15b76725c9682c08c9.tar.zst bun-0b4e7179b578f0a07111ea15b76725c9682c08c9.zip |
dump failing tests to disk
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | packages/bun-internal-test/.gitignore | 1 | ||||
-rw-r--r-- | packages/bun-internal-test/src/runner.node.mjs | 18 |
3 files changed, 18 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore index 83bd05af5..79930b44e 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,5 @@ bun-webkit src/deps/c-ares/build src/bun.js/debug-bindings-obj + +failing-tests.txt diff --git a/packages/bun-internal-test/.gitignore b/packages/bun-internal-test/.gitignore index e8034cc5f..1f7591603 100644 --- a/packages/bun-internal-test/.gitignore +++ b/packages/bun-internal-test/.gitignore @@ -1,3 +1,4 @@ .DS_Store .env node_modules +failing-tests.txt diff --git a/packages/bun-internal-test/src/runner.node.mjs b/packages/bun-internal-test/src/runner.node.mjs index 7db2b5627..471e1cc41 100644 --- a/packages/bun-internal-test/src/runner.node.mjs +++ b/packages/bun-internal-test/src/runner.node.mjs @@ -1,9 +1,10 @@ import * as action from "@actions/core"; import { spawnSync } from "child_process"; -import { fsyncSync, writeSync } from "fs"; +import { fsyncSync, rmSync, writeFileSync, writeSync } from "fs"; import { readdirSync } from "node:fs"; import { resolve } from "node:path"; import { StringDecoder } from "node:string_decoder"; +import { basename } from "path"; import { fileURLToPath } from "url"; const cwd = resolve(fileURLToPath(import.meta.url), "../../../../"); @@ -17,7 +18,7 @@ function* findTests(dir, query) { const path = resolve(dir, entry.name); if (entry.isDirectory()) { yield* findTests(path, query); - } else if (entry.isFile() && entry.name.includes(".test.")) { + } else if (entry.name.includes(".test.")) { yield path; } } @@ -47,13 +48,15 @@ function dump(buf) { } } +var failingTests = []; + async function runTest(path) { const name = path.replace(cwd, "").slice(1); const { stdout, stderr, status: exitCode, - } = spawnSync("bun", ["test", path], { + } = spawnSync("bun", ["test", basename(path)], { stdio: ["ignore", "pipe", "pipe"], timeout: 10_000, env: { @@ -66,6 +69,10 @@ async function runTest(path) { action.startGroup(`${prefix} - ${name}`); } + if (+exitCode !== 0) { + failingTests.push(name); + } + dump(stdout); if (isAction) { @@ -102,4 +109,9 @@ for (const path of findTests(resolve(cwd, "test/bun.js"))) { tests.push(runTest(path).catch(console.error)); } await Promise.allSettled(tests); + +rmSync("failing-tests.txt", { force: true }); +if (failingTests.length > 0) { + writeFileSync("failing-tests.txt", failingTests.join("\n") + "\n", "utf-8"); +} process.exit(failed ? 1 : 0); |