From 3e0ec264087895f891fca59e30850df32d2d1eb2 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 16 Nov 2022 16:21:33 +0700 Subject: [PATCH] Introduced separate config for e2e tests refs https://github.com/TryGhost/Toolbox/issues/475 - Having a single coverage config file for unit and e2e type of tests doesn't play well for tracking coverage progress. The unit test ones are run often when developing, so one can observe the changes in coverage. The e2e tests are ran mostly on CI environment and have different purposes/reach comparing to unit tests. --- .gitignore | 1 + ghost/core/.c8rc.e2e.json | 21 +++++++++++++++++++++ ghost/core/.c8rc.json | 2 +- ghost/core/package.json | 3 ++- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 ghost/core/.c8rc.e2e.json diff --git a/.gitignore b/.gitignore index 3994a5fa38..23eea89567 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ lib-cov # Coverage directory used by tools like istanbul coverage +coverage-e2e # nyc test coverage .nyc_output diff --git a/ghost/core/.c8rc.e2e.json b/ghost/core/.c8rc.e2e.json new file mode 100644 index 0000000000..711e197f1b --- /dev/null +++ b/ghost/core/.c8rc.e2e.json @@ -0,0 +1,21 @@ +{ + "all": true, + "check-coverage": true, + "reporter": [ + "html-spa", + "text-summary", + "cobertura" + ], + "reportsDir": "./coverage-e2e", + "statements": 78, + "branches": 80, + "functions": 80, + "lines": 78, + "include": [ + "core/{*.js,frontend,server,shared}" + ], + "exclude": [ + "core/server/data/migrations/**", + "!core/server/data/migrations/utils.js" + ] +} diff --git a/ghost/core/.c8rc.json b/ghost/core/.c8rc.json index 277e9c146d..03fa6fb477 100644 --- a/ghost/core/.c8rc.json +++ b/ghost/core/.c8rc.json @@ -7,7 +7,7 @@ "cobertura" ], "statements": 61, - "branches": 80, + "branches": 85, "functions": 51, "lines": 61, "include": [ diff --git a/ghost/core/package.json b/ghost/core/package.json index 79fa9fe0c7..4e82097281 100644 --- a/ghost/core/package.json +++ b/ghost/core/package.json @@ -33,7 +33,8 @@ "test:e2e": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/e2e-api' './test/e2e-frontend' './test/e2e-server' './test/e2e-webhooks' --timeout=15000", "test:regression": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000", "test:browser": "playwright test --browser=all test/e2e-browser", - "test:ci": "c8 yarn test:e2e -b && yarn test:integration -b && yarn test:regression -b", + "test:ci": "c8 -c ./.c8rc.e2e.json yarn test:ci:base", + "test:ci:base": "yarn test:e2e -b", "test:unit:slow": "yarn test:unit --reporter=mocha-slow-test-reporter", "test:int:slow": "yarn test:integration --reporter=mocha-slow-test-reporter", "test:e2e:slow": "yarn test:e2e --reporter=mocha-slow-test-reporter",