From 0346b8159f94448a7fa1ea44d4b043833d8efbfd Mon Sep 17 00:00:00 2001 From: gregfenton Date: Tue, 12 May 2020 03:56:16 -0400 Subject: [PATCH 1/2] Update README.md (#234) --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 43bc17314..1fc287cd2 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ Register tasks in your `cypress/plugins/index.js` file ```js module.exports = (on, config) => { require('@cypress/code-coverage/task')(on, config) + + // add other tasks to be registered here + // IMPORTANT to return the config object // with the any changed environment variables return config From d1cbb1df981fd12c97204a0409eb45757c70f24e Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Fri, 15 May 2020 17:47:44 -0400 Subject: [PATCH 2/2] fix: ignore coverage env variable case (#237) --- support.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/support.js b/support.js index 9573ae136..c6458da47 100644 --- a/support.js +++ b/support.js @@ -220,8 +220,16 @@ const registerHooks = () => { // to disable code coverage commands and save time // pass environment variable coverage=false // cypress run --env coverage=false +// or +// CYPRESS_coverage=false cypress run // see https://on.cypress.io/environment-variables -if (Cypress.env('coverage') === false) { + +// to avoid "coverage" env variable being case-sensitive, convert to lowercase +const cyEnvs = Cypress._.mapKeys(Cypress.env(), (value, key) => + key.toLowerCase() +) + +if (cyEnvs.coverage === false) { console.log('Skipping code coverage hooks') } else if (Cypress.env('codeCoverageTasksRegistered') !== true) { // register a hook just to log a message