Files
bun.sh/test/js/bun/util/reportError.test.ts
Dylan Conway 94bf404c41 Print bun version on unhandled errors (#10760)
Co-authored-by: dave caruso <me@paperdave.net>
2024-05-02 15:06:14 -07:00

23 lines
669 B
TypeScript

import { test, expect } from "bun:test";
import { spawnSync } from "bun";
import { join } from "path";
import { bunEnv, bunExe } from "harness";
test("reportError", () => {
const cwd = import.meta.dir;
const { stderr } = spawnSync({
cmd: [bunExe(), join(import.meta.dir, "reportError.ts")],
cwd,
env: {
...bunEnv,
// this is default enabled in debug, affects output.
BUN_JSC_showPrivateScriptsInStackTraces: "0",
},
});
let output = stderr.toString().replaceAll(cwd, "").replaceAll("\\", "/");
// remove bun version from output
output = output.split("\n").slice(0, -2).join("\n");
expect(output).toMatchSnapshot();
});