puppeteer/.travis.yml
Jack Franklin 5518bac291
chore: update how we track coverage during unit tests (#5779)
* chore: update how we track coverage during unit tests

The old method of tracking coverage was causing issues. If a test failed
on CI, that test's failure would be lost because the test failing would
in turn cause the coverage to fail, but the `process.exit(1)` in the
coverage code caused Mocha to not output anything useful.

Instead the coverage checker now:

* tracks the coverage in memory in a Map (this hasn't changed)
* after all tests, writes that to disk in test/coverage.json (which is
gitignored)
* we then run a single Mocha test that asserts every method was called.

This means if the test run fails, the build will fail and give the error
about that test run, and that output won't be lost when the coverage
then fails too.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
2020-04-30 13:00:41 +01:00

65 lines
1.6 KiB
YAML

language: node_js
services: xvfb
jobs:
include:
- os: "osx"
name: 'Unit tests: macOS/Chromium'
node_js: "10.19.0"
env:
- CHROMIUM=true
before_install:
- PUPPETEER_PRODUCT=firefox npm install
script:
- ls .local-chromium .local-firefox
- npm run tsc
- travis_retry npm run unit
- os: "windows"
name: 'Unit tests: Windows/Chromium'
node_js: "10.19.0"
env:
- CHROMIUM=true
before_install:
- PUPPETEER_PRODUCT=firefox npm install
script:
- ls .local-chromium .local-firefox
- npm run tsc
- travis_retry npm run unit
# Runs unit tests on Linux + Chromium
- node_js: "10.19.0"
name: 'Unit tests [with coverage]: Linux/Chromium'
env:
- CHROMIUM=true
before_install:
- PUPPETEER_PRODUCT=firefox npm install
script:
- travis_retry npm run unit-with-coverage
- npm run assert-unit-coverage
# This bot runs all the extra checks that aren't the main Puppeteer unit tests
- node_js: "10.19.0"
name: 'Extra tests: Linux/Chromium'
env:
- CHROMIUM=true
script:
- npm run compare-protocol-d-ts
- npm run test-install
- npm run lint
- npm run test-doclint
- npm run test-types
# Runs unit tests on Linux + Firefox
- node_js: "10.19.0"
name: 'Unit tests: Linux/Firefox'
env:
- FIREFOX=true
before_install:
- PUPPETEER_PRODUCT=firefox npm install
script:
- travis_retry npm run funit
notifications:
email: false