Skip to content

feat: find nyc even if installed higher up #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://circleci.com/docs/2.0/configuration-reference/
version: 2.1
orbs:
cypress: cypress-io/cypress@1.13.0 # used to run e2e tests
cypress: cypress-io/cypress@1.17.1 # used to run e2e tests
node: circleci/[email protected] # used to publish new NPM version

jobs:
Expand All @@ -22,10 +22,13 @@ workflows:
- cypress/install:
post-steps:
- run: npm run check:markdown

- cypress/run:
name: frontend coverage
requires:
- cypress/install
# grab the workspace created by cypress/install job
attach-workspace: true
# we need to start the web application
start: npm start
# there are no jobs to follow this one
Expand All @@ -50,6 +53,9 @@ workflows:
requires:
- cypress/install

# grab the workspace created by cypress/install job
attach-workspace: true

start: npm run start:test:backend
command: npx cypress run --config-file cypress-backend.json

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

- cypress/run:
attach-workspace: true
name: example-before-each-visit
requires:
- cypress/install
# install dependencies in the root folder
post-install:
- run: npm ci
# there are no jobs to follow this one
# so no need to save the workspace files (saves time)
no-workspace: true
working_directory: examples/before-each-visit
command: npx cypress run --project examples/before-each-visit
# store screenshots and videos
store_artifacts: true
post-steps:
Expand All @@ -94,16 +98,14 @@ workflows:
working_directory: examples/before-each-visit

- cypress/run:
attach-workspace: true
name: example-before-all-visit
requires:
- cypress/install
# install dependencies in the root folder
post-install:
- run: npm ci
# there are no jobs to follow this one
# so no need to save the workspace files (saves time)
no-workspace: true
working_directory: examples/before-all-visit
command: npx cypress run --project examples/before-all-visit
# store screenshots and videos
store_artifacts: true
post-steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ dist/
.cache/
.vscode/
cypress-coverage/
examples/*/cypress/videos
examples/*/cypress/screenshots
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,20 @@ You can specify custom coverage reporter(s) to use. For example to output text s

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

## NYC

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

```text
node_modules/.bin/
../node_modules/.bin/
../../node_modules/.bin/
etc
```

## Custom NYC command

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.
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.

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

### Find NYC in a parent folder

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.
If you have [bin-up][bin-up] installed globally, you can use it to find `nyc` installed somewhere in the higher folder.

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

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