Skip to content

Commit de6ecb4

Browse files
[DEPENDABOT]: Bump cypress from 9.7.0 to 10.0.3 (#692)
* [DEPENDABOT]: Bump cypress from 9.7.0 to 10.0.3 Bumps [cypress](https://github.com/cypress-io/cypress) from 9.7.0 to 10.0.3. - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js) - [Commits](cypress-io/cypress@v9.7.0...v10.0.3) --- updated-dependencies: - dependency-name: cypress dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Migrate to Cypress 10 Ran `cypress open` and walked through migration guide. It generated cypress.config.ts which I renamed to cypress.config.js and reverted to `require()` instead of `import` because of stupid TypeScript typings warnings related to the plugins, which seem perfectly fine. e2e tests all run and pass as before. Unfortunately, coverage is broken because we also need `@cypress/[email protected]` which supports Cypress 10, but it has an issue with this error: cypress-io/code-coverage#573 * Remove lint * Fix lock file conflict * Apparent must still specify cypress config file? * No difference, reverted, but now bumped Cypress version in CI, hoping... * Try with updated Cypress GH Action * Disable broken code coverage * Try cypress/code-coverage 3.9.x for fun * Revert "Try cypress/code-coverage 3.9.x for fun" This reverts commit 68e1d03. 3.9.x fails with the same missing reference error. * Update lock file for some reason (unexpected) * Update how cypress/code-coverage plugin is installed/configured https://docs.cypress.io/guides/tooling/code-coverage#Install-the-plugin Found a reference to this path that has been the problem so far: ```javascript on( 'file:preprocessor', require('@cypress/code-coverage/use-browserify-istanbul') ); ``` Removed since that's not in the installation instructions (maybe it was at one point, but no longer). * See if Codecov GH Action will make everything better Instead of manually installing codecov globally and running it... References: - https://github.com/marketplace/actions/codecov - https://relatablecode.com/how-to-add-cypress-codecov-in-github-actions-in-react-app * cypress/code-coverage does NOT instrument the code for you... https://github.com/cypress-io/code-coverage#instrument-unit-tests Ah. Finally, circle right back to the original issue of the ellusive `@cypress/code-coverage/use-browserify-istanbul` reference which no longer exists in version 3.10.0 of `@cypress/code-coverage`. The only thing cypress/code-coverage provides now is `@cypress/code-coverage/use-babelrc`, which has peer dependencies on webpack, babel-loader, babel/preset-env and babel/core. After all those added, and babel.config.js configured under 'test' env (and added `BABEL_ENV=test` to package.json 'test:coverage' script that runs Cypress with coverage option), things are looking good locally with .nyc_output/out.json once again generated. Let's see if it works and reports in GH Actions now. Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stefan Cameron <[email protected]>
1 parent 1a11b60 commit de6ecb4

File tree

8 files changed

+514
-193
lines changed

8 files changed

+514
-193
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
matrix:
1717
node: [14]
1818
steps:
19-
- uses: actions/checkout@master
19+
- name: Checkout
20+
uses: actions/checkout@v2
2021

2122
- name: Setup environment
2223
id: setups
@@ -50,28 +51,28 @@ jobs:
5051
5152
- name: Build # Tests to see if a build can succeed
5253
run: yarn build
54+
5355
E2E:
54-
runs-on: ubuntu-latest
56+
runs-on: ubuntu-20.04 # cypress/browsers image supports Ubuntu 18-20
5557
name: e2e
5658
strategy:
5759
matrix:
5860
browser: [chrome, firefox]
5961
timeout-minutes: 20
6062
container:
61-
image: cypress/included:9.7.0
63+
image: cypress/browsers:node14.17.0-chrome88-ff89
6264
options: --user 1001 --shm-size=2g # @see https://github.com/cypress-io/github-action/issues/104#issuecomment-666047965
6365
env:
64-
CYPRESS_BROWSER: ${{ matrix.browser }}
66+
BABEL_ENV: test
6567
steps:
66-
- uses: actions/checkout@v2
68+
- name: Checkout
69+
uses: actions/checkout@v2
70+
6771
- name: Test E2E
68-
uses: cypress-io/github-action@v2.6.1
72+
uses: cypress-io/github-action@v4
6973
with:
7074
browser: ${{ matrix.browser }}
7175
env: coverage=true
72-
- name: Install code coverage
73-
run: |-
74-
yarn global add codecov;
75-
echo "$(yarn global bin)" >> $GITHUB_PATH;
76-
- name: Code coverage
77-
run: codecov;
76+
77+
- name: Upload coverage to Codecov
78+
uses: codecov/codecov-action@v2

babel.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ module.exports = {
4141
plugins,
4242
},
4343
test: {
44+
// Jest/Cypress
45+
plugins: [...plugins, 'istanbul'],
4446
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
4547
},
4648
},

cypress.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const { defineConfig } = require('cypress');
2+
const setupPlugins = require('./cypress/plugins/index.js');
3+
4+
module.exports = defineConfig({
5+
viewportHeight: 600,
6+
viewportWidth: 800,
7+
video: false,
8+
e2e: {
9+
// We've imported your old cypress plugins here.
10+
// You may want to clean this up later by importing these.
11+
setupNodeEvents(on, config) {
12+
return setupPlugins(on, config);
13+
},
14+
specPattern: 'test/e2e/**/*.e2e.js',
15+
},
16+
});

cypress.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

cypress/plugins/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ module.exports = (on, config) => {
2020
if (config.env.coverage === true) {
2121
// enable coverage
2222
require('@cypress/code-coverage/task')(on, config);
23-
// instrument code
24-
on(
25-
'file:preprocessor',
26-
require('@cypress/code-coverage/use-browserify-istanbul')
27-
);
23+
on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'));
2824
}
2925

3026
// fetch fixtures
File renamed without changes.

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"test:types": "tsc index.d.ts",
3333
"test:unit": "jest",
3434
"test:e2e": "ELECTRON_ENABLE_LOGGING=1 cypress run",
35-
"test:e2e:dev": "cypress open",
36-
"test:coverage": "cypress run --env coverage=true",
35+
"test:e2e:dev": "cypress open --config-file=cypress.config.js --browser --e2e",
36+
"test:coverage": "BABEL_ENV=test yarn test:e2e --env coverage=true",
3737
"prepare": "yarn build",
3838
"prepublishOnly": "yarn test && yarn build",
3939
"release": "yarn build && changeset publish"
@@ -58,7 +58,7 @@
5858
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
5959
"@babel/preset-env": "^7.18.2",
6060
"@changesets/cli": "^2.23.0",
61-
"@cypress/code-coverage": "^3.9.12",
61+
"@cypress/code-coverage": "^3.10.0",
6262
"@rollup/plugin-babel": "^5.3.1",
6363
"@rollup/plugin-commonjs": "^22.0.0",
6464
"@rollup/plugin-node-resolve": "^13.3.0",
@@ -67,11 +67,13 @@
6767
"@types/node": "^17.0.43",
6868
"all-contributors-cli": "^6.20.0",
6969
"babel-jest": "^28.1.1",
70+
"babel-loader": "^8.2.5",
71+
"babel-plugin-istanbul": "^6.1.1",
7072
"brfs": "^2.0.2",
7173
"browserify": "^17.0.0",
7274
"budo": "^11.7.0",
7375
"cross-env": "^7.0.3",
74-
"cypress": "^9.7.0",
76+
"cypress": "^10.0.3",
7577
"eslint": "^8.17.0",
7678
"eslint-config-prettier": "^8.5.0",
7779
"eslint-plugin-cypress": "^2.12.1",
@@ -85,6 +87,7 @@
8587
"rollup-plugin-sourcemaps": "^0.6.3",
8688
"rollup-plugin-terser": "^7.0.2",
8789
"typescript": "^4.7.3",
88-
"watchify": "^4.0.0"
90+
"watchify": "^4.0.0",
91+
"webpack": "^5.73.0"
8992
}
9093
}

0 commit comments

Comments
 (0)