Skip to content

Commit

Permalink
Set up CI to test the new watcher
Browse files Browse the repository at this point in the history
* Run tests on macOS
* Use Bash shell
* Run watch mode test separately and serially
  • Loading branch information
novemberborn committed Jul 2, 2023
1 parent c0b0d7b commit 6cc417b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
node-version: [^16.18, ^18.16, ^20.3]
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Enable symlinks
Expand All @@ -29,7 +29,8 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm install --no-audit
- run: npm run cover
- run: ./scripts/ci.sh
shell: bash
- uses: codecov/codecov-action@v3
with:
files: coverage/lcov.info
Expand Down Expand Up @@ -83,7 +84,8 @@ jobs:
with:
node-version-file: package.json
- run: npm install --no-package-lock --no-audit
- run: npm run cover
- run: ./scripts/ci.sh
shell: bash

xo:
name: Lint source files
Expand Down
6 changes: 5 additions & 1 deletion ava.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import process from 'node:process';

const skipWatchMode = process.env.TEST_AVA_SKIP_WATCH_MODE ? ['!test/watch-mode/**'] : [];

export default { // eslint-disable-line import/no-anonymous-default-export
files: ['test/**', '!test/**/{fixtures,helpers}/**'],
files: ['test/**', '!test/**/{fixtures,helpers}/**', ...skipWatchMode],
ignoredByWatcher: ['{coverage,docs,media,test-types,test-tap}/**'],
environmentVariables: {
AVA_FAKE_SCM_ROOT: '.fake-root', // This is an internal test flag.
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"node": "^16.18 || ^18.16 || ^20.3"
},
"scripts": {
"cover": "c8 --report=none test-ava && c8 --report=none --no-clean tap && c8 report",
"test": "xo && tsc --noEmit && npm run -s cover"
"test": "./scripts/test.sh"
},
"files": [
"entrypoints",
Expand Down
9 changes: 9 additions & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -ex

TEST_AVA_SKIP_WATCH_MODE=1 npx c8 --report=none npx test-ava
# Reduce concurrency and be generous with timeouts to give watch mode tests a
# better chance of succeeding in a CI environment.
npx c8 --report=none --no-clean npx test-ava --serial --timeout 30s test/watch-mode
npx c8 --report=none --no-clean npx tap
npx c8 report
8 changes: 8 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -ex

npx xo
npx tsc --noEmit
npx c8 --report=none npx test-ava
npx c8 --report=none --no-clean npx tap
npx c8 report

0 comments on commit 6cc417b

Please sign in to comment.