diff --git a/.changeset/young-horses-jam.md b/.changeset/young-horses-jam.md new file mode 100644 index 000000000000..42d8d747c047 --- /dev/null +++ b/.changeset/young-horses-jam.md @@ -0,0 +1,13 @@ +--- +"wrangler": patch +--- + +chore: add test-watch script to the wrangler workspace + +Watch the files in the wrangler workspace, and run the tests when anything changes: + +```sh +> npm run test-watch -w wrangler +``` + +This will also run all the tests in a single process (rather than in parallel shards) and will increase the test-timeout to 50 seconds, which is helpful when debugging. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c72003ff36c8..d924a347d8a8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,8 +135,9 @@ Tests in a workspace are executed, by [Jest](https://jestjs.io/), which is confi ``` - Watch the files in a specific workspace (e.g. wrangler), and run the tests when anything changes ```sh - > npm run test -w wrangler -- --watch + > npm run test-watch -w wrangler ``` + This will also run all the tests in a single process (rather than in parallel shards) and will increase the test-timeout to 50 seconds, which is helpful when debugging. ## Steps For Making Changes diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index f0c3407cd6ed..2dd7ca5e04fe 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -97,7 +97,8 @@ "bundle": "node -r esbuild-register scripts/bundle.ts", "build": "npm run clean && npm run bundle", "start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js", - "test": "CF_API_TOKEN=some-api-token CF_ACCOUNT_ID=some-account-id jest --silent=false --verbose=true" + "test": "CF_API_TOKEN=some-api-token CF_ACCOUNT_ID=some-account-id jest --silent=false --verbose=true", + "test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch" }, "engines": { "node": ">=16.7.0"