Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

test(env): module-load tests get 30 s; restore the one removed

Sidwebworksda5b4685fbac
diff --git a/packages/env/src/index.test.ts b/packages/env/src/index.test.ts
index 7cdbc461ac..14f7873bbb 100644
--- a/packages/env/src/index.test.ts
+++ b/packages/env/src/index.test.ts
@@ -11,7 +11,18 @@ afterEach(() => {
vi.resetModules();
});
-describe("module load", () => {
+// The first import transforms @carbon/utils cold. On a CI runner that alone
+// takes 5-6 s, past the default 5 s timeout, whichever test happens to run first.
+describe("module load", { timeout: 30_000 }, () => {
+ it("stops a server with one report of everything missing", async () => {
+ vi.stubEnv("VITEST", "");
+ vi.stubEnv("SESSION_SECRET", "");
+ vi.stubEnv("REDIS_URL", "");
+ await expect(import("./index")).rejects.toThrow(
+ /Carbon can't start[\s\S]*REDIS_URL[\s\S]*SESSION_SECRET/
+ );
+ });
+
it("never throws in the browser, and keeps secrets out", async () => {
vi.doMock("@carbon/utils", async (original) => ({
...(await original<typeof import("@carbon/utils")>()),