Skip to content

Commit 0f8ebbd

Browse files
committed
test: ensure local dependencies are up-to-date
While jest will run a package and its tests without needing a build step, it will use the last-built version of the other packages for its dependencies, so we're not actually guaranteed to be testing the latest state unless we build all of a package's local dependencies before we start testing it. The `test:watch` scripts have been removed, as a watch mode that tests without building is not reliable. I don't think any local packages are getting injected, but I added `syncInjectedDepsAfterScripts` to `pnpm-workspace.yaml` to be safe. Since we're running tests in parallel, individual tests run slower, so I had to increase some timeouts.
1 parent 91cd63c commit 0f8ebbd

File tree

11 files changed

+30
-38
lines changed

11 files changed

+30
-38
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ jobs:
99
strategy:
1010
matrix:
1111
node-version: [18.x]
12-
package:
13-
- cli
14-
- core
15-
- matchers
16-
- parser
17-
- rebuild-matchers
18-
- utils
1912

2013
env:
2114
CI: true
@@ -32,14 +25,5 @@ jobs:
3225
- name: Install Dependencies
3326
run: pnpm install --frozen-lockfile
3427

35-
- name: Build
36-
working-directory: packages/${{ matrix.package }}
37-
run: pnpm build
38-
39-
- name: Run Linter
40-
working-directory: packages/${{ matrix.package }}
41-
run: pnpm lint
42-
43-
- name: Run Tests
44-
working-directory: packages/${{ matrix.package }}
45-
run: pnpm test
28+
- name: Check
29+
run: pnpm check

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ pnpm install
2323
Then make sure the tests pass:
2424

2525
```sh
26-
$ pnpm test
26+
$ pnpm check
2727
```
2828

2929
### Running linting/testing

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
"typescript": "^4.4.4"
4343
},
4444
"scripts": {
45-
"prepare": "husky install"
45+
"prepare": "husky install",
46+
"build": "pnpm run --recursive build",
47+
"lint": "pnpm run --parallel --recursive lint",
48+
"check": "pnpm build && pnpm lint && pnpm run --parallel --recursive test"
4649
},
4750
"packageManager": "[email protected]+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
4851
}

packages/cli/__tests__/cli/extensions.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import createTemporaryFile, {
66
import plugin from '../helpers/plugin'
77
import { runCodemodCLI } from '../helpers/runCodemodCLI'
88

9+
jest.setTimeout(10_000)
10+
911
test('can load plugins written with ES modules by default', async function () {
1012
const afile = await createTemporaryFile('a-file.js', '3 + 4;')
1113
expect(

packages/cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"lint": "eslint .",
2121
"lint:fix": "eslint . --fix",
2222
"prepublishOnly": "pnpm clean && pnpm build",
23-
"test": "is-ci test:coverage test:watch",
24-
"test:coverage": "jest --coverage",
25-
"test:watch": "jest --watch"
23+
"test": "is-ci test:coverage test:basic",
24+
"test:basic": "jest",
25+
"test:coverage": "jest --coverage"
2626
},
2727
"dependencies": {
2828
"@babel/core": "^7.20.12",

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"lint": "eslint .",
1717
"lint:fix": "eslint . --fix",
1818
"prepublishOnly": "pnpm clean && pnpm build",
19-
"test": "is-ci test:coverage test:watch",
20-
"test:coverage": "jest --coverage",
21-
"test:watch": "jest --watch"
19+
"test": "is-ci test:coverage test:basic",
20+
"test:basic": "jest",
21+
"test:coverage": "jest --coverage"
2222
},
2323
"dependencies": {
2424
"@babel/core": "^7.20.12",

packages/matchers/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"lint": "eslint .",
1717
"lint:fix": "eslint . --fix",
1818
"prepublishOnly": "pnpm clean && pnpm build",
19-
"test": "is-ci test:coverage test:watch",
20-
"test:coverage": "jest --coverage",
21-
"test:watch": "jest --watch"
19+
"test": "is-ci test:coverage test:basic",
20+
"test:basic": "jest",
21+
"test:coverage": "jest --coverage"
2222
},
2323
"dependencies": {
2424
"@babel/types": "^7.20.7",

packages/parser/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"lint": "eslint .",
1717
"lint:fix": "eslint . --fix",
1818
"prepublishOnly": "pnpm clean && pnpm build",
19-
"test": "is-ci test:coverage test:watch",
20-
"test:coverage": "jest --coverage",
21-
"test:watch": "jest --watch"
19+
"test": "is-ci test:coverage test:basic",
20+
"test:basic": "jest",
21+
"test:coverage": "jest --coverage"
2222
},
2323
"dependencies": {
2424
"@babel/parser": "^7.20.15"

packages/rebuild-matchers/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"lint": "eslint .",
1818
"lint:fix": "eslint . --fix",
1919
"prepublishOnly": "pnpm clean && pnpm build",
20-
"test": "is-ci test:coverage test:watch",
21-
"test:coverage": "jest --coverage",
22-
"test:watch": "jest --watch"
20+
"test": "is-ci test:coverage test:basic",
21+
"test:basic": "jest",
22+
"test:coverage": "jest --coverage"
2323
},
2424
"dependencies": {
2525
"@babel/types": "^7.20.7",

packages/utils/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"lint": "eslint .",
1717
"lint:fix": "eslint . --fix",
1818
"prepublishOnly": "pnpm clean && pnpm build",
19-
"test": "is-ci test:coverage test:watch",
20-
"test:coverage": "jest --coverage",
21-
"test:watch": "jest --watch"
19+
"test": "is-ci test:coverage test:basic",
20+
"test:basic": "jest",
21+
"test:coverage": "jest --coverage"
2222
},
2323
"dependencies": {
2424
"@babel/core": "^7.20.12",

0 commit comments

Comments
 (0)