Skip to content

Commit

Permalink
fix fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
emily-shen committed Feb 17, 2025
1 parent 77ecdf4 commit 3d88fea
Showing 1 changed file with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("`wrangler types` - file comment", () => {
"packages",
"wrangler"
);
execSync(`npx ${wranglerPath} types ${args}`, {
execSync(`npx ${wranglerPath} types ${args} --include-runtime=false`, {

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium test

This shell command depends on an uncontrolled
absolute path
.
cwd: tempDir,
});
const typesFile = join(tempDir, expectedOutputFile);
Expand All @@ -38,24 +38,38 @@ describe("`wrangler types` - file comment", () => {
describe("includes a comment specifying the command run", () => {
it("(base command)", async ({ expect }) => {
const typesCommandOutput = runWranglerTypesCommand();
expect(typesCommandOutput).toContain("by running `wrangler types`");
expect(typesCommandOutput).toMatchInlineSnapshot(`
"// Generated by Wrangler by running \`wrangler types --include-runtime=false\`
interface Env {
MY_VAR: "my-var-value";
}
"
`);
});

it("(with types customization)", async ({ expect }) => {
const typesCommandOutput = runWranglerTypesCommand(
"--env-interface MyCloudflareEnv ./cflare-env.d.ts",
"./cflare-env.d.ts"
);
expect(typesCommandOutput).toContain(
"by running `wrangler types --env-interface MyCloudflareEnv ./cflare-env.d.ts`"
);
expect(typesCommandOutput).toMatchInlineSnapshot(`
"// Generated by Wrangler by running \`wrangler types --env-interface MyCloudflareEnv ./cflare-env.d.ts --include-runtime=false\`
interface MyCloudflareEnv {
MY_VAR: "my-var-value";
}
"
`);
});

it("(with wrangler top level options)", async ({ expect }) => {
const typesCommandOutput = runWranglerTypesCommand("-c wranglerA.toml");
expect(typesCommandOutput).toContain(
"by running `wrangler types -c wranglerA.toml`"
);
expect(typesCommandOutput).toMatchInlineSnapshot(`
"// Generated by Wrangler by running \`wrangler types -c wranglerA.toml --include-runtime=false\`
interface Env {
MY_VAR: "my-var-value";
}
"
`);
});
});
});

0 comments on commit 3d88fea

Please sign in to comment.