From 3bd8e01495d2491d551172804e540e7b649bd77e Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 24 Feb 2022 09:20:17 +0000 Subject: [PATCH] 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 --- .c8rc.json | 10 ++++++++++ .github/workflows/test.yml | 2 -- package.json | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index d30369ac42..6c9dfafab0 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -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}" ], diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 966a0baf90..0bc12f53b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/package.json b/package.json index 1808927bfa..b0a140b681 100644 --- a/package.json +++ b/package.json @@ -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'",