Skip to content

Commit 3187fd4

Browse files
committed
test: cover config values and fixture execution
1 parent 8d6425a commit 3187fd4

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎scripts/test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ const BUN_TEST_OPTIONS_REQUIRING_VALUES = new Set([
136136
"--jsx-runtime",
137137
"--env-file",
138138
"--cwd",
139+
"-c",
140+
"--config",
139141
]);
140142

141143
/** True for a filter-less `bun run test`. `--timeout` / `--dots` / `--parallel=N` still count. */

‎tests/test-runner.test.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ describe("bun test argv", () => {
114114
".bun-test-timings/current.json",
115115
"./tests/",
116116
]);
117+
for (const configFlag of ["-c", "--config"]) {
118+
expect(resolveBunTestArgs([configFlag, "ci.bunfig.toml"]))
119+
.toEqual(["--isolate", "--parallel", configFlag, "ci.bunfig.toml", "./tests/"]);
120+
}
117121
expect(resolveBunTestArgs(["-t", "serial test"])).toEqual([
118122
"--isolate",
119123
"--parallel",
@@ -131,7 +135,11 @@ describe("bun test argv", () => {
131135
test("the wrapper passes parallel execution through to bun", () => {
132136
const fixtureRoot = mkdtempSync(join(tmpdir(), "opencodex-test-runner-"));
133137
const fixturePath = join(fixtureRoot, "parallel-smoke.test.ts");
134-
writeFileSync(fixturePath, 'import { test } from "bun:test"; test("smoke", () => {});\n');
138+
const markerPath = join(fixtureRoot, "executed.marker");
139+
writeFileSync(
140+
fixturePath,
141+
`import { test } from "bun:test"; import { writeFileSync } from "node:fs"; test("smoke", () => writeFileSync(${JSON.stringify(markerPath)}, "executed"));\n`,
142+
);
135143
try {
136144
const result = Bun.spawnSync([
137145
process.execPath,
@@ -148,6 +156,7 @@ describe("bun test argv", () => {
148156
+ new TextDecoder().decode(result.stderr);
149157
expect(result.exitCode).toBe(0);
150158
expect(output).toContain("PARALLEL");
159+
expect(existsSync(markerPath)).toBe(true);
151160
} finally {
152161
rmSync(fixtureRoot, { recursive: true, force: true });
153162
}

0 commit comments

Comments
 (0)