Skip to content

Commit

Permalink
test(mocha): run tests in parallel (#4374)
Browse files Browse the repository at this point in the history
* perf(mocha): run tests in parallel

- but disable parallel mode in nyc
  * istanbuljs/nyc#1328
- pass command-line option via npm
  * https://stackoverflow.com/a/14404223

* ci(gh-action): run coverage job separately and only once

* chore: ignore nyc lcovonly output
  • Loading branch information
curbengh authored Jul 17, 2020
1 parent 5b2808c commit 064daa4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/tester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,34 @@ jobs:
- name: Install Dependencies
run: npm install
- name: Test
run: npm run test
env:
CI: true
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: ['12.x']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-npm-cache
restore-keys: ${{ runner.os }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Coverage
run: npm run test-cov
env:
CI: true
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ runner.os }}-${{ matrix.node-version }}
parallel: true
coverall-finish:
needs: tester
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ tmp/
yarn.lock
package-lock.json
.nyc_output/
coverage/
.tmp*
1 change: 1 addition & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ full-trace: true
exit: true
require:
- "chai/register-should"
parallel: true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"eslint": "eslint .",
"test": "mocha test/index.js",
"test-cov": "nyc --reporter=lcovonly npm run test",
"test-cov": "nyc --reporter=lcovonly npm run test -- --no-parallel",
"lint-staged": "lint-staged"
},
"directories": {
Expand Down

0 comments on commit 064daa4

Please sign in to comment.