You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ This plugin **DOES NOT** instrument your code. You have to instrument it yoursel
40
40
}
41
41
```
42
42
43
-
Please see the [Examples](#examples) section down below, you can probably find a linked project matching your situation to see how to instrument your application's source code before running end-to-end tests to get the code coverage.
43
+
Please see the [Test Apps](#test-apps) section down below, you can probably find a linked project matching your situation to see how to instrument your application's source code before running end-to-end tests to get the code coverage.
44
44
45
45
If your application has been instrumented correctly, then you should see additional counters and instructions in the application's JavaScript resources, like the image down below shows.
46
46
@@ -66,7 +66,7 @@ That should be it! You should see messages from this plugin in the Cypress Comma
66
66
67
67
### App vs unit tests
68
68
69
-
You need to instrument your web application. This means that when the test does `cy.visit('localhost:3000')` any code the `index.html` requests should be instrumented by YOU. See [Examples](#examples) section for advice, usually you need to stick `babel-plugin-istanbul` into your pipeline somewhere.
69
+
You need to instrument your web application. This means that when the test does `cy.visit('localhost:3000')` any code the `index.html` requests should be instrumented by YOU. See [Test Apps](#test-apps) section for advice, usually you need to stick `babel-plugin-istanbul` into your pipeline somewhere.
70
70
71
71
If you are testing individual functions from your application code by importing them directly into Cypress spec files, this is called "unit tests" and Cypress can instrument this scenario for you. See [Instrument unit tests](#instrument-unit-tests) section.
Now the code coverage from spec files will be combined with end-to-end coverage.
138
138
139
-
Find example of a just the unit tests and JavaScript source files with collected code coverage in [examples/unit-tests-js](./examples/unit-tests-js).
139
+
Find example of a just the unit tests and JavaScript source files with collected code coverage in [test-apps/new-cypress-config/unit-tests-js](./test-apps/new-cypress-config/unit-tests-js).
Example in [examples/backend](examples/backend) folder.
158
+
Example in [test-apps/new-cypress-config/backend](test-apps/backend) folder.
159
159
160
160
You can also instrument your server-side code and produce combined coverage report that covers both the backend and frontend code
161
161
@@ -275,7 +275,7 @@ Sometimes NYC tool might be installed in a different folder not in the current o
275
275
276
276
TypeScript source files should be automatically included in the report, if they are instrumented.
277
277
278
-
See [examples/ts-example](examples/ts-example), [bahmutov/cra-ts-code-coverage-example](https://github.com/bahmutov/cra-ts-code-coverage-example) or [bahmutov/cypress-angular-coverage-example](https://github.com/bahmutov/cypress-angular-coverage-example).
278
+
See [test-apps/new-cypress-config/ts-example](test-apps/ts-example), [bahmutov/cra-ts-code-coverage-example](https://github.com/bahmutov/cra-ts-code-coverage-example) or [bahmutov/cypress-angular-coverage-example](https://github.com/bahmutov/cypress-angular-coverage-example).
279
279
280
280
## Include code
281
281
@@ -292,7 +292,7 @@ For example, if you want to make sure the final report includes all JS files fro
292
292
}
293
293
```
294
294
295
-
See example [examples/all-files](./examples/all-files)
295
+
See example [test-app/all-files](./test-apps/new-cypress-config/all-files)
296
296
297
297
## Exclude code
298
298
@@ -363,7 +363,7 @@ For example, if you want to only include files in the `app` folder, but exclude
363
363
364
364
**Note:** if you have `all: true` NYC option set, this plugin will check the produced `.nyc_output/out.json` before generating the final report. If the `out.json` file does not have information for some files that should be there according to `include` list, then an empty placeholder will be included, see [PR 208](https://github.com/cypress-io/code-coverage/pull/208).
365
365
366
-
Another important option is `excludeAfterRemap`. By default it is false, which might let excluded files through. If you are excluding the files, and the instrumenter does not respect the `nyc.exclude` setting, then add `excludeAfterRemap: true` to tell `nyc report` to exclude files. See [examples/exclude-files](examples/exclude-files).
366
+
Another important option is `excludeAfterRemap`. By default it is false, which might let excluded files through. If you are excluding the files, and the instrumenter does not respect the `nyc.exclude` setting, then add `excludeAfterRemap: true` to tell `nyc report` to exclude files. See [test-apps/exclude-files](test-apps/new-cypress-config/exclude-files).
367
367
368
368
## Disable plugin
369
369
@@ -405,19 +405,19 @@ npm run dev:no:coverage
405
405
406
406
## Examples
407
407
408
-
### Internal examples
408
+
### Internal test apps
409
409
410
410
Full examples we use for testing in this repository:
411
411
412
-
-[examples/backend](examples/backend) only instruments the backend Node server and saves the coverage report
413
-
-[examples/fullstack](examples/fullstack) instruments and merges backend, e2e and unit test coverage into a single report
414
-
-[examples/before-all-visit](examples/before-all-visit) checks if code coverage works when `cy.visit` is made once in the `before` hook
415
-
-[examples/before-each-visit](examples/before-each-visit) checks if code coverage correctly keeps track of code when doing `cy.visit` before each test
416
-
-[examples/one-spec.js](examples/one-spec.js) confirms that coverage is collected and filtered correctly if the user only executes a single Cypress test
417
-
-[examples/ts-example](examples/ts-example) uses Babel + Parcel to instrument and serve TypeScript file
418
-
-[examples/use-webpack](examples/use-webpack) shows Webpack build with source maps and Babel
419
-
-[examples/unit-tests-js](examples/unit-tests-js) runs just the unit tests and reports code coverage (JavaScript source code)
420
-
-[examples/unit-tests-ts](examples/unit-tests-ts)**NOT WORKING** runs just the unit tests and reports code coverage (TypeScript source code)
412
+
-[test-apps/backend](test-apps/new-cypress-config/backend) only instruments the backend Node server and saves the coverage report
413
+
-[test-apps/fullstack](test-apps/new-cypress-config/fullstack) instruments and merges backend, e2e and unit test coverage into a single report
414
+
-[test-apps/before-all-visit](test-apps/new-cypress-config/before-all-visit) checks if code coverage works when `cy.visit` is made once in the `before` hook
415
+
-[test-apps/before-each-visit](test-apps/new-cypress-config/before-each-visit) checks if code coverage correctly keeps track of code when doing `cy.visit` before each test
416
+
-[test-apps/one-spec.js](test-apps/new-cypress-config/one-spec.js) confirms that coverage is collected and filtered correctly if the user only executes a single Cypress test
417
+
-[test-apps/ts-example](test-apps/new-cypress-config/ts-example) uses Babel + Parcel to instrument and serve TypeScript file
418
+
-[test-apps/use-webpack](test-apps/new-cypress-config/use-webpack) shows Webpack build with source maps and Babel
419
+
-[test-apps/unit-tests-js](test-apps/new-cypress-config/unit-tests-js) runs just the unit tests and reports code coverage (JavaScript source code)
420
+
-[test-apps/unit-tests-ts](test-apps/new-cypress-config/unit-tests-ts)**NOT WORKING** runs just the unit tests and reports code coverage (TypeScript source code)
0 commit comments