Skip to content

Commit c84f8ed

Browse files
committed
build: slim down npm tasks and make them more consistent
Notable changes here: - Make testing targets more consistent. E.g. no more `npm run e2e`, - Slim down how many tasks we have, including by getting rid of `test:ci` tasks. We already pass additional flags to Vitest in several CI workflows, so I don't see the benefit in maintaining these tasks. - Don't automatically run `test:init`. We already manually run it in the integration CI workflow, so I'm following that workflow's lead. (Hopefully) soon we'll incorporate these setup steps into the tests themselves so you don't have to run any pre-test setup steps at all. - Remove the explicit Vitest reporter. (This will make Vitest automatically use the GitHub Actions reporter in CI.)
1 parent df222eb commit c84f8ed

File tree

7 files changed

+13
-19
lines changed

7 files changed

+13
-19
lines changed

.github/workflows/e2e-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: npm run build
5050

5151
- name: Run E2E tests
52-
run: npm run e2e
52+
run: npm run test:e2e
5353

5454
- name: Notify Slack
5555
uses: 8398a7/action-slack@v3
@@ -103,7 +103,7 @@ jobs:
103103
run: npm run build
104104

105105
- name: Run E2E tests
106-
run: npm run e2e
106+
run: npm run test:e2e
107107

108108
- name: Notify Slack
109109
uses: 8398a7/action-slack@v3

.github/workflows/integration-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
timeout_minutes: 15
7777
max_attempts: 3
7878
retry_on: error
79-
command: npm run test:ci:vitest:integration -- --shard=${{ matrix.shard }}
79+
command: npm run test:integration -- --coverage --shard=${{ matrix.shard }}
8080
env:
8181
# GitHub secrets are not available when running on PR from forks
8282
# We set a flag so we can skip tests that access Netlify API
@@ -169,7 +169,7 @@ jobs:
169169
timeout_minutes: 15
170170
max_attempts: 3
171171
retry_on: error
172-
command: npm exec vitest -- run tests/integration/commands/dev/dev.test.ts
172+
command: npm exec vitest -- run tests/integration/commands/dev/dev.test.ts --coverage
173173
env:
174174
# GitHub secrets are not available when running on PR from forks
175175
# We set a flag so we can skip tests that access Netlify API

.github/workflows/release-please.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: npm run build
5353

5454
- name: Run E2E tests
55-
run: npm run e2e
55+
run: npm run test:e2e
5656

5757
- name: Publish package
5858
run: npm publish --provenance

.github/workflows/unit-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ jobs:
4545
timeout_minutes: 15
4646
max_attempts: 3
4747
retry_on: error
48-
command: npm run test:ci:vitest:unit
48+
command: npm run test:unit -- --coverage

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-10
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,26 @@
3636
"clean": "rm -rf dist/",
3737
"dev": "tsc --project tsconfig.build.json --watch",
3838
"docs": "npm run --prefix=site build",
39-
"e2e": "vitest run --config vitest.e2e.config.ts",
40-
"e2e:debug": "DEBUG='netlify-cli:test' npm run e2e",
4139
"format": "npm run _format -- --write",
4240
"format:check": "npm run _format -- --check",
43-
"start": "node ./bin/run.js",
44-
"test": "npm run test:dev",
4541
"lint": "eslint --cache \"{src,scripts,tests,.github}/**/*.{mjs,cjs,js,md,html}\" \"*.{mjs,cjs,js,md,html}\"",
4642
"lint:fix": "npm run lint --fix",
47-
"test:dev": "run-s test:init:* test:dev:*",
48-
"test:dev:vitest": "vitest run tests/unit/ && vitest run tests/integration",
43+
"start": "node ./bin/run.js",
44+
"test": "run-s test:unit test:integration test:e2e",
45+
"test:e2e": "vitest run --config vitest.e2e.config.ts",
4946
"test:init": "run-s test:init:*",
5047
"test:init:cli-help": "npm run start -- --help",
5148
"test:init:cli-version": "npm run start -- --version",
5249
"test:init:eleventy-deps": "cd tests/integration/__fixtures__/eleventy-site && pnpm install --frozen-lockfile",
5350
"test:init:hugo-deps": "npm ci --prefix tests/integration/__fixtures__/hugo-site --no-audit",
5451
"test:init:monorepo-deps": "cd tests/integration/__fixtures__/monorepo && pnpm install --frozen-lockfile",
5552
"test:init:next-deps": "npm ci --prefix tests/integration/__fixtures__/next-app-without-config --no-audit && npm ci --prefix tests/integration/__fixtures__/next-app --no-audit",
56-
"test:ci:vitest:integration": "vitest run --coverage tests/integration/",
57-
"test:ci:vitest:unit": "vitest run --coverage tests/unit/",
53+
"test:integration": "vitest run tests/integration/",
54+
"test:unit": "vitest run tests/unit/",
5855
"postinstall": "node ./scripts/postinstall.js",
5956
"prepublishOnly": "npm shrinkwrap",
6057
"typecheck": "tsc",
61-
"typecheck:watch": "tsc --watch",
62-
"watch": "c8 --reporter=lcov vitest --watch"
58+
"typecheck:watch": "tsc --watch"
6359
},
6460
"dependencies": {
6561
"@fastify/static": "7.0.4",

vitest.config.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import process from 'process'
2-
31
import { defineConfig } from 'vitest/config'
42

53
export default defineConfig({
@@ -19,7 +17,6 @@ export default defineConfig({
1917
singleThread: true,
2018
},
2119
},
22-
reporters: [process.env.DEBUG_TESTS ? 'tap' : 'default'],
2320
coverage: {
2421
provider: 'v8',
2522
reporter: ['text', 'lcov'],

0 commit comments

Comments
 (0)