From 4f5d29de0533c47f062e48372b4047edd63d5ad4 Mon Sep 17 00:00:00 2001 From: valentinab25 Date: Fri, 21 May 2021 13:19:22 +0300 Subject: [PATCH] Add code coverage --- .coverage.babelrc | 4 ++++ cypress/plugins/index.js | 3 +++ cypress/support/index.js | 3 +++ 3 files changed, 10 insertions(+) create mode 100644 .coverage.babelrc diff --git a/.coverage.babelrc b/.coverage.babelrc new file mode 100644 index 00000000..0ee15e77 --- /dev/null +++ b/.coverage.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@babel/preset-react"], + "plugins": ["istanbul", "@babel/plugin-transform-modules-commonjs"] +} diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 8dd144a6..e2db15db 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -18,4 +18,7 @@ module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config + require('@cypress/code-coverage/task')(on, config) + on('file:preprocessor', require('@cypress/code-coverage/use-babelrc')) + return config }; diff --git a/cypress/support/index.js b/cypress/support/index.js index 781d69a2..957bec38 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -16,6 +16,9 @@ // Import commands.js using ES2015 syntax: import './commands'; +//Generate code-coverage +import '@cypress/code-coverage/support'; + // Alternatively you can use CommonJS syntax: // require('./commands')