Skip to content

Commit df1dcab

Browse files
committed
update README file
1 parent c066387 commit df1dcab

File tree

1 file changed

+4
-42
lines changed

1 file changed

+4
-42
lines changed

README.md

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ npm install -D @cypress/code-coverage
1414
and its peer dependencies
1515

1616
```shell
17-
npm install -D nyc istanbul-lib-coverage cypress
17+
npm install -D istanbul-lib-coverage cypress
1818
```
1919

2020
Add to your `cypress/support/index.js` file
@@ -181,17 +181,6 @@ You can specify custom coverage reporter(s) to use. For example to output text s
181181

182182
**Tip:** find list of reporters [here](https://istanbul.js.org/docs/advanced/alternative-reporters/)
183183

184-
## NYC
185-
186-
This module tries to find the `nyc` tool using [bin-up][bin-up], so it would be found in the current `node_modules/.bin` or folders up the parent chain
187-
188-
```text
189-
node_modules/.bin/
190-
../node_modules/.bin/
191-
../../node_modules/.bin/
192-
etc
193-
```
194-
195184
## Custom NYC command
196185

197186
Sometimes NYC tool might be installed in a different folder not in the current or parent folder, or you might want to customize the report command. In that case, put the custom command into `package.json` in the current folder and this plugin will automatically use it.
@@ -204,42 +193,14 @@ Sometimes NYC tool might be installed in a different folder not in the current o
204193
}
205194
```
206195

207-
See examples below.
208-
209-
### Install NYC on the fly
210-
211-
The simplest solution: let `npx` install `nyc` on the fly
212-
213-
```json
214-
{
215-
"scripts": {
216-
"coverage:report": "npx nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=lcov --reporter=clover --reporter=json"
217-
}
218-
}
219-
```
220-
221-
### Find NYC in a parent folder
222-
223-
If you have [bin-up][bin-up] installed globally, you can use it to find `nyc` installed somewhere in the higher folder.
224-
225-
```json
226-
{
227-
"scripts": {
228-
"coverage:report": "bin-up nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=lcov --reporter=clover --reporter=json"
229-
}
230-
}
231-
```
232-
233-
**Tip:** finding and running pre-installed tool is always faster than installing it again and again.
234-
235196
## TypeScript users
236197

237198
TypeScript source files are NOT included in the code coverage report by default, even if they are properly instrumented. In order to tell `nyc` to include TS files in the report, you need to:
238199

239200
1. Add these dev dependencies that let Istanbul work with TypeScript
240201

241202
```shell
242-
npm i -D @istanbuljs/nyc-config-typescript source-map-support ts-node
203+
npm i -D @istanbuljs/nyc-config-typescript source-map-support
243204
```
244205

245206
2. In `package.json` use the following `nyc` configuration object
@@ -253,6 +214,8 @@ npm i -D @istanbuljs/nyc-config-typescript source-map-support ts-node
253214
}
254215
```
255216

217+
See [examples/ts-example](examples/ts-example)
218+
256219
## Exclude code
257220

258221
You can exclude parts of the code or entire files from the code coverage report. See [Istanbul guide](https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md). Common cases:
@@ -393,4 +356,3 @@ This project is licensed under the terms of the [MIT license](LICENSE.md).
393356

394357
[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
395358
[renovate-app]: https://renovateapp.com/
396-
[bin-up]: https://github.com/bahmutov/bin-up

0 commit comments

Comments
 (0)