From 070a6ac13cb15c0d358af5f3d9d7233fc2bfc9d4 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 26 Aug 2021 13:38:33 +0200 Subject: [PATCH] Configured `c8` to use all source files no issue - by default, `c8` will only show stats for files that were loaded during execution - this means the coverage stats are too high because we're not taking into account all the files not loaded by tests - this commit append the `--all` flag to `c8` which fixes this --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b50ab0c1b4..f7ef49c561 100644 --- a/package.json +++ b/package.json @@ -29,11 +29,11 @@ "test": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000", "test:all": "yarn test:unit && yarn test:acceptance && yarn lint", "test:debug": "DEBUG=ghost:test* yarn test", - "test:unit": "c8 --reporter text-summary mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000", + "test:unit": "c8 --all -n 'core/{*.js,frontend,server,shared}' --reporter text-summary mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000", "test:acceptance": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/api-acceptance' './test/frontend-acceptance' --timeout=10000", "test:regression": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000", "test:slow": "yarn test:unit --reporter=mocha-slow-test-reporter && yarn test:acceptance --reporter=mocha-slow-test-reporter", - "coverage:unit": "c8 report", + "coverage:unit": "c8 report --all -n 'core/{*.js,frontend,server,shared}' --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'",