Skip to content

Commit 640d660

Browse files
committed
add test for referencing variables
1 parent 8d7a7d5 commit 640d660

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/cloudflare/src/cli/build/utils/extract-project-env-vars.spec.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { writeFileSync } from "node:fs";
1+
import { appendFileSync, writeFileSync } from "node:fs";
22

33
import { BuildOptions } from "@opennextjs/aws/build/helper.js";
44
import mockFs from "mock-fs";
@@ -54,4 +54,17 @@ describe("extractProjectEnvVars", () => {
5454
ENV_VAR: "value",
5555
});
5656
});
57+
58+
it("should support referencing variables", () => {
59+
appendFileSync(".env.production.local", "\nENV_PROD_LOCAL_VAR_REF=$ENV_PROD_LOCAL_VAR");
60+
61+
const result = extractProjectEnvVars("production", options);
62+
expect(result).toEqual({
63+
ENV_LOCAL_VAR: "value",
64+
ENV_PROD_LOCAL_VAR: "value",
65+
ENV_PROD_LOCAL_VAR_REF: "value",
66+
ENV_PROD_VAR: "value",
67+
ENV_VAR: "value",
68+
});
69+
});
5770
});

0 commit comments

Comments
 (0)