Skip to content

Commit

Permalink
Tweak CI behavior to avoid timeouts
Browse files Browse the repository at this point in the history
* Use Bash shell
* Run watch mode test separately and serially
  • Loading branch information
novemberborn committed Jul 2, 2023
1 parent 6c143a2 commit 31f0bcf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 31f0bcf

Please sign in to comment.