Skip to content

Commit

Permalink
chore: add cypress coverage (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Feb 27, 2024
1 parent ebbe843 commit e3b5f1d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
}
}
],
"transform-class-properties",
"istanbul",
"@babel/plugin-transform-async-to-generator"
]
}
5 changes: 4 additions & 1 deletion .github/workflows/cypress-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Cypress Tests

on:
merge_group:
pull_request:

jobs:
Expand Down Expand Up @@ -46,3 +45,7 @@ jobs:
install: false
build: npm run build:test
start: npm run test:start

- name: Check Coverage Thresholds
run: |
npx nyc check-coverage --lines 50 --functions 50 --branches 50 --statements 50
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ package-lock.json
screenshots
hyperswitch/
downloads
.env
.env
.nyc_output
coverage
7 changes: 6 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
require("@cypress/code-coverage/task")(on, config);
// include any other plugin code...

// It's IMPORTANT to return the config object
// with any changed environment variables
return config;
},
},
env: {
Expand Down
1 change: 1 addition & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "@cypress/code-coverage/support";
import "./commands";

// Alternatively you can use CommonJS syntax:
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
}
},
"devDependencies": {
"@cypress/code-coverage": "^3.12.24",
"@eslint/create-config": "0.4.6",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
"babel-plugin-istanbul": "^6.1.1",
"copy-webpack-plugin": "^9.0.0",
"css-loader": "^5.0.1",
"css-minimizer-webpack-plugin": "^5.0.1",
Expand All @@ -39,9 +41,11 @@
"eslint-plugin-react-hooks": "^4.6.0",
"file-loader": "^6.2.0",
"husky": "^8.0.3",
"istanbul-instrumenter-loader": "^3.0.1",
"mini-css-extract-plugin": "^1.3.1",
"monaco-editor-webpack-plugin": "^7.0.1",
"node-fetch": "^2.6.1",
"nyc": "^15.1.0",
"postcss": "^8.3.6",
"postcss-loader": "^4.1.0",
"postcss-preset-env": "^6.7.0",
Expand Down
9 changes: 9 additions & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ module.exports = (appName = "hyperswitch", publicPath = "auto") => {
test: /\.ttf$/,
use: ["file-loader"],
},
{
test: /\.js$/,
use: {
loader: "istanbul-instrumenter-loader",
options: { esModules: true },
},
enforce: "post",
exclude: /node_modules|\.spec\.js$/,
},
],
},
plugins: [
Expand Down

0 comments on commit e3b5f1d

Please sign in to comment.