Skip to content

Commit 6ae7cc7

Browse files
chore: pull latest code coverage
2 parents 58199e3 + 67db725 commit 6ae7cc7

File tree

421 files changed

+112344
-41122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+112344
-41122
lines changed

.circleci/config.yml

+190-578
Large diffs are not rendered by default.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'Add issue/PR to Triage Board'
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
pull_request_target:
7+
types:
8+
- opened
9+
jobs:
10+
add-to-triage-project-board:
11+
uses: cypress-io/cypress/.github/workflows/triage_add_to_project.yml@develop
12+
secrets: inherit

.github/workflows/snyk_sca_scan.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Snyk Software Composition Analysis Scan
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- develop
7+
jobs:
8+
Snyk_SCA_Scan:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [16.x]
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Setting up Node
16+
#- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: Run Snyk to check for opensource vulnerabilities
21+
uses: snyk/actions/node@master
22+
env:
23+
SNYK_TOKEN: ${{ secrets.SNYK_API_TOKEN }}
24+
with:
25+
args: --all-projects --strict-out-of-sync=false --detection-depth=6 --exclude=docker,Dockerfile --severity-threshold=critical
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Snyk Static Analysis Scan
2+
# This SAST (Static Application Security Testing) scan is used to scan
3+
# our first-party code for security vulnerabilities
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
- develop
9+
jobs:
10+
Snyk_SAST_Scan:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: snyk/actions/setup@master
15+
- name: Perform Static Analysis Test
16+
env:
17+
SNYK_TOKEN: ${{ secrets.SNYK_API_TOKEN }}
18+
continue-on-error: true
19+
run: snyk code test --all-projects --strict-out-of-sync=false --detection-depth=6 --exclude=docker,Dockerfile --severity-threshold=high
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Closed Issue Comment'
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
jobs:
7+
closed-issue-comment:
8+
uses: cypress-io/cypress/.github/workflows/triage_closed_issue_comment.yml@develop
9+
secrets: inherit

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
node_modules/
2-
cypress/videos
3-
cypress/screenshots
2+
**/cypress/videos
3+
**/cypress/screenshots
44
coverage/
55
.nyc_output/
66
dist/
77
.cache/
88
.vscode/
99
cypress-coverage/
10-
examples/*/cypress/videos
11-
examples/*/cypress/screenshots
1210
yarn.lock
11+
.parcel-cache

.releaserc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"branches": [
3+
"master",
4+
"next",
5+
{
6+
"name": "besta",
7+
"prerelease": true
8+
},
9+
{
10+
"name": "dev",
11+
"prerelease": true
12+
}
13+
]
14+
}

README.md

+34-21
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This plugin **DOES NOT** instrument your code. You have to instrument it yoursel
4040
}
4141
```
4242

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](#internal-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.
4444

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

@@ -66,7 +66,7 @@ That should be it! You should see messages from this plugin in the Cypress Comma
6666

6767
### App vs unit tests
6868

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

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

@@ -136,7 +136,7 @@ module.exports = (on, config) => {
136136

137137
Now the code coverage from spec files will be combined with end-to-end coverage.
138138

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

141141
### Alternative for unit tests
142142

@@ -155,7 +155,7 @@ module.exports = (on, config) => {
155155

156156
## Instrument backend code
157157

158-
Example in [examples/backend](examples/backend) folder.
158+
Example in [test-apps/new-cypress-config/backend](test-apps/backend) folder.
159159

160160
You can also instrument your server-side code and produce combined coverage report that covers both the backend and frontend code
161161

@@ -275,7 +275,7 @@ Sometimes NYC tool might be installed in a different folder not in the current o
275275

276276
TypeScript source files should be automatically included in the report, if they are instrumented.
277277

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

280280
## Include code
281281

@@ -292,7 +292,7 @@ For example, if you want to make sure the final report includes all JS files fro
292292
}
293293
```
294294

295-
See example [examples/all-files](./examples/all-files)
295+
See example [test-app/all-files](./test-apps/new-cypress-config/all-files)
296296

297297
## Exclude code
298298

