-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore nodejs_compat flags in runtime type generation (#6554)
* fix: ignore nodejs_compat flags in runtime type generation * chore: add changeset * tests: create tests for getNodeCompatMode * chore: extract node compat helper to own file * chore: remove spurious files * chore: undo refactoring * chore: tidy up --------- Co-authored-by: Andy Jessop <[email protected]>
- Loading branch information
1 parent
439e63a
commit 46aee5d
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
fix: nodejs_compat flags no longer error when running wrangler types --x-include-runtime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,24 @@ describe("types", () => { | |
`📣 It looks like you have some Node.js compatibility turned on in your project. You might want to consider adding Node.js typings with "npm i --save-dev @types/[email protected]". Please see the docs for more details: https://developers.cloudflare.com/workers/languages/typescript/#transitive-loading-of-typesnode-overrides-cloudflareworkers-types` | ||
); | ||
}); | ||
|
||
it("should not error with nodejs_compat flags", async () => { | ||
const helper = new WranglerE2ETestHelper(); | ||
await helper.seed({ | ||
...seed, | ||
"wrangler.toml": dedent` | ||
name = "test-worker" | ||
main = "src/index.ts" | ||
compatibility_date = "2023-01-01" | ||
compatibility_flags = ["nodejs_compat", "experimental:nodejs_compat_v2"] | ||
`, | ||
}); | ||
|
||
const output = await helper.run( | ||
`wrangler types --x-include-runtime="./types.d.ts"` | ||
); | ||
|
||
expect(output.stderr).toBe(""); | ||
expect(output.status).toBe(0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters