You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds some enhancements/fixes to the `wrangler init` command.
- doesn't overwrite `wrangler.toml` if it already exists
- installs `wrangler` when creating `package.json`
- offers to install `wrangler` into `package.json` even if `package.json` already exists
- offers to install `@cloudflare/workers-types` even if `tsconfig.json` already exists
- pipes stdio back to the terminal so there's feedback when it's installing npm packages
This does have the side effect of making our tests a _little_ slower. I added `--prefer-offline` to the `npm install` calls to make this a shade quicker, but I can't figure out a good way of mocking these. I'll think about it some more later. We should work on making the installs themselves quicker (re: #66)
This PR also fixes an issue with our tests: `runWrangler()` would catch thrown errors, and if we didn't manually verify the error, tests would pass. Instead, it now throws correctly, and I modified all the tests to assert on thrown errors. It seems like a lot, but it was just mechanical rewriting.
This PR adds some enhancements/fixes to the `wrangler init` command.
8
+
9
+
- doesn't overwrite `wrangler.toml` if it already exists
10
+
- installs `wrangler` when creating `package.json`
11
+
- offers to install `wrangler` into `package.json` even if `package.json` already exists
12
+
- offers to install `@cloudflare/workers-types` even if `tsconfig.json` already exists
13
+
- pipes stdio back to the terminal so there's feedback when it's installing npm packages
14
+
15
+
This does have the side effect of making out tests slower. I added `--prefer-offline` to the `npm install` calls to make this a shade quicker, but I can't figure out a good way of mocking these. I'll think about it some more later. We should work on making the installs themselves quicker (re: https://github.com/cloudflare/wrangler2/issues/66)
16
+
17
+
This PR also fixes a bug with our tests - `runWrangler` would catch thrown errors, and if we didn't manually verify the error, tests would pass. Instead, it now throws correctly, and I modified all the tests to assert on thrown errors. It seems like a lot, but it was just mechanical rewriting.
Copy file name to clipboardExpand all lines: packages/wrangler/src/__tests__/jest.setup.ts
+2
Original file line number
Diff line number
Diff line change
@@ -20,3 +20,5 @@ jest.mock("../dialogs");
20
20
"Unexpected call to `prompt()`. You should use `mockPrompt()` to mock calls to `prompt()` with expectations. Search the codebase for `mockPrompt` to learn more."
0 commit comments