Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 5fd431f

Browse files
committed
Adds coverage
1 parent 5cb99ce commit 5fd431f

6 files changed

Lines changed: 1998 additions & 53 deletions

File tree

.babelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
"next/babel"
4+
],
5+
"env": {
6+
"test": {
7+
"plugins": []
8+
},
9+
"e2e": {
10+
"plugins": ["istanbul"]
11+
}
12+
}
13+
}

.github/workflows/deployment.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ jobs:
1717
run: yarn
1818

1919
- name: build and run tests
20-
run: yarn e2e
20+
run: |
21+
yarn e2e
22+
yarn e2e:report

cypress/plugins/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919
module.exports = (on, config) => {
2020
// `on` is used to hook into various events Cypress emits
2121
// `config` is the resolved Cypress config
22+
require('@cypress/code-coverage/task')(on, config);
23+
24+
return config;
2225
};

cypress/support/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
// Import commands.js using ES2015 syntax:
1717
import './commands';
18+
import '@cypress/code-coverage/support';
1819

1920
// Alternatively you can use CommonJS syntax:
2021
// require('./commands')

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"build:start": "yarn build && yarn start",
1010
"cy:run": "cypress run",
1111
"cy": "cypress open",
12-
"e2e": "start-server-and-test build:start http://localhost:3000 cy:run"
12+
"e2e": "NODE_ENV=e2e start-server-and-test build:start http://localhost:3000 cy:run",
13+
"e2e:report": "npx nyc report --reporter=text"
1314
},
1415
"dependencies": {
1516
"autoprefixer": "^10.2.1",
@@ -20,9 +21,14 @@
2021
"tailwindcss": "^2.0.2"
2122
},
2223
"devDependencies": {
24+
"@cypress/code-coverage": "^3.9.2",
25+
"@cypress/instrument-cra": "^1.4.0",
2326
"@types/node": "^14.14.20",
2427
"@types/react": "^17.0.0",
28+
"babel-plugin-istanbul": "^6.0.0",
2529
"cypress": "^6.5.0",
30+
"istanbul-lib-coverage": "^3.0.0",
31+
"nyc": "^15.1.0",
2632
"start-server-and-test": "^1.12.0",
2733
"typescript": "^4.1.3"
2834
}

0 commit comments

Comments
 (0)