Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: Remove deprecated nodeVersion configuration option #27059

Merged
merged 4 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We could still end up using 'bundled' if user node isn't found.

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) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This error was dead code

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