Skip to content

Commit 8536c15

Browse files
authored
Merge branch 'master' into master
2 parents ab9868a + 5b07e59 commit 8536c15

File tree

9 files changed

+3976
-2580
lines changed

9 files changed

+3976
-2580
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
lint:
1010
description: Checks the code formatting
1111
docker:
12-
- image: cimg/node:20.9.0
12+
- image: cimg/node:22.1.0
1313
environment:
1414
# we don't need Cypress to check code style
1515
CYPRESS_INSTALL_BINARY: '0'
@@ -71,7 +71,7 @@ jobs:
7171
publish:
7272
description: Publishes the new version of the plugin to NPM
7373
docker:
74-
- image: cimg/node:20.9.0
74+
- image: cimg/node:22.1.0
7575
environment:
7676
# we don't need Cypress to do the release
7777
CYPRESS_INSTALL_BINARY: '0'

.github/workflows/snyk_sca_scan.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ jobs:
2626
- name: Perform SCA Scan
2727
continue-on-error: false
2828
run: |
29-
snyk test --all-projects --detection-depth=4 --exclude=docker,Dockerfile --severity-threshold=critical
29+
snyk test --all-projects --detection-depth=4 --exclude=docker,Dockerfile,test-apps --severity-threshold=critical
3030
env:
3131
SNYK_TOKEN: ${{ secrets.SNYK_API_TOKEN }}

README.md

+59-12
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,31 @@ npm install -D @cypress/code-coverage
1010

1111
**Note:** This plugin assumes that `cypress` is a peer dependency already installed in your project.
1212

13-
Add to your `cypress/support/index.js` file.
13+
Then add the code below to the `supportFile` and `setupNodeEvents` function.
1414

1515
```js
16+
// cypress/support/e2e.js
1617
import '@cypress/code-coverage/support'
1718
```
1819

19-
Register tasks in your `cypress/plugins/index.js` file.
20-
2120
```js
22-
module.exports = (on, config) => {
23-
require('@cypress/code-coverage/task')(on, config)
24-
25-
// add other tasks to be registered here
26-
27-
// IMPORTANT to return the config object
28-
// with the any changed environment variables
29-
return config
30-
}
21+
// cypress.config.js
22+
const { defineConfig } = require('cypress')
23+
24+
module.exports = defineConfig({
25+
// setupNodeEvents can be defined in either
26+
// the e2e or component configuration
27+
e2e: {
28+
setupNodeEvents(on, config) {
29+
require('@cypress/code-coverage/task')(on, config)
30+
// include any other plugin code...
31+
32+
// It's IMPORTANT to return the config object
33+
// with any changed environment variables
34+
return config
35+
},
36+
},
37+
})
3138
```
3239

3340
## Instrument your application
@@ -445,6 +452,46 @@ Look up the list of examples under the GitHub topic [cypress-code-coverage-examp
445452

446453
## Migrations
447454

455+
### Cypress v9 to v10
456+
457+
With the removal of the `plugins` directory in Cypress version 10+, you'll need to add all of your configuration into the configuration file (`cypress.config.js` by default).
458+
459+
```js
460+
// BEFORE
461+
// Register tasks in your `cypress/plugins/index.js` file.
462+
463+
module.exports = (on, config) => {
464+
require('@cypress/code-coverage/task')(on, config)
465+
466+
// add other tasks to be registered here
467+
468+
// IMPORTANT to return the config object
469+
// with the any changed environment variables
470+
return config
471+
}
472+
```
473+
474+
```js
475+
// AFTER
476+
// cypress.config.js
477+
const { defineConfig } = require('cypress')
478+
479+
module.exports = defineConfig({
480+
// setupNodeEvents can be defined in either
481+
// the e2e or component configuration
482+
e2e: {
483+
setupNodeEvents(on, config) {
484+
require('@cypress/code-coverage/task')(on, config)
485+
// include any other plugin code...
486+
487+
// It's IMPORTANT to return the config object
488+
// with any changed environment variables
489+
return config
490+
},
491+
},
492+
})
493+
```
494+
448495
### v2 to v3
449496

450497
Change the plugins file `cypress/plugins/index.js`

0 commit comments

Comments
 (0)