@@ -335,7 +335,20 @@ switch (foo) {
335335

336336
### Exclude files and folders
337337

338-
See [`nyc` configuration](https://github.com/istanbuljs/nyc#common-configuration-options) and [ include and exclude options](https://github.com/istanbuljs/nyc#using-include-and-exclude-arrays). You can include and exclude files using `minimatch` patterns in `.nycrc` file or using "nyc" object inside your `package.json` file.
338+
The code coverage plugin will automatically exclude any test/spec files you have defined in `testFiles` (Cypress < v10) or `specPattern` (Cypress >= v10) configuration options. Additionaly, you can set the `exclude` pattern glob in the code coverage environment variable to specify additional files to be excluded:
339+
340+
```javascript
341+
// cypress.config.js or cypress.json
342+
env: {
343+
codeCoverage: {
344+
exclude: ['cypress/**/*.*'],
345+
},
346+
},
347+
```
348+
349+
Cypress 10 and later users should set the `exclude` option to exclude any items from the `cypress` folder they don't want to be included in the coverage reports.
350+
351+
Additionaly, you can use [`nyc` configuration](https://github.com/istanbuljs/nyc#common-configuration-options) and [include and exclude options](https://github.com/istanbuljs/nyc#using-include-and-exclude-arrays). You can include and exclude files using `minimatch` patterns in `.nycrc` file or using "nyc" object inside your `package.json` file.
339352

340353
For example, if you want to only include files in the `app` folder, but exclude `app/util.js` file, you can set in your `package.json`
341354

@@ -350,7 +363,7 @@ For example, if you want to only include files in the `app` folder, but exclude
350363

351364
**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).
352365

353-
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).
354367

355368
## Disable plugin
356369

@@ -360,7 +373,7 @@ You can skip the client-side code coverage hooks by setting the environment vari
360373
# tell Cypress to set environment variable "coverage" to false
361374
cypress run --env coverage=false
362375
# or pass the environment variable
363-
CYPRESS_coverage=false cypress run
376+
CYPRESS_COVERAGE=false cypress run
364377
```
365378

366379
or set it to `false` in the `cypress.json` file
@@ -392,19 +405,19 @@ npm run dev:no:coverage
392405

393406
## Examples
394407

395-
### Internal examples
408+
### Internal test apps
396409

397410
Full examples we use for testing in this repository:
398411

399-
- [examples/backend](examples/backend) only instruments the backend Node server and saves the coverage report
400-
- [examples/fullstack](examples/fullstack) instruments and merges backend, e2e and unit test coverage into a single report
401-
- [examples/before-all-visit](examples/before-all-visit) checks if code coverage works when `cy.visit` is made once in the `before` hook
402-
- [examples/before-each-visit](examples/before-each-visit) checks if code coverage correctly keeps track of code when doing `cy.visit` before each test
403-
- [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
404-
- [examples/ts-example](examples/ts-example) uses Babel + Parcel to instrument and serve TypeScript file
405-
- [examples/use-webpack](examples/use-webpack) shows Webpack build with source maps and Babel
406-
- [examples/unit-tests-js](examples/unit-tests-js) runs just the unit tests and reports code coverage (JavaScript source code)
407-
- [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](test-apps/new-cypress-config/one-spec) 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)
408421

409422
### External examples
410423

@@ -429,7 +442,7 @@ Look up the list of examples under GitHub topic [cypress-code-coverage-example](
429442
- [bahmutov/app-in-docker-coverage-example](https://github.com/bahmutov/app-in-docker-coverage-example) shows an app running inside a Docker container, while Cypress runs on the local machine. Cypress can still [discover the source files](https://github.com/cypress-io/code-coverage/pull/197) before generating the report.
430443
- [bahmutov/gatsby-cypress-with-code-coverage](https://github.com/bahmutov/gatsby-cypress-with-code-coverage) shows code coverage using the official Gatsby "Hello World" starter.
431444
- [muratkeremozcan/angular-playground](https://github.com/muratkeremozcan/angular-playground) is an Angular TypeScript application with combined unit and E2E coverage.
432-
445+
- [nefayran/cypress-react-vite](https://github.com/nefayran/cypress-react-vite) React with Vite and istanbul plugin for code coverage.
433446
## Migrations
434447

435448
### v2 to v3
@@ -459,7 +472,7 @@ module.exports = (on, config) => {
459472
}
460473
```
461474

462-
See [examples/use-plugins-and-support](examples/use-plugins-and-support)
475+
See [test-apps/use-plugins-and-support](test-apps/new-cypress-config/use-plugins-and-support)
463476

464477
## Debugging
465478

cypress/index.html

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
<body>
2-
<nav>
3-
<a href="/about.html">About</a>
4-
</nav>
52
<h2>Test page</h2>
6-
<p>Open the DevTools to see console messages</p>
7-
<script src="app.js"></script>
83
</body>

0 commit comments

Comments
 (0)