diff --git a/.circleci/cache-version.txt b/.circleci/cache-version.txt index 95e8c381c556..da22fed44611 100644 --- a/.circleci/cache-version.txt +++ b/.circleci/cache-version.txt @@ -1,3 +1,3 @@ # Bump this version to force CI to re-create the cache from scratch. -01-04-24 +02-09-24 diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 342bb5dd3492..61965fa7fb12 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -29,6 +29,7 @@ mainBuildFilters: &mainBuildFilters - develop - /^release\/\d+\.\d+\.\d+$/ # use the following branch as well to ensure that v8 snapshot cache updates are fully tested + - 'cacie/dep/electron-27' - 'chore/update_octokit' - 'publish-binary' - 'em/circle2' @@ -42,6 +43,7 @@ macWorkflowFilters: &darwin-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] + - equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ] - equal: [ 'chore/update_octokit', << pipeline.git.branch >> ] - equal: [ 'ryanm/fix/service-worker-capture', << pipeline.git.branch >> ] - matches: @@ -54,6 +56,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] + - equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ] - equal: [ 'chore/update_octokit', << pipeline.git.branch >> ] - equal: [ 'em/circle2', << pipeline.git.branch >> ] - matches: @@ -78,6 +81,7 @@ windowsWorkflowFilters: &windows-workflow-filters - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] + - equal: [ 'cacie/dep/electron-27', << pipeline.git.branch >> ] - equal: [ 'chore/update_octokit', << pipeline.git.branch >> ] - equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ] - equal: [ 'mschile/mochaEvents_win_sep', << pipeline.git.branch >> ] @@ -89,7 +93,7 @@ executors: # the Docker image with Cypress dependencies and Chrome browser cy-doc: docker: - - image: cypress/browsers-internal:node18.15.0-chrome114-ff115 + - image: cypress/browsers-internal:node18.17.1-chrome118-ff115 # by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed. resource_class: medium environment: @@ -99,7 +103,7 @@ executors: # Docker image with non-root "node" user non-root-docker-user: docker: - - image: cypress/browsers-internal:node18.15.0-chrome114-ff115 + - image: cypress/browsers-internal:node18.17.1-chrome118-ff115 user: node environment: PLATFORM: linux @@ -150,7 +154,7 @@ commands: name: Set environment variable to determine whether or not to persist artifacts command: | echo "Setting SHOULD_PERSIST_ARTIFACTS variable" - echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "chore/update_octokit" ]]; then + echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "chore/update_octokit" && "$CIRCLE_BRANCH" != "cacie/dep/electron-27" ]]; then export SHOULD_PERSIST_ARTIFACTS=true fi' >> "$BASH_ENV" # You must run `setup_should_persist_artifacts` command and be using bash before running this command @@ -552,7 +556,7 @@ commands: if [[ ! -f better_sqlite3.node ]]; then docker run -d --name centos7-builder centos7-builder /bin/bash -c "sleep 1000000000" docker cp ~/cypress/node_modules/better-sqlite3 centos7-builder:/better-sqlite3 - docker exec -it centos7-builder /bin/bash -c "cd /better-sqlite3 && source /root/.bashrc && chown -R root:root . && npm install --ignore-scripts && npx --no-install prebuild -r electron -t 25.0.0 --include-regex 'better_sqlite3.node$'" + docker exec -it centos7-builder /bin/bash -c "cd /better-sqlite3 && source /root/.bashrc && chown -R root:root . && npm install --ignore-scripts && npx --no-install prebuild -r electron -t 27.1.3 --include-regex 'better_sqlite3.node$'" docker cp centos7-builder:/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node docker rm -f centos7-builder cp ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/better_sqlite3.node @@ -666,6 +670,9 @@ commands: echo Total containers $CIRCLE_NODE_TOTAL if [[ -v MAIN_RECORD_KEY ]]; then + if [[ <> == 'app' && <> == 'e2e' ]]; then + export DEBUG=cypress:* + fi # internal PR cmd=$([[ <> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true DEBUG=<> \ @@ -1225,6 +1232,12 @@ commands: else yarn binary-package --version $(node ./scripts/get-next-version.js) fi + - run: + name: Smoke Test the Cypress binary + command: | + source ./scripts/ensure-node.sh + node --version + yarn binary-smoke-test --version $(node ./scripts/get-next-version.js) - run: name: Zip the binary command: | @@ -2325,7 +2338,7 @@ jobs: <<: *defaults resource_class: small docker: - - image: cypress/base-internal:18.15.0 + - image: cypress/base-internal:18.17.1 steps: - maybe_skip_binary_jobs - restore_workspace_binaries diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml index 20a8945f0063..2f269318a1d8 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -43,7 +43,7 @@ body: attributes: label: Node version description: What version of node.js are you using to run Cypress? - placeholder: ex. v18.15.0 + placeholder: ex. v18.17.0 validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/2-memory-issue.yml b/.github/ISSUE_TEMPLATE/2-memory-issue.yml index b827f20ea293..28e5bbabb1a2 100644 --- a/.github/ISSUE_TEMPLATE/2-memory-issue.yml +++ b/.github/ISSUE_TEMPLATE/2-memory-issue.yml @@ -51,7 +51,7 @@ body: attributes: label: Node version description: What version of node.js are you using to run Cypress? - placeholder: ex. v18.15.0 + placeholder: ex. v18.17.0 validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/3-install-issue.yml b/.github/ISSUE_TEMPLATE/3-install-issue.yml index bc373cdfdac2..6e513901e5fc 100644 --- a/.github/ISSUE_TEMPLATE/3-install-issue.yml +++ b/.github/ISSUE_TEMPLATE/3-install-issue.yml @@ -38,7 +38,7 @@ body: attributes: label: Node version description: What version of node.js are you using to run Cypress? - placeholder: ex. v18.15.0 + placeholder: ex. v18.17.0 validations: required: true - type: dropdown diff --git a/.github/workflows/update_v8_snapshot_cache.yml b/.github/workflows/update_v8_snapshot_cache.yml index d47d78f430df..fc0caf3e3c24 100644 --- a/.github/workflows/update_v8_snapshot_cache.yml +++ b/.github/workflows/update_v8_snapshot_cache.yml @@ -48,6 +48,9 @@ jobs: - name: Determine snapshot files - Mac if: ${{ matrix.platform == 'macos-latest' }} run: echo "SNAPSHOT_FILES='tooling/v8-snapshot/cache/darwin/snapshot-meta.json'" >> $GITHUB_ENV + - name: Install setuptools - Mac + if: ${{ matrix.platform == 'macos-latest' }} + run: sudo -H pip install setuptools - name: Checkout uses: actions/checkout@v4 with: diff --git a/.node-version b/.node-version index 55bffd620b9a..4a1f488b6c3b 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18.15.0 +18.17.1 diff --git a/centos7-builder.Dockerfile b/centos7-builder.Dockerfile index 1a6aa87fadca..a939fa4087f8 100644 --- a/centos7-builder.Dockerfile +++ b/centos7-builder.Dockerfile @@ -1,5 +1,5 @@ FROM centos:7 -# Install dependencies for re-building better-sqlite and setting devtoolset-8 as the default compiler +# Install dependencies for re-building better-sqlite and setting devtoolset-8 as the default compiler. RUN yum -y install centos-release-scl curl python3 make atk-devel atk java-atk-wrapper at-spi2-atk gtk3 libXt libdrm mesa-libgbm Xvfb && yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ RUN echo >> /etc/profile.d/devtoolset-8.sh 'source scl_source enable devtoolset-8' RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index a7aed77e1c66..5833ac51b9a9 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -11,6 +11,9 @@ _Released 2/13/2024 (PENDING)_ **Dependency Updates:** +- Upgraded `electron` from `25.8.4` to `27.1.3` +- Upgraded bundled Node.js version from `18.15.0` to `18.17.0` +- Upgraded bundled Chromium version from `114.0.5735.289` to `118.0.5993.117` - Updated [`is-ci`](https://www.npmjs.com/package/is-ci) from `3.0.0` to `3.0.1`. Addressed in [#28933](/~https://github.com/cypress-io/cypress/pull/28933). **Misc:** @@ -72,6 +75,7 @@ _Released 1/16/2024_ - Improved accessibility of some areas of the Cypress App. Addressed in [#28628](/~https://github.com/cypress-io/cypress/pull/28628). - Updated some documentation links to go through on.cypress.io. Addressed in [#28623](/~https://github.com/cypress-io/cypress/pull/28623). + ## 13.6.2 _Released 12/26/2023_ diff --git a/docker-compose.yml b/docker-compose.yml index 5b93acdd1ce0..849089685dfd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: - .:/opt/cypress ci: # This should mirror the image used in workflows.yml - image: cypress/browsers-internal:node18.15.0-chrome114-ff115 + image: cypress/browsers-internal:node18.17.1-chrome118-ff115 ports: - 5566:5566 - 5567:5567 diff --git a/guides/building-release-artifacts.md b/guides/building-release-artifacts.md index 2b4a5d6d53aa..a8b273e0771f 100644 --- a/guides/building-release-artifacts.md +++ b/guides/building-release-artifacts.md @@ -38,3 +38,9 @@ You can build the Cypress binary locally by running `yarn binary-build`, then pa If you're on macOS and building locally, you'll need a code-signing certificate in your keychain, which you can get by following the [instructions on Apple's website](https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW30). Also, you'll also most likely want to skip notarization since it requires an Apple Developer Program account - set `SKIP_NOTARIZATION=1` when building locally to do this. [More info about code signing in CI](./code-signing.md). `yarn binary-zip` can be used to zip the built binary together. + +### Tips + +If you want to speed up the time it takes to package the binary, set `V8_SNAPSHOT_DISABLE_MINIFY=1` + +If you are on an M1, you need to set `RESET_ADHOC_SIGNATURE=1` in order to be able to actually run the binary after packaging it. diff --git a/package.json b/package.json index 0890f7463844..e316dfcb9a4a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "binary-ensure": "node ./scripts/binary.js ensure", "binary-purge": "node ./scripts/binary.js purge-version", "binary-release": "node ./scripts/binary.js release", + "binary-smoke-test": "node ./scripts/binary.js smoke", "binary-upload": "node ./scripts/binary.js upload", "binary-zip": "node ./scripts/binary.js zip", "binary-package": "cross-env NODE_OPTIONS=--max_old_space_size=8192 node ./scripts/binary.js package", @@ -145,7 +146,7 @@ "dedent": "^0.7.0", "del": "3.0.0", "detect-port": "^1.3.0", - "electron": "25.8.4", + "electron": "27.1.3", "electron-builder": "^23.6.0", "enzyme-adapter-react-16": "1.12.1", "eslint": "7.22.0", @@ -211,7 +212,7 @@ "yarn-deduplicate": "3.1.0" }, "engines": { - "node": ">=18.15.0", + "node": ">=18.17.0", "yarn": ">=1.17.3" }, "productName": "Cypress", diff --git a/packages/app/cypress/component/support/index.ts b/packages/app/cypress/component/support/index.ts index 744aa00fed7a..18d1ee68dad2 100644 --- a/packages/app/cypress/component/support/index.ts +++ b/packages/app/cypress/component/support/index.ts @@ -48,5 +48,5 @@ registerMountFn({ plugins: [() => createRouter(), () => pinia] }) installCustomPercyCommand() -Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop limit exceeded')) +Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop completed with undelivered notifications.')) Cypress.Commands.add('tabUntil', tabUntil) diff --git a/packages/app/src/components/Slideshow.vue b/packages/app/src/components/Slideshow.vue index b6a34bb04008..7a752833c8cd 100644 --- a/packages/app/src/components/Slideshow.vue +++ b/packages/app/src/components/Slideshow.vue @@ -2,7 +2,7 @@
- - +
diff --git a/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx b/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx index 5db0b6916a59..22ee6e78beeb 100644 --- a/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx +++ b/packages/app/src/debug/empty/DebugEmptyStates.cy.tsx @@ -66,8 +66,7 @@ describe('Debug page empty states', { defaultCommandTimeout: 250 }, () => { // ensure the promos are done transitioning before clicking on the control // since 2 buttons could display if both promos are easing in and out - cy.findByTestId('promo-action') - .should('not.have.class', 'ease-in') + cy.findAllByTestId('guide-card', { timeout: 350 }).should('not.have.class', 'ease-in') .and('not.have.class', 'ease-out') cy.findByTestId('promo-action-control').click() diff --git a/packages/app/src/debug/guide/DebugGuide.vue b/packages/app/src/debug/guide/DebugGuide.vue index 22bc7073743c..cf532fd4d691 100644 --- a/packages/app/src/debug/guide/DebugGuide.vue +++ b/packages/app/src/debug/guide/DebugGuide.vue @@ -20,14 +20,17 @@ diff --git a/packages/electron/README.md b/packages/electron/README.md index f60086beeaae..c1f2726384ca 100644 --- a/packages/electron/README.md +++ b/packages/electron/README.md @@ -36,7 +36,7 @@ Upgrading `electron` involves more than just bumping this package's `package.jso - the major version number of Node.js changes, since users rely on the bundled Node.js to load plugins and `.js` fixtures, or - there are changes to Electron that require new shared libraries to be installed on Linux, breaking existing CI setups, or - there is some other change that would break existing usage of Cypress (for example, a Web API feature being removed/added to the bundled Chromium) -- [ ] **Create and publish Docker `base-internal` and `browsers-internal` family images matching the Node.js and Chromium versions in Electron.** These images live inside the [`cypress-docker-images`](/~https://github.com/cypress-io/cypress-docker-images/) repository. The `browsers-internal` image will be used inside our CI pipelines. The `base-internal` image will be used by the `browsers-internal` image and possibly other system images (described below). For general use of Cypress in Docker, we encourage the use of the [Cypress Docker Factory](/~https://github.com/cypress-io/cypress-docker-images#cypressfactory). This works great for using Cypress as an end user, but doesn't fully suit the needs for developing Cypress, as we require: +- [ ] **Create and publish Docker `base-internal` and `browsers-internal` family images matching the Node.js and Chromium versions in Electron.** These images live inside the [`cypress-docker-images`](/~https://github.com/cypress-io/cypress-docker-images/) repository. The `browsers-internal` image will be used inside our CI pipelines. The `base-internal` image will be used by the `browsers-internal` image and possibly other system images (described below). The Chromium version can be determined from the [DEPS](/~https://github.com/electron/electron/blob/main/DEPS) file in Electron's repository on the correct tag. The Node version can be determined from the [Electron Releases page](https://www.electronjs.org/docs/latest/tutorial/electron-timelines). For general use of Cypress in Docker, we encourage the use of the [Cypress Docker Factory](/~https://github.com/cypress-io/cypress-docker-images#cypressfactory). This works great for using Cypress as an end user, but doesn't fully suit the needs for developing Cypress, as we require: - The installation of packages, such as `curl`, `xauth`, and `build-essential`/`make` needed for our [`circleci`](../../.circleci/config.yml) jobs/pipelines. - Specific images targeted to test Cypress on various node versions and distributions of linux, such as different versions of `ubuntu`. @@ -45,19 +45,49 @@ Upgrading `electron` involves more than just bumping this package's `package.jso - The Ubuntu images in [base-internal](/~https://github.com/cypress-io/cypress-docker-images/tree/master/base-internal) are updated to be used in the [system binary tests](../../system-tests/test-binary) if any of the following are true for the images used inside the system binary tests: - The last two major [Ubuntu LTS Releases](https://ubuntu.com/about/release-cycle) are out-of-date. - The [NodeJS](https://nodejs.org/en) version is not the active LTS. +- [ ] **Update `workflows.yml`** + - [ ] Ensure it references the new `base-internal` and `browsers-internal` Docker images + - [ ] Ensure the new Electron version is used as a build target in the `Build better-sqlite3 for CentOS 7` step - [ ] **Ensure that a matching Node.js version is enforced in the monorepo for local development and CI.** When Electron is upgraded, oftentimes, the bundled Node.js version that comes with Electron is updated as well. Because all unit and integration tests run in normal Node.js (not Electron's Node.js), it's important for this Node.js version to be synced with the monorepo. There are a few places where this needs to be done: - [ ] [`/.node-version`](../../.node-version) - used by `nvm` and other Node version managers - [ ] `@types/node` used throughout the monorepo to determine compatible node types. The major version of this package must reflect the node version set in [`/.node-version`](../../.node-version). - [ ] [github workflows](../../.github) - used for repository templates, vulnerability detection, and V8 snapshots. If the node version for Snyk needs to be updated, then the required pull request check into `develop` must also be updated. A repository administrator will need to accomplish this. - [ ] [`/package.json`](../../package.json) - update `engines` - - [ ] [`/scripts/run-docker-local.sh`](../../scripts/run-docker-local.sh) - update Docker image to the new matching `browsers` image + - [ ] [`docker-compose.yml`](../../docker-compose.yml) - update Docker image to the new matching `browsers` image - [ ] [`/system-tests/test-binary/*`](../../system-tests/test-binary) - update binary system tests to use the newly published Ubuntu and Node images mentioned above, if applicable - [ ] [`/.circleci/config.yml`](../../.circleci/config.yml) - Update the Docker `image`s to the new matching `browsers` image. - Update the `xcode` version to one with the same major Node.js version bundled. There is usually not an exact match, this is ok as long as the major version number as the same. - - [ ] Do a global search for the old Node.js version to identify any new areas that may need updating/unification, and update those locations (and this document!) + - [ ] Do a global search for the old Node.js version to identify any new areas that may need updating/unification, and update those locations (and this document!) + +- [ ] **Update `cypress-publish-binary`** For **binary publishing**, make sure the `electron` version that we updated in [`/package.json`](../../package.json) matches the `electron` version inside the [publish binary project](/~https://github.com/cypress-io/cypress-publish-binary/blob/main/package.json). This is to make sure add-on tests inside the publish-binary repository work locally, but are not required to install the correct version of `electron` in CI when publishing the binary. Ensure the `electron` target in this project's `.circleci` configuration is updated as well. Set the Remove this before merging, and ensure that branch is merged as well. + - [ ] Create a new branch in `cypress-publish-binary` + - [ ] Update `electron` version in `package.json` + - [ ] Update the target `electron` version in the circle configuration + - [ ] Update the docker image to the new browsers-internal image made in the previous step + - [ ] Temporarily update the circle configuration to allow `cypress` to run against the branch + - [ ] Temporarily set target `cypress-publish-binary` branch as a `branch` property on the request body in [../../scripts/binary/trigger-publish-binary-pipeline.js](../../scripts/binary/trigger-publish-binary-pipeline.js) script, so that you can test against this branch from the electron upgrade branch + + - [ ] **Manually smoke test `cypress open`.** Upgrading Electron can break the `desktop-gui` in unexpected ways. Since testing in this area is weak, double-check that things like launching `cypress open`, signing into Cypress Cloud, and launching Electron tests still work. +- [ ] **Manually smoke test `cypress run` in record mode** Upgrading Electron can cause `better-sqlite3` to SIGSEGV the Electron process. - [ ] **Fix failing tests.** Usually, these are due to breaking changes in either Node.js or Electron. Check the changelogs of both to find relevant changes. -- [ ] For **binary publishing**, make sure the `electron` version that we updated in [`/package.json`](../../package.json) matches the `electron` version inside the [publish binary project](/~https://github.com/cypress-io/cypress-publish-binary/blob/main/package.json). This is to make sure add-on tests inside the publish-binary repository work locally, but are not required to install the correct version of `electron` in CI when publishing the binary. -- [ ] If needed, update the **[V8 Snapshot Cache](/~https://github.com/cypress-io/cypress/actions/workflows/update_v8_snapshot_cache.yml)** by running the workflow. Make sure to use the branch that contains the electron updates to populate the `'workflow from'` and `'branch to update'` arguments. Select `'Generate from scratch'` and `'commit directly to branch'`. This will usually take 6-8 hours to complete and is best to not be actively developing on the branch when this workflow runs. + +- [ ] If needed, update the **[V8 Snapshot Cache](/~https://github.com/cypress-io/cypress/actions/workflows/update_v8_snapshot_cache.yml)** by running the GitHub workflow. Make sure to use the branch that contains the electron updates to populate the `'workflow from'` and `'branch to update'` arguments. Select `'Generate from scratch'` and `'commit directly to branch'`. This will usually take 6-8 hours to complete and is best to not be actively developing on the branch when this workflow runs. + + +### Common Upgrade Issues + +#### Integrity Check Failures + +*Solution*: Update the string representation of `fs.readFileSync` in [scripts/binary/binary-integrity-check-source.js](../../scripts/binary/binary-integrity-check-source.js) to match the string generated by the new version of electron. Create a throw-away script and simply `console.log(fs.readFileSync.toString())`, and execute it with *Electron* rather than *Node*. + +#### ResizeObserver errors in Component Test + +*Solution*: This error is benign. From time to time, the error message we match against in order to swallow the error changes. Update the necessary support files with the new error message. + +#### Electron crashes immediately after initializing the Protocol database + +*Solution*: This is often due to a mismatched prebuild of `better-sqlite3`. Ensure your repository is clear of untracked files with `git clean -xfd`, and run `yarn` again. If the issue persists, ensure you are running the latest version of your operating system. Electron prebuilds key to darwin/linux/windows, and do not differentiate between versions of the same. + diff --git a/packages/frontend-shared/cypress/support/component.ts b/packages/frontend-shared/cypress/support/component.ts index 425304429c60..0f802fec8231 100644 --- a/packages/frontend-shared/cypress/support/component.ts +++ b/packages/frontend-shared/cypress/support/component.ts @@ -82,7 +82,7 @@ function validateWithinViewport (subject: JQuery): Cypress.Chainabl Cypress.Commands.add('validateWithinViewport', { prevSubject: true }, validateWithinViewport) -Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop limit exceeded')) +Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop completed with undelivered notifications.')) registerMountFn() addVueCommand() diff --git a/packages/frontend-shared/cypress/support/e2e.ts b/packages/frontend-shared/cypress/support/e2e.ts index 6b2b40b1fa9a..f509944b695f 100644 --- a/packages/frontend-shared/cypress/support/e2e.ts +++ b/packages/frontend-shared/cypress/support/e2e.ts @@ -557,7 +557,7 @@ function getAutIframe () { return cy.get('iframe.aut-iframe').its('0.contentDocument.documentElement').then(cy.wrap) as Cypress.Chainable> } -Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop limit exceeded')) +Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop completed with undelivered notifications.')) Cypress.Commands.add('scaffoldProject', scaffoldProject) diff --git a/scripts/after-pack-hook.js b/scripts/after-pack-hook.js index 85c2a7e5ea98..23376c023728 100644 --- a/scripts/after-pack-hook.js +++ b/scripts/after-pack-hook.js @@ -6,10 +6,23 @@ const path = require('path') const { setupV8Snapshots } = require('@tooling/v8-snapshot') const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses') const { buildEntryPointAndCleanup, cleanupUnneededDependencies } = require('./binary/binary-cleanup') -const { getIntegrityCheckSource, getBinaryEntryPointSource, getEncryptionFileSource, getCloudEnvironmentFileSource, validateEncryptionFile, getProtocolFileSource, validateCloudEnvironmentFile, validateProtocolFile } = require('./binary/binary-sources') +const { getIntegrityCheckSource, getBinaryEntryPointSource, getBinaryByteNodeEntryPointSource, getEncryptionFileSource, getCloudEnvironmentFileSource, validateEncryptionFile, getProtocolFileSource, validateCloudEnvironmentFile, validateProtocolFile, getIndexJscHash, DUMMY_INDEX_JSC_HASH } = require('./binary/binary-sources') +const verify = require('../cli/lib/tasks/verify') +const execa = require('execa') +const meta = require('./binary/meta') const CY_ROOT_DIR = path.join(__dirname, '..') +const createJscFromCypress = async () => { + const args = [] + + if (verify.needsSandbox()) { + args.push('--no-sandbox') + } + + await execa(`${meta.buildAppExecutable()}`, args) +} + module.exports = async function (params) { try { console.log('****************************') @@ -58,6 +71,7 @@ module.exports = async function (params) { } if (!['1', 'true'].includes(process.env.DISABLE_SNAPSHOT_REQUIRE)) { + const binaryByteNodeEntryPointSource = await getBinaryByteNodeEntryPointSource() const binaryEntryPointSource = await getBinaryEntryPointSource() const encryptionFilePath = path.join(CY_ROOT_DIR, 'packages/server/lib/cloud/encryption.ts') const encryptionFileSource = await getEncryptionFileSource(encryptionFilePath) @@ -76,6 +90,10 @@ module.exports = async function (params) { fs.writeFile(path.join(outputFolder, 'index.js'), binaryEntryPointSource), ]) + const integrityCheckSource = getIntegrityCheckSource(outputFolder) + + await fs.writeFile(path.join(outputFolder, 'index.js'), binaryByteNodeEntryPointSource) + await Promise.all([ validateEncryptionFile(encryptionFilePath), validateCloudEnvironmentFile(cloudEnvironmentFilePath), @@ -87,6 +105,7 @@ module.exports = async function (params) { exePathPerPlatform[os.platform()], { version: FuseVersion.V1, + resetAdHocDarwinSignature: os.platform() === 'darwin' && os.arch() === 'arm64', [FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: true, [FuseV1Options.EnableNodeCliInspectArguments]: false, }, @@ -99,7 +118,34 @@ module.exports = async function (params) { await cleanupUnneededDependencies(outputFolder) await setupV8Snapshots({ cypressAppPath: params.appOutDir, - integrityCheckSource: getIntegrityCheckSource(outputFolder), + integrityCheckSource, + }) + + // Use Cypress to create the JSC entry point file + await createJscFromCypress() + + const indexJscHash = await getIndexJscHash(outputFolder) + + // This file is not needed at this point since it's been replaced by the jsc. So we remove it. + await fs.remove(path.join(outputFolder, 'packages/server/index.js')) + await fs.writeFile(path.join(outputFolder, 'index.js'), binaryEntryPointSource) + + await flipFuses( + exePathPerPlatform[os.platform()], + { + version: FuseVersion.V1, + [FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: true, + [FuseV1Options.EnableNodeCliInspectArguments]: false, + }, + ) + + // Regenerate the v8 snapshots. This time, we replace the JSC hash with what we calculated earlier. We use the existing snapshot script to avoid having to go through the entire v8 snapshot process + await setupV8Snapshots({ + cypressAppPath: params.appOutDir, + useExistingSnapshotScript: true, + updateSnapshotScriptContents: (contents) => { + return contents.replace(DUMMY_INDEX_JSC_HASH, indexJscHash) + }, }) } else { console.log(`value of DISABLE_SNAPSHOT_REQUIRE was ${process.env.DISABLE_SNAPSHOT_REQUIRE}. Skipping snapshot require...`) diff --git a/scripts/binary/binary-byte-node-entry-point-source.js b/scripts/binary/binary-byte-node-entry-point-source.js new file mode 100644 index 000000000000..3e4f28de834c --- /dev/null +++ b/scripts/binary/binary-byte-node-entry-point-source.js @@ -0,0 +1,13 @@ +const compile = async () => { + const bytenode = await import('bytenode') + const path = require('path') + + await bytenode.compileFile({ + filename: path.join(__dirname, 'packages', 'server', 'index.js'), + output: path.join(__dirname, 'packages', 'server', 'index.jsc'), + }) +} + +compile().then(() => { + process.exit() +}) diff --git a/scripts/binary/binary-cleanup.js b/scripts/binary/binary-cleanup.js index 41b845d22584..e7874f8f801d 100644 --- a/scripts/binary/binary-cleanup.js +++ b/scripts/binary/binary-cleanup.js @@ -142,19 +142,8 @@ const createServerEntryPointBundle = async (buildAppDir) => { await fs.copy(path.join(workingDir, 'index.js'), path.join(buildAppDir, 'packages', 'server', 'index.js')) - console.log(`compiling server entry point bundle to ${path.join(buildAppDir, 'packages', 'server', 'index.jsc')}`) - - // Use bytenode to compile the entry point bundle. This will save time on the v8 compile step and ensure the integrity of the entry point - const bytenode = await import('bytenode') - - await bytenode.compileFile({ - filename: path.join(buildAppDir, 'packages', 'server', 'index.js'), - output: path.join(buildAppDir, 'packages', 'server', 'index.jsc'), - electron: true, - }) - // Convert these inputs to a relative file path. Note that these paths are posix paths. - return [...Object.keys(esbuildResult.metafile.inputs)].map((input) => `./${input}`) + return [...Object.keys(esbuildResult.metafile.inputs)].filter((input) => input !== 'packages/server/index.js').map((input) => `./${input}`) } const buildEntryPointAndCleanup = async (buildAppDir) => { diff --git a/scripts/binary/binary-integrity-check-source.js b/scripts/binary/binary-integrity-check-source.js index 4f5e47b8bc6a..b634a62d2d21 100644 --- a/scripts/binary/binary-integrity-check-source.js +++ b/scripts/binary/binary-integrity-check-source.js @@ -94,7 +94,7 @@ function validateElectron (electron) { function validateFs (fs) { // Hard coded function as this is electron code and there's not an easy way to get the function string at package time. If this fails on an updated version of electron, we'll need to update this. - if (originalToString.call(fs.readFileSync) !== `function(e,s){const r=splitPath(e);if(!r.isAsar)return F.apply(this,arguments);const{asarPath:n,filePath:a}=r,o=getOrCreateArchive(n);if(!o)throw createError("INVALID_ARCHIVE",{asarPath:n});const c=o.getFileInfo(a);if(!c)throw createError("NOT_FOUND",{asarPath:n,filePath:a});if(0===c.size)return s?"":i.Buffer.alloc(0);if(c.unpacked){const e=o.copyFileOut(a);return t.readFileSync(e,s)}if(s){if("string"==typeof s)s={encoding:s};else if("object"!=typeof s)throw new TypeError("Bad arguments")}else s={encoding:null};const{encoding:f}=s,l=i.Buffer.alloc(c.size),u=o.getFdAndValidateIntegrityLater();if(!(u>=0))throw createError("NOT_FOUND",{asarPath:n,filePath:a});return logASARAccess(n,a,c.offset),t.readSync(u,l,0,c.size,c.offset),validateBufferIntegrity(l,c.integrity),f?l.toString(f):l}`) { + if (originalToString.call(fs.readFileSync) !== `function(e,s){const r=splitPath(e);if(!r.isAsar)return F.apply(this,arguments);const{asarPath:n,filePath:i}=r,o=getOrCreateArchive(n);if(!o)throw createError("INVALID_ARCHIVE",{asarPath:n});const c=o.getFileInfo(i);if(!c)throw createError("NOT_FOUND",{asarPath:n,filePath:i});if(0===c.size)return s?"":a.Buffer.alloc(0);if(c.unpacked){const e=o.copyFileOut(i);return t.readFileSync(e,s)}if(s){if("string"==typeof s)s={encoding:s};else if("object"!=typeof s)throw new TypeError("Bad arguments")}else s={encoding:null};const{encoding:f}=s,l=a.Buffer.alloc(c.size),u=o.getFdAndValidateIntegrityLater();if(!(u>=0))throw createError("NOT_FOUND",{asarPath:n,filePath:i});return logASARAccess(n,i,c.offset),t.readSync(u,l,0,c.size,c.offset),validateBufferIntegrity(l,c.integrity),f?l.toString(f):l}`) { console.error(`Integrity check failed for toString.call(fs.readFileSync)`) throw new Error(integrityErrorMessage) } diff --git a/scripts/binary/binary-sources.js b/scripts/binary/binary-sources.js index f334fa0a94cf..56dafc56a6f2 100644 --- a/scripts/binary/binary-sources.js +++ b/scripts/binary/binary-sources.js @@ -4,6 +4,8 @@ const path = require('path') const esbuild = require('esbuild') const escapeString = (string) => string.replaceAll(`\``, `\\\``).replaceAll(`$`, `\\$`) +const secret = require('crypto').randomBytes(48).toString('hex') +const DUMMY_INDEX_JSC_HASH = 'abcddcbaabcddcbaabcddcbaabcddcba' function read (file) { const pathToFile = require.resolve(`./${file}`) @@ -24,22 +26,37 @@ const getBinaryEntryPointSource = async () => { return esbuildResult.outputFiles[0].text } +const getBinaryByteNodeEntryPointSource = async () => { + const esbuildResult = await esbuild.build({ + entryPoints: [require.resolve('./binary-byte-node-entry-point-source.js')], + bundle: true, + platform: 'node', + write: false, + minify: true, + treeShaking: true, + }) + + return esbuildResult.outputFiles[0].text +} + const getIntegrityCheckSource = (baseDirectory) => { const fileSource = read('binary-integrity-check-source.js') - const secret = require('crypto').randomBytes(48).toString('hex') const mainIndexHash = crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './index.js'), 'utf8')).digest('hex') - const indexJscHash = crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './packages/server/index.jsc'), 'utf8')).digest('hex') return fileSource.split('\n').join(`\n `) .replaceAll('MAIN_INDEX_HASH', mainIndexHash) - .replaceAll('INDEX_JSC_HASH', indexJscHash) + .replaceAll('INDEX_JSC_HASH', DUMMY_INDEX_JSC_HASH) .replaceAll('HMAC_SECRET', secret) .replaceAll('CRYPTO_CREATE_HMAC_TO_STRING', escapeString(crypto.createHmac.toString())) .replaceAll('CRYPTO_HMAC_UPDATE_TO_STRING', escapeString(crypto.Hmac.prototype.update.toString())) .replaceAll('CRYPTO_HMAC_DIGEST_TO_STRING', escapeString(crypto.Hmac.prototype.digest.toString())) } +const getIndexJscHash = (baseDirectory) => { + return crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './packages/server/index.jsc'), 'utf8')).digest('hex') +} + const getEncryptionFileSource = async (encryptionFilePath) => { const fileContents = await fs.readFile(encryptionFilePath, 'utf8') @@ -102,6 +119,7 @@ const validateProtocolFile = async (protocolFilePath) => { module.exports = { getBinaryEntryPointSource, + getBinaryByteNodeEntryPointSource, getIntegrityCheckSource, getEncryptionFileSource, validateEncryptionFile, @@ -109,4 +127,6 @@ module.exports = { validateCloudEnvironmentFile, getProtocolFileSource, validateProtocolFile, + getIndexJscHash, + DUMMY_INDEX_JSC_HASH, } diff --git a/scripts/binary/build.ts b/scripts/binary/build.ts index fdeb460e8794..fcdbc770fd4a 100644 --- a/scripts/binary/build.ts +++ b/scripts/binary/build.ts @@ -8,17 +8,13 @@ import electron from '../../packages/electron' import la from 'lazy-ass' import { promisify } from 'util' import glob from 'glob' - import * as packages from './util/packages' import * as meta from './meta' -import xvfb from '../../cli/lib/exec/xvfb' -import smoke from './smoke' import { spawn, execSync } from 'child_process' import { transformRequires } from './util/transform-requires' import execa from 'execa' import { testStaticAssets } from './util/testStaticAssets' import performanceTracking from '../../system-tests/lib/performance' -import verify from '../../cli/lib/tasks/verify' import * as electronBuilder from 'electron-builder' const globAsync = promisify(glob) @@ -307,26 +303,6 @@ export async function packageElectronApp (options: BuildCypressAppOpts) { console.log(stdout) - // runSmokeTests - let usingXvfb = xvfb.isNeeded() - - try { - if (usingXvfb) { - await xvfb.start() - } - - log(`#testExecutableVersion ${meta.buildAppExecutable()}`) - await testExecutableVersion(meta.buildAppExecutable(), version) - - const executablePath = meta.buildAppExecutable() - - await smoke.test(executablePath, meta.buildAppDir()) - } finally { - if (usingXvfb) { - await xvfb.stop() - } - } - // verifyAppCanOpen if (platform === 'darwin' && !skipSigning) { const appFolder = meta.zipDir() @@ -417,26 +393,3 @@ async function testDistVersion (distDir: string, version: string) { console.log('✅ using node --version works') } - -async function testExecutableVersion (buildAppExecutable: string, version: string) { - log('#testVersion') - - console.log('testing built app executable version') - console.log(`by calling: ${buildAppExecutable} --version`) - - const args = ['--version'] - - if (verify.needsSandbox()) { - args.push('--no-sandbox') - } - - const result = await execa(buildAppExecutable, args) - - la(result.stdout, 'missing output when getting built version', result) - - console.log('built app version', result.stdout) - la(result.stdout.trim() === version.trim(), 'different version reported', - result.stdout, 'from input version to build', version) - - console.log('✅ using --version on the Cypress binary works') -} diff --git a/scripts/binary/index.js b/scripts/binary/index.js index 7e679d2fc571..80947662990c 100644 --- a/scripts/binary/index.js +++ b/scripts/binary/index.js @@ -23,6 +23,17 @@ const uploadUtils = require('./util/upload') const { uploadArtifactToS3 } = require('./upload-build-artifact') const { moveBinaries } = require('./move-binaries') const { exec } = require('child_process') +const xvfb = require('../../cli/lib/exec/xvfb') +const smoke = require('./smoke') +const verify = require('../../cli/lib/tasks/verify') +const execa = require('execa') + +const log = function (msg) { + const time = new Date() + const timeStamp = time.toLocaleTimeString() + + console.log(timeStamp, chalk.yellow(msg), chalk.blue(meta.PLATFORM)) +} const success = (str) => { return console.log(chalk.bgGreen(` ${chalk.black(str)} `)) @@ -50,6 +61,29 @@ const askMissingOptions = function (properties = []) { return questionsRemain(pickedQuestions) } +async function testExecutableVersion (buildAppExecutable, version) { + log('#testVersion') + + console.log('testing built app executable version') + console.log(`by calling: ${buildAppExecutable} --version`) + + const args = ['--version'] + + if (verify.needsSandbox()) { + args.push('--no-sandbox') + } + + const result = await execa(buildAppExecutable, args) + + la(result.stdout, 'missing output when getting built version', result) + + console.log('built app version', result.stdout) + la(result.stdout.trim() === version.trim(), 'different version reported', + result.stdout, 'from input version to build', version) + + console.log('✅ using --version on the Cypress binary works') +} + // hack for @packages/server modifying cwd process.chdir(cwd) @@ -214,6 +248,38 @@ const deploy = { }) }, + async smoke (options) { + console.log('#smoke') + + if (options == null) { + options = this.parseOptions(process.argv) + } + + debug('parsed build options %o', options) + + await askMissingOptions(['version'])(options) + + // runSmokeTests + let usingXvfb = xvfb.isNeeded() + + try { + if (usingXvfb) { + await xvfb.start() + } + + log(`#testExecutableVersion ${meta.buildAppExecutable()}`) + await testExecutableVersion(meta.buildAppExecutable(), options.version) + + const executablePath = meta.buildAppExecutable() + + await smoke.test(executablePath, meta.buildAppDir()) + } finally { + if (usingXvfb) { + await xvfb.stop() + } + } + }, + zip (options) { console.log('#zip') if (!options) { diff --git a/scripts/binary/smoke.js b/scripts/binary/smoke.js index 879c5e68e5b9..86c4cf09096f 100644 --- a/scripts/binary/smoke.js +++ b/scripts/binary/smoke.js @@ -299,7 +299,7 @@ const runIntegrityTest = async function (buildAppExecutable, buildAppDir, e2e) { console.error(`extra keys in electron process: ${extraKeys}`) } - const allowList = ['regeneratorRuntime', '__core-js_shared__', 'getSnapshotResult', 'supportTypeScript'] + const allowList = ['regeneratorRuntime', '__core-js_shared__', 'getSnapshotResult', 'supportTypeScript', 'Iterator'] await testAlteringEntryPoint(`(${compareGlobals.toString()})()`, `extra keys in electron process: ${allowList}\nIntegrity check failed with expected stack length 9 but got 10`) diff --git a/scripts/binary/trigger-publish-binary-pipeline.js b/scripts/binary/trigger-publish-binary-pipeline.js index a57cfa801d6b..12d1fb5dc547 100644 --- a/scripts/binary/trigger-publish-binary-pipeline.js +++ b/scripts/binary/trigger-publish-binary-pipeline.js @@ -10,6 +10,7 @@ const { getNextVersionForBinary } = require('../get-next-version') const { nextVersion } = await getNextVersionForBinary() const body = JSON.stringify({ + branch: 'cacie/upgrade-electron-27', parameters: { temp_dir: os.tmpdir(), sha: process.env.CIRCLE_SHA1, diff --git a/system-tests/__snapshots__/component_testing_spec.ts.js b/system-tests/__snapshots__/component_testing_spec.ts.js index 06341d554ec1..48e435796b01 100644 --- a/system-tests/__snapshots__/component_testing_spec.ts.js +++ b/system-tests/__snapshots__/component_testing_spec.ts.js @@ -786,9 +786,9 @@ exports['experimentalSingleTabRunMode / executes all specs in a single tab'] = ` (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/1_fails.cy.js/simple failing spec -- fails (fai (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/1_fails.cy.js/simple failing spec -- fails (fai (1280x599) led).png - - /XXX/XXX/XXX/cypress/screenshots/1_fails.cy.js/simple failing spec -- fails agai (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/1_fails.cy.js/simple failing spec -- fails agai (1280x599) n (failed).png diff --git a/system-tests/__snapshots__/protocol_spec.js b/system-tests/__snapshots__/protocol_spec.js index 352c6151e6d0..de9ad2ad01ff 100644 --- a/system-tests/__snapshots__/protocol_spec.js +++ b/system-tests/__snapshots__/protocol_spec.js @@ -6784,50 +6784,6 @@ exports['component events - experimentalSingleTabRunMode: true'] = ` "pageLoading": [], "resetTest": [], "responseEndedWithEmptyBody": [ - { - "requestId": "Any.Number", - "isCached": true, - "timings": { - "cdpRequestWillBeSentTimestamp": "Any.Number", - "cdpRequestWillBeSentReceivedTimestamp": "Any.Number", - "proxyRequestReceivedTimestamp": "Any.Number", - "cdpLagDuration": "Any.Number", - "proxyRequestCorrelationDuration": "Any.Number" - } - }, - { - "requestId": "Any.Number", - "isCached": true, - "timings": { - "cdpRequestWillBeSentTimestamp": "Any.Number", - "cdpRequestWillBeSentReceivedTimestamp": "Any.Number", - "proxyRequestReceivedTimestamp": "Any.Number", - "cdpLagDuration": "Any.Number", - "proxyRequestCorrelationDuration": "Any.Number" - } - }, - { - "requestId": "Any.Number", - "isCached": true, - "timings": { - "cdpRequestWillBeSentTimestamp": "Any.Number", - "cdpRequestWillBeSentReceivedTimestamp": "Any.Number", - "proxyRequestReceivedTimestamp": "Any.Number", - "cdpLagDuration": "Any.Number", - "proxyRequestCorrelationDuration": "Any.Number" - } - }, - { - "requestId": "Any.Number", - "isCached": true, - "timings": { - "cdpRequestWillBeSentTimestamp": "Any.Number", - "cdpRequestWillBeSentReceivedTimestamp": "Any.Number", - "proxyRequestReceivedTimestamp": "Any.Number", - "cdpLagDuration": "Any.Number", - "proxyRequestCorrelationDuration": "Any.Number" - } - }, { "requestId": "Any.Number", "isCached": true, diff --git a/system-tests/__snapshots__/retries_spec.ts.js b/system-tests/__snapshots__/retries_spec.ts.js index 5c023ca7c964..bdb6f5e3ba4d 100644 --- a/system-tests/__snapshots__/retries_spec.ts.js +++ b/system-tests/__snapshots__/retries_spec.ts.js @@ -164,8 +164,8 @@ exports['retries / supports retries (chrome)'] = ` (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/fail-twice.cy.js/fail twice (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/fail-twice.cy.js/fail twice (failed) (attempt 2 (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/fail-twice.cy.js/fail twice (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/fail-twice.cy.js/fail twice (failed) (attempt 2 (1280x599) ).png diff --git a/system-tests/__snapshots__/vite_dev_server_fresh_spec.ts.js b/system-tests/__snapshots__/vite_dev_server_fresh_spec.ts.js index 8c00e710ec1f..ed45491574a4 100644 --- a/system-tests/__snapshots__/vite_dev_server_fresh_spec.ts.js +++ b/system-tests/__snapshots__/vite_dev_server_fresh_spec.ts.js @@ -82,7 +82,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -165,12 +165,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -216,7 +216,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -254,7 +254,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png @@ -485,7 +485,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -568,12 +568,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -619,7 +619,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -657,7 +657,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png @@ -888,7 +888,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -971,12 +971,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -1022,7 +1022,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -1060,7 +1060,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png @@ -1291,7 +1291,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -1374,12 +1374,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -1425,7 +1425,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -1463,7 +1463,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png diff --git a/system-tests/__snapshots__/webpack_dev_server_fresh_spec.ts.js b/system-tests/__snapshots__/webpack_dev_server_fresh_spec.ts.js index 7220f743e101..899a2e7e58a3 100644 --- a/system-tests/__snapshots__/webpack_dev_server_fresh_spec.ts.js +++ b/system-tests/__snapshots__/webpack_dev_server_fresh_spec.ts.js @@ -321,7 +321,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -404,12 +404,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -455,7 +455,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -493,7 +493,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png @@ -744,7 +744,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -827,12 +827,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -878,7 +878,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -916,7 +916,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png @@ -1158,7 +1158,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -1241,12 +1241,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -1292,7 +1292,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -1330,7 +1330,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png @@ -1584,7 +1584,7 @@ We dynamically generated a new test to display this failure. (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/AppCompilationError.cy.jsx/An uncaught error wa (1280x599) s detected outside of a test (failed).png @@ -1667,12 +1667,12 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- error on mount (failed) (1280x599) .png - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x603) - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- sync error (failed).png (1280x599) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- async error (failed).pn (1280x599) g - - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/Errors.cy.jsx/Errors -- command failure (failed (1280x599) ).png @@ -1718,7 +1718,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReact.cy.jsx/is missing React (failed).p (1280x599) ng @@ -1756,7 +1756,7 @@ https://on.cypress.io/uncaught-exception-from-application (Screenshots) - - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x603) + - /XXX/XXX/XXX/cypress/screenshots/MissingReactInSpec.cy.jsx/is missing React in t (1280x599) his file (failed).png diff --git a/system-tests/lib/resultsUtils.ts b/system-tests/lib/resultsUtils.ts index 5d31cf522d80..ed642f197e3d 100644 --- a/system-tests/lib/resultsUtils.ts +++ b/system-tests/lib/resultsUtils.ts @@ -248,7 +248,7 @@ export const expectCorrectModuleApiResult = (json, opts: { run, 'stats.duration', wallClocks, - wallClocks + 600, // add 600ms to account for padding + wallClocks + 1000, // add 600ms to account for padding 1234, ) @@ -256,7 +256,7 @@ export const expectCorrectModuleApiResult = (json, opts: { run, 'reporterStats.duration', wallClocks, - wallClocks + 600, // add 600ms to account for padding + wallClocks + 1000, // add 600ms to account for padding 1234, ) diff --git a/system-tests/projects/screen-size/cypress/e2e/default_size.cy.js b/system-tests/projects/screen-size/cypress/e2e/default_size.cy.js index b207691e3f6f..f009576edf2e 100644 --- a/system-tests/projects/screen-size/cypress/e2e/default_size.cy.js +++ b/system-tests/projects/screen-size/cypress/e2e/default_size.cy.js @@ -16,7 +16,7 @@ describe('windowSize', () => { // availHeight: top.screen.availHeight, }).deep.eq({ innerWidth: 1280, - innerHeight: 603, + innerHeight: 599, // chrome 118 reduced the size here from 603 to 599 // screenWidth: 1280, // screenHeight: 603, // availWidth: 1280, diff --git a/system-tests/test-binary/module_api_spec.ts b/system-tests/test-binary/module_api_spec.ts index a49709e7048f..186b8e8b6e21 100644 --- a/system-tests/test-binary/module_api_spec.ts +++ b/system-tests/test-binary/module_api_spec.ts @@ -3,7 +3,7 @@ import systemTests from '../lib/system-tests' describe('module API', () => { systemTests.it('can run module API Mocha spec', { timeout: 240000, - dockerImage: 'cypress/base-internal:18.15.0', + dockerImage: 'cypress/base-internal:18.17.1', withBinary: true, project: 'module-api', browser: 'electron', diff --git a/system-tests/test-binary/node_versions_spec.ts b/system-tests/test-binary/node_versions_spec.ts index 6d2dc775db8e..9a23707f4ffe 100644 --- a/system-tests/test-binary/node_versions_spec.ts +++ b/system-tests/test-binary/node_versions_spec.ts @@ -33,7 +33,7 @@ describe('binary node versions', () => { describe('type: module', () => { [ - 'cypress/base:18.6.0', + 'cypress/base:18.15.0', 'cypress/base:20.5.0', ].forEach((dockerImage) => { systemTests.it(`can run in ${dockerImage}`, { diff --git a/tooling/v8-snapshot/cache/darwin/snapshot-meta.json b/tooling/v8-snapshot/cache/darwin/snapshot-meta.json index c9ee7c1194e8..c79b774e0d8d 100644 --- a/tooling/v8-snapshot/cache/darwin/snapshot-meta.json +++ b/tooling/v8-snapshot/cache/darwin/snapshot-meta.json @@ -1064,6 +1064,8 @@ "./node_modules/@cypress/commit-info/src/index.js", "./node_modules/@cypress/commit-info/src/utils.js", "./node_modules/@cypress/get-windows-proxy/node_modules/debug/src/common.js", + "./node_modules/@cypress/get-windows-proxy/node_modules/registry-js/dist/lib/index.js", + "./node_modules/@cypress/get-windows-proxy/node_modules/registry-js/dist/lib/registry.js", "./node_modules/@cypress/get-windows-proxy/src/index.js", "./node_modules/@cypress/parse-domain/build/tries/icann.complete.json", "./node_modules/@cypress/parse-domain/build/tries/private.complete.json", @@ -3179,6 +3181,8 @@ "./node_modules/recast/parsers/babel.js", "./node_modules/recast/parsers/esprima.js", "./node_modules/recast/parsers/typescript.js", + "./node_modules/registry-js/dist/lib/index.js", + "./node_modules/registry-js/dist/lib/registry.js", "./node_modules/request-promise-core/configure/request2.js", "./node_modules/request-promise-core/errors.js", "./node_modules/request-promise-core/lib/errors.js", @@ -4312,5 +4316,5 @@ "./tooling/v8-snapshot/cache/darwin/snapshot-entry.js" ], "deferredHashFile": "yarn.lock", - "deferredHash": "639592455164ce2c6efa4bae985b1c948e2b301ce0857a7653feeb2d6ace1ef7" + "deferredHash": "4aadec3ebe54a4c84b842e08ede20eaf495534d28f4555eb7933d651e6742e07" } \ No newline at end of file diff --git a/tooling/v8-snapshot/cache/linux/snapshot-meta.json b/tooling/v8-snapshot/cache/linux/snapshot-meta.json index b7e3d161ff0b..3bd26f0fc8fb 100644 --- a/tooling/v8-snapshot/cache/linux/snapshot-meta.json +++ b/tooling/v8-snapshot/cache/linux/snapshot-meta.json @@ -4315,5 +4315,5 @@ "./tooling/v8-snapshot/cache/linux/snapshot-entry.js" ], "deferredHashFile": "yarn.lock", - "deferredHash": "639592455164ce2c6efa4bae985b1c948e2b301ce0857a7653feeb2d6ace1ef7" + "deferredHash": "4aadec3ebe54a4c84b842e08ede20eaf495534d28f4555eb7933d651e6742e07" } \ No newline at end of file diff --git a/tooling/v8-snapshot/cache/win32/snapshot-meta.json b/tooling/v8-snapshot/cache/win32/snapshot-meta.json index c9d7b7142cb5..68d3c0f37d0c 100644 --- a/tooling/v8-snapshot/cache/win32/snapshot-meta.json +++ b/tooling/v8-snapshot/cache/win32/snapshot-meta.json @@ -4315,5 +4315,5 @@ "./tooling/v8-snapshot/cache/win32/snapshot-entry.js" ], "deferredHashFile": "yarn.lock", - "deferredHash": "d259022089e888426ee01b62b1116c69b1f34386814fb5dcd5df3699037e2be8" + "deferredHash": "aa7ca4b10c9c571cb3ac1a0dd1a04076a20ba1e8508ece952c63861804974c69" } \ No newline at end of file diff --git a/tooling/v8-snapshot/src/generator/snapshot-generator.ts b/tooling/v8-snapshot/src/generator/snapshot-generator.ts index 4ddb5e6489ff..176ca9908ca9 100644 --- a/tooling/v8-snapshot/src/generator/snapshot-generator.ts +++ b/tooling/v8-snapshot/src/generator/snapshot-generator.ts @@ -86,6 +86,8 @@ export type GenerationOpts = { minify: boolean supportTypeScript: boolean integrityCheckSource: string | undefined + useExistingSnapshotScript?: boolean + updateSnapshotScriptContents?: (contents: string) => string } function getDefaultGenerationOpts (projectBaseDir: string): GenerationOpts { @@ -98,6 +100,8 @@ function getDefaultGenerationOpts (projectBaseDir: string): GenerationOpts { minify: false, supportTypeScript: false, integrityCheckSource: undefined, + useExistingSnapshotScript: false, + updateSnapshotScriptContents: undefined, } } @@ -153,6 +157,14 @@ export class SnapshotGenerator { * Path where v8context bin is stored, derived from {@link GenerationOpts} snapshotBinDir */ private v8ContextFile?: string + /** + * Whether to use an existing snapshot script instead of creating a new one. + */ + useExistingSnapshotScript?: boolean + /** + * Function to update the contents of an existing snapshot script. + */ + updateSnapshotScriptContents?: ((contents: string) => string) /** * Generated snapshot script, needs to be set before calling `makeSnapshot`. @@ -186,6 +198,8 @@ export class SnapshotGenerator { nodeEnv, minify, integrityCheckSource, + useExistingSnapshotScript, + updateSnapshotScriptContents, }: GenerationOpts = Object.assign( getDefaultGenerationOpts(projectBaseDir), opts, @@ -210,6 +224,8 @@ export class SnapshotGenerator { this.bundlerPath = getBundlerPath() this.minify = minify this.integrityCheckSource = integrityCheckSource + this.useExistingSnapshotScript = useExistingSnapshotScript + this.updateSnapshotScriptContents = updateSnapshotScriptContents const auxiliaryDataKeys = Object.keys(this.auxiliaryData || {}) @@ -235,6 +251,19 @@ export class SnapshotGenerator { * Creates the snapshot script for the provided configuration */ async createScript () { + if (this.useExistingSnapshotScript) { + let contents = await fs.promises.readFile(this.snapshotScriptPath, 'utf8') + + if (this.updateSnapshotScriptContents) { + contents = this.updateSnapshotScriptContents(contents) + } + + this.snapshotScript = Buffer.from(contents) + await fs.promises.writeFile(this.snapshotScriptPath, this.snapshotScript) + + return + } + let deferred let norewrite diff --git a/tooling/v8-snapshot/src/setup/config.ts b/tooling/v8-snapshot/src/setup/config.ts index 81ace9cf6a1a..1349d15b24de 100644 --- a/tooling/v8-snapshot/src/setup/config.ts +++ b/tooling/v8-snapshot/src/setup/config.ts @@ -1,6 +1,6 @@ import path from 'path' -type SnapshotConfig = { +export type SnapshotConfig = { appEntryFile: string cypressAppSnapshotDir: string nodeModulesOnly: boolean @@ -11,6 +11,8 @@ type SnapshotConfig = { metaFile: string minify: boolean integrityCheckSource: string | undefined + useExistingSnapshotScript?: boolean + updateSnapshotScriptContents?: (contents: string) => string } const platformString = process.platform @@ -74,11 +76,15 @@ export function createConfig ({ cypressAppPath, integrityCheckSource, supportCypressInCypress, + useExistingSnapshotScript, + updateSnapshotScriptContents, }: { env?: 'dev' | 'prod' cypressAppPath?: string integrityCheckSource: string | undefined supportCypressInCypress?: boolean + useExistingSnapshotScript?: boolean + updateSnapshotScriptContents?: (contents: string) => string }): SnapshotConfig { /** * If true only node_module dependencies are included in the snapshot. Otherwise app files are included as well @@ -105,6 +111,8 @@ export function createConfig ({ snapshotEntryFile, minify, integrityCheckSource, + useExistingSnapshotScript, + updateSnapshotScriptContents, } } diff --git a/tooling/v8-snapshot/src/setup/index.ts b/tooling/v8-snapshot/src/setup/index.ts index 8b3b635e2a0d..2998881b8549 100644 --- a/tooling/v8-snapshot/src/setup/index.ts +++ b/tooling/v8-snapshot/src/setup/index.ts @@ -5,10 +5,10 @@ import minimist from 'minimist' import { generateEntry } from './generate-entry' import { installSnapshot } from './install-snapshot' -const setupV8Snapshots = async ({ cypressAppPath, integrityCheckSource, supportCypressInCypress }: { cypressAppPath?: string, integrityCheckSource?: string, supportCypressInCypress?: boolean} = {}) => { +const setupV8Snapshots = async ({ cypressAppPath, integrityCheckSource, supportCypressInCypress, useExistingSnapshotScript, updateSnapshotScriptContents }: { cypressAppPath?: string, integrityCheckSource?: string, supportCypressInCypress?: boolean, useExistingSnapshotScript?: boolean, updateSnapshotScriptContents?: (contents: string) => string } = {}) => { try { const args = minimist(process.argv.slice(2)) - const config = createConfig({ env: args.env, cypressAppPath, integrityCheckSource, supportCypressInCypress }) + const config = createConfig({ env: args.env, cypressAppPath, integrityCheckSource, supportCypressInCypress, useExistingSnapshotScript, updateSnapshotScriptContents }) await consolidateDeps(config) diff --git a/tooling/v8-snapshot/src/setup/install-snapshot.ts b/tooling/v8-snapshot/src/setup/install-snapshot.ts index 183c77efeaac..83fb78dda104 100644 --- a/tooling/v8-snapshot/src/setup/install-snapshot.ts +++ b/tooling/v8-snapshot/src/setup/install-snapshot.ts @@ -3,6 +3,7 @@ import { SnapshotGenerator } from '../generator/snapshot-generator' import { prettyPrintError } from '../utils' import fs from 'fs-extra' import forceNoRewrite from './force-no-rewrite' +import type { SnapshotConfig } from './config' const debug = require('debug') const logInfo = debug('cypress:snapgen:info') @@ -16,6 +17,8 @@ function getSnapshotGenerator ({ resolverMap, minify, integrityCheckSource, + useExistingSnapshotScript, + updateSnapshotScriptContents, }: { nodeModulesOnly: boolean projectBaseDir: string @@ -24,6 +27,8 @@ function getSnapshotGenerator ({ resolverMap: Record minify: boolean integrityCheckSource: string | undefined + useExistingSnapshotScript?: boolean + updateSnapshotScriptContents?: (contents: string) => string }) { return new SnapshotGenerator(projectBaseDir, snapshotEntryFile, { cacheDir: snapshotCacheDir, @@ -32,6 +37,8 @@ function getSnapshotGenerator ({ forceNoRewrite, minify, integrityCheckSource, + useExistingSnapshotScript, + updateSnapshotScriptContents, }) } @@ -44,7 +51,10 @@ function getSnapshotGenerator ({ * @param {Partial} opts */ export async function installSnapshot ( - { + config: SnapshotConfig, + resolverMap, +) { + const { cypressAppSnapshotDir, nodeModulesOnly, projectBaseDir, @@ -52,9 +62,10 @@ export async function installSnapshot ( snapshotEntryFile, minify, integrityCheckSource, - }, - resolverMap, -) { + useExistingSnapshotScript, + updateSnapshotScriptContents, + } = config + try { logInfo('Generating snapshot %o', { nodeModulesOnly, @@ -68,6 +79,8 @@ export async function installSnapshot ( resolverMap, minify, integrityCheckSource, + useExistingSnapshotScript, + updateSnapshotScriptContents, }) await snapshotGenerator.createScript() diff --git a/yarn.lock b/yarn.lock index f3edc2f69add..f507dc107d3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14266,10 +14266,10 @@ electron-to-chromium@^1.4.477: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.480.tgz#40e32849ca50bc23ce29c1516c5adb3fddac919d" integrity sha512-IXTgg+bITkQv/FLP9FjX6f9KFCs5hQWeh5uNSKxB9mqYj/JXhHDbu+ekS43LVvbkL3eW6/oZy4+r9Om6lan1Uw== -electron@25.8.4: - version "25.8.4" - resolved "https://registry.yarnpkg.com/electron/-/electron-25.8.4.tgz#b50877aac7d96323920437baf309ad86382cb455" - integrity sha512-hUYS3RGdaa6E1UWnzeGnsdsBYOggwMMg4WGxNGvAoWtmRrr6J1BsjFW/yRq4WsJHJce2HdzQXtz4OGXV6yUCLg== +electron@27.1.3: + version "27.1.3" + resolved "https://registry.yarnpkg.com/electron/-/electron-27.1.3.tgz#3fd6decda95c1dd0a7e51a9ac77ee0ba37b7c5c6" + integrity sha512-7eD8VMhhlL5J531OOawn00eMthUkX1e3qN5Nqd7eMK8bg5HxQBrn8bdPlvUEnCano9KhrVwaDnGeuzWoDOGpjQ== dependencies: "@electron/get" "^2.0.0" "@types/node" "^18.11.18"