Skip to content

Commit

Permalink
chore: add test-watch script to the wrangler workspace
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petebacondarwin committed Jan 18, 2022
1 parent ad14519 commit 064c88f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .changeset/young-horses-jam.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 064c88f

Please sign in to comment.