Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-shehane committed Dec 11, 2024
2 parents f14fd12 + 17639cb commit 2e5af1e
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 205 deletions.
3 changes: 1 addition & 2 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ 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: [ 'chore/remove_support_react_19_rc_and_min_next_15_0_4', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -152,7 +151,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" != "chore/remove_support_react_19_rc_and_min_next_15_0_4" ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "ryanm/experiment/esm" ]]; 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
Expand Down
9 changes: 9 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ _Released 12/17/2024 (PENDING)_

- Fixed an issue where targets may hang if `Network.enable` is not implemented for the target. Addresses [#29876](https://github.com/cypress-io/cypress/issues/29876).
- Updated Firefox `userChrome.css` to correctly hide the toolbox during headless mode. Addresses [#30721](https://github.com/cypress-io/cypress/issues/30721).
- Fixed an issue loading the `cypress.config.ts` file with Node.js version `22.12.0`. Addresses [#30715](https://github.com/cypress-io/cypress/issues/30715).

**Misc:**

- Removed a comment from the scaffolded `supportFile` for component tests around CommonJS syntax. Addresses [#23287](https://github.com/cypress-io/cypress/issues/23287).

**Dependency Updates:**

- Updated `chai` from `4.2.0` to `4.5.0`. Addressed in [#30737](https://github.com/cypress-io/cypress/pull/30737).

## 13.16.1

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"bluebird": "3.5.3",
"bluebird-retry": "0.11.0",
"bytenode": "1.3.7",
"chai": "4.2.0",
"chai": "4.5.0",
"chai-as-promised": "7.1.1",
"chalk": "2.4.2",
"check-dependencies": "1.1.0",
Expand Down
8 changes: 8 additions & 0 deletions packages/data-context/src/data/ProjectConfigIpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,14 @@ export class ProjectConfigIpc extends EventEmitter {
tsNodeEsmLoader = `${tsNodeEsmLoader} --no-experimental-detect-module`
}

// in nodejs 22.12.0, the --experimental-require-module option is now enabled by default.
// We need to disable it with the --no-experimental-require-module flag.
// @see https://github.com/cypress-io/cypress/issues/30715
if (this.nodeVersion && semver.gte(this.nodeVersion, '22.12.0')) {
debug(`detected node version ${this.nodeVersion}, adding --no-experimental-require-module option to child_process NODE_OPTIONS.`)
tsNodeEsmLoader = `${tsNodeEsmLoader} --no-experimental-require-module`
}

if (childOptions.env.NODE_OPTIONS) {
childOptions.env.NODE_OPTIONS += ` ${tsNodeEsmLoader}`
} else {
Expand Down
46 changes: 19 additions & 27 deletions packages/data-context/test/unit/data/ProjectConfigIpc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import childProcess from 'child_process'
import { expect } from 'chai'
import semver from 'semver'
import sinon from 'sinon'
import { scaffoldMigrationProject as scaffoldProject } from '../helper'
import { ProjectConfigIpc } from '../../../src/data/ProjectConfigIpc'
Expand Down Expand Up @@ -34,8 +35,11 @@ describe('ProjectConfigIpc', () => {
})

context('forkChildProcess', () => {
const NODE_VERSIONS = ['18.20.4', '20.17.0']
const NODE_VERSIONS_22_7_0_AND_UP = ['22.7.0', '22.11.4']
// some of these node versions may not exist, but we want to verify
// the experimental flags are correctly disabled for future versions
const NODE_VERSIONS = ['18.20.4', '20.17.0', '22.7.0', '22.11.4', '22.12.0', '22.15.0']
const experimentalDetectModuleIntroduced = '22.7.0'
const experimentalRequireModuleIntroduced = '22.12.0'

let projectConfigIpc
let forkSpy
Expand All @@ -52,10 +56,10 @@ describe('ProjectConfigIpc', () => {
})

context('typescript', () => {
[...NODE_VERSIONS, ...NODE_VERSIONS_22_7_0_AND_UP].forEach((nodeVersion) => {
[...NODE_VERSIONS].forEach((nodeVersion) => {
context(`node v${nodeVersion}`, () => {
context('ESM', () => {
it('uses the experimental module loader if ESM is being used with typescript', async () => {
it('passes the correct experimental flags if ESM is being used with typescript', async () => {
// @ts-expect-error
const projectPath = await scaffoldProject('config-cjs-and-esm/config-with-ts-module')

Expand All @@ -77,35 +81,23 @@ describe('ProjectConfigIpc', () => {
NODE_OPTIONS: sinon.match('--experimental-specifier-resolution=node --loader'),
},
}))
})

// @see https://github.com/cypress-io/cypress/issues/30084
// at time of writing, 22.11.4 is a node version that does not exist. We are using this version to test the logic for future proofing.
if (NODE_VERSIONS_22_7_0_AND_UP.includes(nodeVersion)) {
it(`additionally adds --no-experimental-detect-module for node versions 22.7.0 and up if ESM is being used with typescript`, async () => {
// @ts-expect-error
const projectPath = await scaffoldProject('config-cjs-and-esm/config-with-ts-module')

const MOCK_NODE_PATH = `/Users/foo/.nvm/versions/node/v${nodeVersion}/bin/node`
const MOCK_NODE_VERSION = nodeVersion

projectConfigIpc = new ProjectConfigIpc(
MOCK_NODE_PATH,
MOCK_NODE_VERSION,
projectPath,
'cypress.config.js',
false,
(error) => {},
() => {},
)

if (semver.gte(nodeVersion, experimentalDetectModuleIntroduced)) {
expect(forkSpy).to.have.been.calledWith(sinon.match.string, sinon.match.array, sinon.match({
env: {
NODE_OPTIONS: sinon.match('--no-experimental-detect-module'),
},
}))
})
}
}

if (semver.gte(nodeVersion, experimentalRequireModuleIntroduced)) {
expect(forkSpy).to.have.been.calledWith(sinon.match.string, sinon.match.array, sinon.match({
env: {
NODE_OPTIONS: sinon.match('--no-experimental-require-module'),
},
}))
}
})
})

context('CommonJS', () => {
Expand Down
17 changes: 0 additions & 17 deletions packages/driver/cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your other test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/guides/configuration#section-global
// ***********************************************************

// Alternatively you can use CommonJS syntax:
// require("./commands")
require('./defaults')
6 changes: 0 additions & 6 deletions packages/scaffold-config/src/supportFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ export function supportFileE2E (language: CodeLanguage['type']) {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
`
}

Expand All @@ -45,9 +42,6 @@ export function supportFileComponent (language: CodeLanguage['type'], mountModul
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
`

const exampleUse = dedent`
Expand Down
21 changes: 0 additions & 21 deletions packages/scaffold-config/test/unit/supportFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from '${mountModule}'
Cypress.Commands.add('mount', mount)
Expand Down Expand Up @@ -62,9 +59,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from '${mountModule}'
// Augment the Cypress namespace to include type definitions for
Expand Down Expand Up @@ -112,9 +106,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from '${mountModule}'
Cypress.Commands.add('mount', mount)
Expand Down Expand Up @@ -146,9 +137,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from '${mountModule}'
// Augment the Cypress namespace to include type definitions for
Expand Down Expand Up @@ -195,9 +183,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from '${mountModule}'
// Augment the Cypress namespace to include type definitions for
Expand Down Expand Up @@ -244,9 +229,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from 'cypress/svelte'
Cypress.Commands.add('mount', mount)
Expand Down Expand Up @@ -278,9 +260,6 @@ describe('supportFileComponent', () => {
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
import { mount } from 'cypress/svelte'
// Augment the Cypress namespace to include type definitions for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// https://on.cypress.io/configuration
// ***********************************************************

// Alternatively you can use CommonJS syntax:
// require('./commands')
// Import commands.js using ES2015 syntax:
import './commands'

import { mount } from 'cypress/angular'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
supportFile: false,
setupNodeEvents: async (_, config) => {
setupNodeEvents: async (_, config: Cypress.PluginConfigOptions) => {
await import('find-up')

return config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

// Import global styles
import '@/assets/main.css'

Expand Down
3 changes: 0 additions & 3 deletions system-tests/projects/no-specs-vue/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
3 changes: 0 additions & 3 deletions system-tests/projects/no-specs/cypress/support/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/react'

Cypress.Commands.add('mount', mount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@

// Import commands.js using ES2015 syntax:
import '@cypress/code-coverage/support'
// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/vue'

Cypress.Commands.add('mount', mount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
3 changes: 0 additions & 3 deletions system-tests/projects/ts-proj-4/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
// import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
3 changes: 0 additions & 3 deletions system-tests/projects/ts-proj-5/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
// import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
3 changes: 0 additions & 3 deletions system-tests/projects/ts-proj/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Loading

0 comments on commit 2e5af1e

Please sign in to comment.