Skip to content

Commit

Permalink
breaking: Remove deprecated nodeVersion configuration option (#27059)
Browse files Browse the repository at this point in the history
* feat: breaking remove nodeVersion option

* changelog, ts fix

* Apply suggestions from code review

Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>

---------

Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
  • Loading branch information
mjhenkes and MikeMcC399 authored Jun 16, 2023
1 parent 48b7603 commit 5f93282
Show file tree
Hide file tree
Showing 19 changed files with 9 additions and 408 deletions.
2 changes: 2 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ _Released 08/1/2023 (PENDING)_

- The [`cy.readFile()`](/api/commands/readfile) command is now retry-able as a [query command](https://on.cypress.io/retry-ability). This should not affect any tests using it; the functionality is unchanged. However, it can no longer be overwritten using [`Cypress.Commands.overwrite()`](/api/cypress-api/custom-commands#Overwrite-Existing-Commands). Addressed in [#25595](https://github.com/cypress-io/cypress/pull/25595).

- The deprecated configuration option, `nodeVersion` has been removed. Addresses [#27016](https://github.com/cypress-io/cypress/issues/27016).

## 12.15.0

_Released 06/20/2023 (PENDING)_
Expand Down
7 changes: 1 addition & 6 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2932,18 +2932,13 @@ declare namespace Cypress {
* @default "cypress/downloads"
*/
downloadsFolder: string
/**
* If set to `system`, Cypress will try to find a `node` executable on your path to use when executing your plugins. Otherwise, Cypress will use the Node version bundled with Cypress.
* @default "bundled"
*/
nodeVersion: 'system' | 'bundled'
/**
* The application under test cannot redirect more than this limit.
* @default 20
*/
redirectionLimit: number
/**
* If `nodeVersion === 'system'` and a `node` executable is found, this will be the full filesystem path to that executable.
* If a `node` executable is found, this will be the full filesystem path to that executable.
* @default null
*/
resolvedNodePath: string
Expand Down
1 change: 1 addition & 0 deletions npm/webpack-dev-server/src/helpers/nextHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ function checkSWC (

// "resolvedNodePath" is only set when using the user's Node.js, which is required to compile Next.js with SWC optimizations
// If it is not set, they have either explicitly set "nodeVersion" to "bundled" or are are using Cypress < 9.0.0 where it was set to "bundled" by default
// @ts-expect-error nodeVersion has been removed as of 13.0.0 however this plugin can be used with many versions of cypress
if (hasSWCLoader && cypressConfig.nodeVersion === 'bundled') {
throw new Error(`Cypress cannot compile your Next.js application when "nodeVersion" is set to "bundled". Please remove this option from your Cypress configuration file.`)
}
Expand Down
3 changes: 0 additions & 3 deletions packages/config/__snapshots__/index.spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ exports['config/src/index .getBreakingKeys returns list of breaking config keys
'firefoxGcInterval',
'ignoreTestFiles',
'integrationFolder',
'nodeVersion',
'nodeVersion',
'pluginsFile',
'testFiles',
]
Expand Down Expand Up @@ -223,7 +221,6 @@ exports['config/src/index .getPublicConfigKeys returns list of public config key
'includeShadowDom',
'keystrokeDelay',
'modifyObstructiveCode',
'nodeVersion',
'numTestsKeptInMemory',
'platform',
'pageLoadTimeout',
Expand Down
15 changes: 0 additions & 15 deletions packages/config/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const BREAKING_OPTION_ERROR_KEY: Readonly<AllCypressErrorNames[]> = [
'EXPERIMENTAL_SINGLE_TAB_RUN_MODE',
'EXPERIMENTAL_SHADOW_DOM_REMOVED',
'FIREFOX_GC_INTERVAL_REMOVED',
'NODE_VERSION_DEPRECATION_SYSTEM',
'NODE_VERSION_DEPRECATION_BUNDLED',
'PLUGINS_FILE_CONFIG_OPTION_REMOVED',
'RENAMED_CONFIG_OPTION',
'TEST_FILES_RENAMED',
Expand Down Expand Up @@ -294,9 +292,6 @@ const driverConfigOptions: Array<DriverConfigOption> = [
defaultValue: true,
validation: validate.isBoolean,
requireRestartOnChange: 'server',
}, {
name: 'nodeVersion',
validation: validate.isOneOf('bundled', 'system'),
}, {
name: 'numTestsKeptInMemory',
defaultValue: 50,
Expand Down Expand Up @@ -632,16 +627,6 @@ export const breakingOptions: Readonly<BreakingOption[]> = [
name: 'integrationFolder',
errorKey: 'INTEGRATION_FOLDER_REMOVED',
isWarning: false,
}, {
name: 'nodeVersion',
value: 'system',
errorKey: 'NODE_VERSION_DEPRECATION_SYSTEM',
isWarning: true,
}, {
name: 'nodeVersion',
value: 'bundled',
errorKey: 'NODE_VERSION_DEPRECATION_BUNDLED',
isWarning: true,
}, {
name: 'pluginsFile',
errorKey: 'PLUGINS_FILE_CONFIG_OPTION_REMOVED',
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/project/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ const convertRelativeToAbsolutePaths = (projectRoot: string, obj: Config) => {
// instead of the built-in Node process, specify a path to 3rd party Node
export const setNodeBinary = (obj: Config, userNodePath?: string, userNodeVersion?: string) => {
// if execPath isn't found we weren't executed from the CLI and should used the bundled node version.
if (userNodePath && userNodeVersion && obj.nodeVersion !== 'bundled') {
if (userNodePath && userNodeVersion) {
obj.resolvedNodePath = userNodePath
obj.resolvedNodeVersion = userNodeVersion

Expand Down
25 changes: 3 additions & 22 deletions packages/config/test/project/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,47 +409,30 @@ describe('config/src/project/utils', () => {
this.nodeVersion = process.versions.node
})

it('sets bundled Node ver if nodeVersion != system', function () {
it('sets cli Node ver', function () {
const obj = setNodeBinary({
nodeVersion: 'bundled',
})

expect(obj).to.deep.eq({
nodeVersion: 'bundled',
resolvedNodeVersion: this.nodeVersion,
})
})

it('sets cli Node ver if nodeVersion = system', function () {
const obj = setNodeBinary({
nodeVersion: 'system',
}, '/foo/bar/node', '1.2.3')

expect(obj).to.deep.eq({
nodeVersion: 'system',
resolvedNodeVersion: '1.2.3',
resolvedNodePath: '/foo/bar/node',
})
})

it('sets bundled Node ver and if nodeVersion = system and userNodePath undefined', function () {
it('sets userNodePath undefined', function () {
const obj = setNodeBinary({
nodeVersion: 'system',
}, undefined, '1.2.3')

expect(obj).to.deep.eq({
nodeVersion: 'system',
resolvedNodeVersion: this.nodeVersion,
})
})

it('sets bundled Node ver and if nodeVersion = system and userNodeVersion undefined', function () {
it('sets userNodeVersion undefined', function () {
const obj = setNodeBinary({
nodeVersion: 'system',
}, '/foo/bar/node')

expect(obj).to.deep.eq({
nodeVersion: 'system',
resolvedNodeVersion: this.nodeVersion,
})
})
Expand Down Expand Up @@ -1070,7 +1053,6 @@ describe('config/src/project/utils', () => {
isInteractive: { value: true, from: 'default' },
keystrokeDelay: { value: 0, from: 'default' },
modifyObstructiveCode: { value: true, from: 'default' },
nodeVersion: { value: undefined, from: 'default' },
numTestsKeptInMemory: { value: 50, from: 'default' },
pageLoadTimeout: { value: 60000, from: 'default' },
platform: { value: os.platform(), from: 'default' },
Expand Down Expand Up @@ -1189,7 +1171,6 @@ describe('config/src/project/utils', () => {
isInteractive: { value: true, from: 'default' },
keystrokeDelay: { value: 0, from: 'default' },
modifyObstructiveCode: { value: true, from: 'default' },
nodeVersion: { value: undefined, from: 'default' },
numTestsKeptInMemory: { value: 50, from: 'default' },
pageLoadTimeout: { value: 60000, from: 'default' },
platform: { value: os.platform(), from: 'default' },
Expand Down
42 changes: 0 additions & 42 deletions packages/errors/__snapshot-html__/COULD_NOT_FIND_SYSTEM_NODE.html

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions packages/errors/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1022,14 +1022,6 @@ export const AllCypressErrors = {
Please verify that this is the path to a valid, unpacked WebExtension.`
},
COULD_NOT_FIND_SYSTEM_NODE: (nodeVersion: string) => {
return errTemplate`\
${fmt.highlight(`nodeVersion`)} is set to ${fmt.highlightTertiary(`system`)} but Cypress could not find a usable Node executable on your ${fmt.highlightSecondary(`PATH`)}.
Make sure that your Node executable exists and can be run by the current user.
Cypress will use the built-in Node version ${fmt.highlightSecondary(nodeVersion)} instead.`
},
INVALID_CYPRESS_INTERNAL_ENV: (val: string) => {
return errTemplate`\
We have detected an unknown or unsupported ${fmt.highlightSecondary(`CYPRESS_INTERNAL_ENV`)} value: ${fmt.highlight(val)}
Expand Down Expand Up @@ -1299,28 +1291,6 @@ export const AllCypressErrors = {
UNSUPPORTED_BROWSER_VERSION: (errorMsg: string) => {
return errTemplate`${fmt.off(errorMsg)}`
},
NODE_VERSION_DEPRECATION_SYSTEM: (arg1: {name: string, value: any, configFile: string}) => {
return errTemplate`\
Deprecation Warning: ${fmt.highlight(arg1.name)} is currently set to ${fmt.highlightSecondary(arg1.value)} in the ${fmt.highlightTertiary(arg1.configFile)} configuration file.
As of ${fmt.cypressVersion(`9.0.0`)} the default behavior of ${fmt.highlight(arg1.name)} has changed to always use the version of Node used to start cypress via the cli.
Please remove the ${fmt.highlight(arg1.name)} configuration option from ${fmt.highlightTertiary(arg1.configFile)}.
`
},

// TODO: does this need to change since its a warning?
NODE_VERSION_DEPRECATION_BUNDLED: (arg1: {name: string, value: any, configFile: string}) => {
return errTemplate`\
Deprecation Warning: ${fmt.highlight(arg1.name)} is currently set to ${fmt.highlightSecondary(arg1.value)} in the ${fmt.highlightTertiary(arg1.configFile)} configuration file.
As of ${fmt.cypressVersion(`9.0.0`)} the default behavior of ${fmt.highlight(arg1.name)} has changed to always use the version of Node used to start cypress via the cli.
When ${fmt.highlight(arg1.name)} is set to ${fmt.highlightSecondary(arg1.value)}, Cypress will use the version of Node bundled with electron. This can cause problems running certain plugins or integrations.
As the ${fmt.highlight(arg1.name)} configuration option will be removed in a future release, it is recommended to remove the ${fmt.highlight(arg1.name)} configuration option from ${fmt.highlightTertiary(arg1.configFile)}.
`
},

// V10 Added:

Expand Down
15 changes: 0 additions & 15 deletions packages/errors/test/unit/visualSnapshotErrors_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -984,11 +984,6 @@ describe('visual error templates', () => {
default: ['Electron', '/path/to/extension'],
}
},
COULD_NOT_FIND_SYSTEM_NODE: () => {
return {
default: ['16.2.1'],
}
},
INVALID_CYPRESS_INTERNAL_ENV: () => {
return {
default: ['foo'],
Expand Down Expand Up @@ -1098,16 +1093,6 @@ describe('visual error templates', () => {
default: ['./path/to/cypress-plugin-retries'],
}
},
NODE_VERSION_DEPRECATION_BUNDLED: () => {
return {
default: [{ name: 'nodeVersion', value: 'bundled', 'configFile': 'cypress.json' }],
}
},
NODE_VERSION_DEPRECATION_SYSTEM: () => {
return {
default: [{ name: 'nodeVersion', value: 'system', 'configFile': 'cypress.json' }],
}
},
CONFIG_FILE_MIGRATION_NEEDED: () => {
return {
default: ['/path/to/projectRoot'],
Expand Down
Loading

8 comments on commit 5f93282

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/linux-arm64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/linux-x64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/darwin-arm64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/darwin-x64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/win32-x64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/linux-x64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/darwin-x64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5f93282 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.0.0/win32-x64/release/13.0.0-5f932826585f7c937cc52e8799af8b1c857f161b/cypress.tgz

Please sign in to comment.