diff --git a/src/app/error.tsx b/src/app/error.tsx index 110735353b..0b1327185c 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -40,7 +40,6 @@ export default function Error({ error, reset }: ErrorProps) { aria-label="Error details" > {error.message} - {error.stack && `\n\n${error.stack}`} )}
diff --git a/tests/unit/error-boundary-stack.test.ts b/tests/unit/error-boundary-stack.test.ts new file mode 100644 index 0000000000..7adbd8852c --- /dev/null +++ b/tests/unit/error-boundary-stack.test.ts @@ -0,0 +1,12 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; + +const repoRoot = join(import.meta.dirname, "../.."); + +test("app error boundary does not render stack traces", async () => { + const source = await readFile(join(repoRoot, "src/app/error.tsx"), "utf8"); + + assert.doesNotMatch(source, /error\.stack/); +});