Pinned coverage to current levels to prevent drops

- Updating our config to have `--check-coverage` enforces that the coverage meets a certain level.
- The default is 95 I believe, but our coverage is lower.
- I've set the levels to our current levels, so any drop below these numbers will cause the build to fail.
- I've also set the reporters to be text, html and cobertura so we always have a mini report, the full HTML files to navigate and cobertura for CI
- Cleaned up CI so we don't use the cov:unit command as we're now using codecov
- This also means we can remove the cov:unit command which was weird to use because it uses the last test run, which can be confusing
This commit is contained in:
Hannah Wolfe 2022-02-24 09:20:17 +00:00
parent 6d648487fc
commit 3bd8e01495
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,15 @@
{
"all": true,
"check-coverage": true,
"reporter": [
"html",
"text-summary",
"cobertura"
],
"statements": 56,
"branches": 85,
"functions": 51,
"lines": 56,
"include": [
"core/{*.js,frontend,server,shared}"
],

View File

@ -112,8 +112,6 @@ jobs:
- run: yarn
- run: yarn test:unit
- name: Unit test coverage
run: yarn cov:unit
- uses: codecov/codecov-action@v2
- uses: daniellockyer/action-slack-build@master

View File

@ -29,7 +29,7 @@
"test": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000",
"test:all": "yarn test:unit && yarn test:integration && yarn test:e2e && yarn lint",
"test:debug": "DEBUG=ghost:test* yarn test",
"test:unit": "c8 --reporter text-summary --reporter cobertura mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000",
"test:unit": "c8 mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000",
"test:integration": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/integration' --timeout=5000",
"test:e2e": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/e2e-api' './test/e2e-frontend' './test/e2e-server' --timeout=10000",
"test:regression": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000",
@ -39,7 +39,6 @@
"test:int:slow": "yarn test:integration --reporter=mocha-slow-test-reporter",
"test:e2e:slow": "yarn test:e2e --reporter=mocha-slow-test-reporter",
"test:reg:slow": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000 --reporter=mocha-slow-test-reporter",
"cov:unit": "c8 report --reporter text --reporter html",
"lint:server": "eslint --ignore-path .eslintignore 'core/server/**/*.js' 'core/*.js' '*.js'",
"lint:shared": "eslint --ignore-path .eslintignore 'core/shared/**/*.js'",
"lint:frontend": "eslint --ignore-path .eslintignore 'core/frontend/**/*.js'",