Skip to content

Commit 5884860

Browse files
committed
Set up CI to test the new watcher
* Run tests on macOS * Use Bash shell * Run watch mode test separately and serially
1 parent 0330ce0 commit 5884860

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

.github/workflows/ci.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
node-version: [^16.18, ^18.16, ^20.3]
19-
os: [ubuntu-latest, windows-latest]
19+
os: [ubuntu-latest, windows-latest, macos-latest]
2020
steps:
2121
- uses: actions/checkout@v3
2222
- name: Enable symlinks
@@ -29,7 +29,8 @@ jobs:
2929
node-version: ${{ matrix.node-version }}
3030
cache: npm
3131
- run: npm install --no-audit
32-
- run: npm run cover
32+
- run: ./scripts/ci.sh
33+
shell: bash
3334
- uses: codecov/codecov-action@v3
3435
with:
3536
files: coverage/lcov.info
@@ -83,7 +84,8 @@ jobs:
8384
with:
8485
node-version-file: package.json
8586
- run: npm install --no-package-lock --no-audit
86-
- run: npm run cover
87+
- run: ./scripts/ci.sh
88+
shell: bash
8789

8890
xo:
8991
name: Lint source files

ava.config.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import process from 'node:process';
2+
3+
const skipWatchMode = process.env.TEST_AVA_SKIP_WATCH_MODE ? ['!test/watch-mode/**'] : [];
4+
15
export default { // eslint-disable-line import/no-anonymous-default-export
2-
files: ['test/**', '!test/**/{fixtures,helpers}/**'],
6+
files: ['test/**', '!test/**/{fixtures,helpers}/**', ...skipWatchMode],
37
ignoredByWatcher: ['{coverage,docs,media,test-types,test-tap}/**'],
48
environmentVariables: {
59
AVA_FAKE_SCM_ROOT: '.fake-root', // This is an internal test flag.

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
"node": "^16.18 || ^18.16 || ^20.3"
3737
},
3838
"scripts": {
39-
"cover": "c8 --report=none test-ava && c8 --report=none --no-clean tap && c8 report",
40-
"test": "xo && tsc --noEmit && npm run -s cover"
39+
"test": "./scripts/test.sh"
4140
},
4241
"files": [
4342
"entrypoints",

scripts/ci.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
TEST_AVA_SKIP_WATCH_MODE=1 npx c8 --report=none npx test-ava
5+
# Reduce concurrency and be generous with timeouts to give watch mode tests a
6+
# better chance of succeeding in a CI environment.
7+
npx c8 --report=none --no-clean npx test-ava --serial --timeout 30s test/watch-mode
8+
npx c8 --report=none --no-clean npx tap
9+
npx c8 report

scripts/test.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
npx xo
5+
npx tsc --noEmit
6+
npx c8 --report=none npx test-ava
7+
npx c8 --report=none --no-clean npx tap
8+
npx c8 report

0 commit comments

Comments
 (0)