Skip to content

Commit e4b9698

Browse files
authored
feat: find nyc even if installed higher up (#153)
* use latest orb * use fixed orb * use custom command * do not need local deps * update before each example * add readme note
1 parent 68b0907 commit e4b9698

File tree

10 files changed

+108
-5672
lines changed

10 files changed

+108
-5672
lines changed

.circleci/config.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://circleci.com/docs/2.0/configuration-reference/
22
version: 2.1
33
orbs:
4-
cypress: cypress-io/cypress@1.13.0 # used to run e2e tests
4+
cypress: cypress-io/cypress@1.17.1 # used to run e2e tests
55
node: circleci/[email protected] # used to publish new NPM version
66

77
jobs:
@@ -22,10 +22,13 @@ workflows:
2222
- cypress/install:
2323
post-steps:
2424
- run: npm run check:markdown
25+
2526
- cypress/run:
2627
name: frontend coverage
2728
requires:
2829
- cypress/install
30+
# grab the workspace created by cypress/install job
31+
attach-workspace: true
2932
# we need to start the web application
3033
start: npm start
3134
# there are no jobs to follow this one
@@ -50,6 +53,9 @@ workflows:
5053
requires:
5154
- cypress/install
5255

56+
# grab the workspace created by cypress/install job
57+
attach-workspace: true
58+
5359
start: npm run start:test:backend
5460
command: npx cypress run --config-file cypress-backend.json
5561

@@ -69,16 +75,14 @@ workflows:
6975
- run: npx nyc report --check-coverage true --lines 100 --include test-backend/index.js
7076

7177
- cypress/run:
78+
attach-workspace: true
7279
name: example-before-each-visit
7380
requires:
7481
- cypress/install
75-
# install dependencies in the root folder
76-
post-install:
77-
- run: npm ci
7882
# there are no jobs to follow this one
7983
# so no need to save the workspace files (saves time)
8084
no-workspace: true
81-
working_directory: examples/before-each-visit
85+
command: npx cypress run --project examples/before-each-visit
8286
# store screenshots and videos
8387
store_artifacts: true
8488
post-steps:
@@ -94,16 +98,14 @@ workflows:
9498
working_directory: examples/before-each-visit
9599

96100
- cypress/run:
101+
attach-workspace: true
97102
name: example-before-all-visit
98103
requires:
99104
- cypress/install
100-
# install dependencies in the root folder
101-
post-install:
102-
- run: npm ci
103105
# there are no jobs to follow this one
104106
# so no need to save the workspace files (saves time)
105107
no-workspace: true
106-
working_directory: examples/before-all-visit
108+
command: npx cypress run --project examples/before-all-visit
107109
# store screenshots and videos
108110
store_artifacts: true
109111
post-steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ dist/
77
.cache/
88
.vscode/
99
cypress-coverage/
10+
examples/*/cypress/videos
11+
examples/*/cypress/screenshots

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,20 @@ 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+
184195
## Custom NYC command
185196

186-
Sometimes NYC tool might be installed in a different 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.
197+
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.
187198

188199
```json
189200
{
@@ -209,7 +220,7 @@ The simplest solution: let `npx` install `nyc` on the fly
209220

210221
### Find NYC in a parent folder
211222

212-
If you have [bin-up](https://github.com/bahmutov/bin-up) installed globally, you can use it to find `nyc` installed somewhere in the higher folder.
223+
If you have [bin-up][bin-up] installed globally, you can use it to find `nyc` installed somewhere in the higher folder.
213224

214225
```json
215226
{
@@ -381,3 +392,4 @@ This project is licensed under the terms of the [MIT license](LICENSE.md).
381392

382393
[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
383394
[renovate-app]: https://renovateapp.com/
395+
[bin-up]: https://github.com/bahmutov/bin-up

0 commit comments

Comments
 (0)