From c0e6475a25fb78f1feea483753f2f32b4b4e078c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 01:47:19 +0100 Subject: [PATCH] test: tighten tsdown cleanup absence assertions --- test/scripts/tsdown-build.test.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/scripts/tsdown-build.test.ts b/test/scripts/tsdown-build.test.ts index 197acba7582..1d20a066a6d 100644 --- a/test/scripts/tsdown-build.test.ts +++ b/test/scripts/tsdown-build.test.ts @@ -97,13 +97,15 @@ describe("resolveTsdownBuildInvocation", () => { await expect( fsPromises.readFile(path.join(distRuntimeDir, "heartbeat-runner.runtime.js"), "utf8"), ).resolves.toBe("alias\n"); - await expect(fsPromises.stat(path.join(distDir, "delegate-BPjCe4gC.js"))).rejects.toThrow(); + await expect(fsPromises.stat(path.join(distDir, "delegate-BPjCe4gC.js"))).rejects.toMatchObject( + { code: "ENOENT" }, + ); await expect( fsPromises.stat(path.join(distDir, "compact.runtime-2DiEmVcA.js")), - ).rejects.toThrow(); + ).rejects.toMatchObject({ code: "ENOENT" }); await expect( fsPromises.stat(path.join(distRuntimeDir, "heartbeat-runner.runtime-fspOEj_1.js")), - ).rejects.toThrow(); + ).rejects.toMatchObject({ code: "ENOENT" }); }); it("cleans tsdown output roots before using tsdown --no-clean", async () => { @@ -123,9 +125,11 @@ describe("resolveTsdownBuildInvocation", () => { cleanTsdownOutputRoots({ cwd: rootDir }); - await expect(fsPromises.stat(distFile)).rejects.toThrow(); - await expect(fsPromises.stat(pluginGeneratedFile)).rejects.toThrow(); - await expect(fsPromises.stat(path.join(rootDir, "dist-runtime"))).rejects.toThrow(); + await expect(fsPromises.stat(distFile)).rejects.toMatchObject({ code: "ENOENT" }); + await expect(fsPromises.stat(pluginGeneratedFile)).rejects.toMatchObject({ code: "ENOENT" }); + await expect(fsPromises.stat(path.join(rootDir, "dist-runtime"))).rejects.toMatchObject({ + code: "ENOENT", + }); await expect(fsPromises.readFile(unrelatedFile, "utf8")).resolves.toBe("keep\n"); }); });