Skip to content

Commit 7ebb364

Browse files
committed
add link to subfolder example, close cypress-io#116
1 parent 189eff2 commit 7ebb364

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

README.md

+13-16
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ If you cannot use `.babelrc` for some reason (maybe it is used by other tools?),
7373
```js
7474
module.exports = (on, config) => {
7575
on('task', require('@cypress/code-coverage/task'))
76-
on('file:preprocessor', require('@cypress/code-coverage/use-browserify-istanbul'))
76+
on(
77+
'file:preprocessor',
78+
require('@cypress/code-coverage/use-browserify-istanbul')
79+
)
7780
}
7881
```
7982

@@ -113,8 +116,7 @@ For any other server, define the endpoint yourself and return the coverage objec
113116
```js
114117
if (global.__coverage__) {
115118
// add method "GET /__coverage__" and response with JSON
116-
onRequest = (response) =>
117-
response.sendJSON({coverage: global.__coverage__ })
119+
onRequest = response => response.sendJSON({ coverage: global.__coverage__ })
118120
}
119121
```
120122

@@ -152,10 +154,7 @@ You can specify custom coverage reporter(s) to use. For example to output text s
152154
{
153155
"nyc": {
154156
"report-dir": "cypress-coverage",
155-
"reporter": [
156-
"text",
157-
"json"
158-
]
157+
"reporter": ["text", "json"]
159158
}
160159
}
161160
```
@@ -214,10 +213,11 @@ Or a particular `switch` case
214213

215214
```js
216215
switch (foo) {
217-
case 1: /* some code */; break;
216+
case 1 /* some code */:
217+
break
218218
/* istanbul ignore next */
219219
case 2: // really difficult to hit from tests
220-
someCode();
220+
someCode()
221221
}
222222
```
223223

@@ -230,12 +230,8 @@ For example, if you want to only include files in the `app` folder, but exclude
230230
```json
231231
{
232232
"nyc": {
233-
"include": [
234-
"app/**/*.js"
235-
],
236-
"exclude": [
237-
"app/util.js"
238-
]
233+
"include": ["app/**/*.js"],
234+
"exclude": ["app/util.js"]
239235
}
240236
}
241237
```
@@ -274,8 +270,9 @@ npm run dev:no:coverage
274270
- [rootstrap/react-redux-base](https://github.com/rootstrap/react-redux-base) shows an example with a realistic Webpack config. Instruments the source code using `babel-plugin-istanbul` during tests.
275271
- [skylock/cypress-angular-coverage-example](https://github.com/skylock/cypress-angular-coverage-example) shows Angular 8 + TypeScript application with instrumentation done using [istanbul-instrumenter-loader](https://github.com/webpack-contrib/istanbul-instrumenter-loader).
276272
- [bahmutov/testing-react](https://github.com/bahmutov/testing-react) shows how to get code coverage for a React application created using [CRA v3](https://github.com/facebook/create-react-app) without ejecting `react-scripts`.
277-
- [bahmutov/next-and-cypress-example](https://github.com/bahmutov/next-and-cypress-example) shows how to get backend and fronend coverage for a [Next.js](https://nextjs.org) project. Uses [middleware/nextjs.js](middleware/nextjs.js).
273+
- [bahmutov/next-and-cypress-example](https://github.com/bahmutov/next-and-cypress-example) shows how to get backend and frontend coverage for a [Next.js](https://nextjs.org) project. Uses [middleware/nextjs.js](middleware/nextjs.js).
278274
- [akoidan/vue-webpack-typescript](https://github.com/akoidan/vue-webpack-typescript) Pure webpack config with vue + typescript with codecov reports. This setup uses babel-loader with TS checker as a separate thread.
275+
- [bahmutov/code-coverage-subfolder-example](https://github.com/bahmutov/code-coverage-subfolder-example) shows how to instrument `app` folder using `nyc instrument` as a separate step before running E2E tests
279276

280277
## Debugging
281278

0 commit comments

Comments
 (0)