Skip to content

Commit 7cb43b6

Browse files
authored
build: standardize test scripts (#357)
1 parent 98521c2 commit 7cb43b6

11 files changed

Lines changed: 41 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
- name: npm install and test
5151
run: |
5252
npm install
53-
npm test
53+
npm run test:unit
5454
env:
5555
CI: true
5656

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"test": "npm test --workspaces --if-present",
87
"build": "node scripts/build.js",
98
"build:new-pkg": "node tools/new-pkg.js",
109
"prepare": "npm run build",
@@ -14,8 +13,10 @@
1413
"lint:unused": "knip",
1514
"fmt": "prettier --write .",
1615
"fmt:check": "prettier --check .",
16+
"test": "npm test --workspaces --if-present",
1717
"test:jsr": "npm run test:jsr --workspaces --if-present",
18-
"test:types": "tsc && npm run test:types --workspaces --if-present"
18+
"test:types": "tsc && npm run test:types --workspaces --if-present",
19+
"test:unit": "npm run test:unit --workspaces --if-present"
1920
},
2021
"workspaces": [
2122
"packages/*"

packages/compat/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
2929
"build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts",
3030
"lint:types": "attw --pack",
31-
"test": "mocha \"tests/**/*.test.js\"",
32-
"test:coverage": "c8 npm test",
33-
"test:jsr": "npx -y jsr@latest publish --dry-run"
31+
"pretest": "npm run build",
32+
"test": "npm run test:unit",
33+
"test:coverage": "c8 npm run test:unit",
34+
"test:jsr": "npx -y jsr@latest publish --dry-run",
35+
"test:unit": "mocha \"tests/**/*.test.js\""
3436
},
3537
"repository": {
3638
"type": "git",

packages/config-array/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@
3838
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts && npm run build:std__path",
3939
"lint:types": "attw --pack",
4040
"pretest": "npm run build",
41-
"test": "mocha \"tests/**/*.test.js\"",
42-
"test:coverage": "c8 npm test",
41+
"test": "npm run test:types && npm run test:unit",
42+
"test:coverage": "npm run build && c8 npm run test:unit",
4343
"test:jsr": "npx -y jsr@latest publish --dry-run",
44-
"test:types": "tsc -p tests/types/tsconfig.json"
44+
"test:types": "tsc -p tests/types/tsconfig.json",
45+
"test:unit": "mocha \"tests/**/*.test.js\""
4546
},
4647
"keywords": [
4748
"configuration",

packages/config-helpers/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
3030
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
3131
"lint:types": "attw --pack",
32-
"test": "mocha \"tests/**/*.test.js\"",
33-
"test:coverage": "c8 npm test",
32+
"pretest": "npm run build",
33+
"test": "npm run test:types && npm run test:unit",
34+
"test:coverage": "c8 npm run test:unit",
3435
"test:jsr": "npx -y jsr@latest publish --dry-run",
3536
"test:pnpm": "cd tests/pnpm && pnpm install && pnpm exec tsc",
36-
"test:types": "tsc -p tests/types/tsconfig.json"
37+
"test:types": "tsc -p tests/types/tsconfig.json",
38+
"test:unit": "mocha \"tests/**/*.test.js\""
3739
},
3840
"repository": {
3941
"type": "git",

packages/core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"",
2121
"build": "tsc && npm run build:cts",
2222
"lint:types": "attw --pack",
23+
"pretest": "npm run build",
24+
"test": "npm run test:types",
2325
"test:jsr": "npx -y jsr@latest publish --dry-run",
2426
"test:types": "tsc -p tests/types/tsconfig.json"
2527
},

packages/mcp/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
},
1616
"scripts": {
1717
"build": "tsc",
18-
"test": "mocha \"tests/**/*.test.js\"",
19-
"test:coverage": "c8 npm test"
18+
"pretest": "npm run build",
19+
"test": "npm run test:unit",
20+
"test:coverage": "c8 npm run test:unit",
21+
"test:unit": "mocha \"tests/**/*.test.js\""
2022
},
2123
"repository": {
2224
"type": "git",

packages/migrate-config/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
"test": "tests"
1717
},
1818
"scripts": {
19-
"test": "mocha \"tests/**/*.test.js\"",
20-
"test:coverage": "c8 npm test"
19+
"test": "npm run test:unit",
20+
"test:coverage": "c8 npm run test:unit",
21+
"test:unit": "mocha \"tests/**/*.test.js\""
2122
},
2223
"repository": {
2324
"type": "git",

packages/object-schema/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
3030
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
3131
"lint:types": "attw --pack",
32-
"test": "mocha \"tests/**/*.test.js\"",
33-
"test:coverage": "c8 npm test",
32+
"pretest": "npm run build",
33+
"test": "npm run test:types && npm run test:unit",
34+
"test:coverage": "c8 npm run test:unit",
3435
"test:jsr": "npx -y jsr@latest publish --dry-run",
35-
"test:types": "tsc -p tests/types/tsconfig.json"
36+
"test:types": "tsc -p tests/types/tsconfig.json",
37+
"test:unit": "mocha \"tests/**/*.test.js\""
3638
},
3739
"repository": {
3840
"type": "git",

packages/plugin-kit/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
3838
"lint:types": "attw --pack",
3939
"pretest": "npm run build",
40-
"test": "mocha \"tests/**/*.test.js\"",
41-
"test:coverage": "c8 npm test",
40+
"test": "npm run test:types && npm run test:unit",
41+
"test:coverage": "npm run build && c8 npm run test:unit",
4242
"test:jsr": "npx -y jsr@latest publish --dry-run",
43-
"test:types": "tsc -p tests/types/tsconfig.json"
43+
"test:types": "tsc -p tests/types/tsconfig.json",
44+
"test:unit": "mocha \"tests/**/*.test.js\""
4445
},
4546
"keywords": [
4647
"eslint",

0 commit comments

Comments
 (0)