Skip to content

Commit ec1c971

Browse files
chore: migrate tests from mocha to vitest (PRE-3838) (#281)
* chore: migrate tests from mocha to vitest Replace mocha 6 with vitest 4.1.11. done callbacks become awaited promises with the assertions moved after the await; vitest.config.js unsets PRERENDER_SERVICE_URL so the suite is hermetic, and runs test files serially because both Express support apps bind the same port. Travis now runs on Node 20, the minimum Vitest 4 supports. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * ci: run the test suite on pull requests Tests only ran inside the publish job on push to master, so a broken suite was first seen after merge and blocked the release. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore: keep vitest.config.js and .github out of the npm tarball vitest.config.js requires vitest, a devDependency consumers don't have. .github already shipped before this PR; the new test workflow would have joined it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 63a13e2 commit ec1c971

9 files changed

Lines changed: 1369 additions & 1222 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v5
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Setup test dependencies
27+
run: |
28+
cd test/support/express3 && npm install
29+
cd ../express4 && npm install
30+
31+
- name: Run tests
32+
run: npm test

‎.npmignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
test
22
.travis.yml
3+
vitest.config.js
4+
.github

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "10"
3+
- "20"
44
script:
55
- cd test/support/express3 && npm install
66
- cd ../express4 && npm install

0 commit comments

Comments
 (0)