Skip to content

Commit

Permalink
feat: error when updating a 9.X value in 10.X in the pluginsFile (#20521
Browse files Browse the repository at this point in the history
)
  • Loading branch information
elevatebart committed Mar 24, 2022
1 parent a5a9d2e commit 1de1aa5
Show file tree
Hide file tree
Showing 32 changed files with 333 additions and 226 deletions.
6 changes: 0 additions & 6 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2697,12 +2697,6 @@ declare namespace Cypress {
* @default "cypress/fixtures"
*/
fixturesFolder: string | false
/**
* Path to folder containing integration test files
* @default "cypress/integration"
* @deprecated
*/
integrationFolder: string
/**
* Path to folder where files downloaded during a test are saved
* @default "cypress/downloads"
Expand Down
10 changes: 6 additions & 4 deletions npm/webpack-preprocessor/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
'integrationFolder': 'cypress/tests',
'e2e': {
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
specPattern: 'cypress/tests/**/*',
setupNodeEvents (on, config) {
const webpackPreprocessor = require('./index')

Expand All @@ -9,4 +11,4 @@ module.exports = {
return config
},
},
}
})
6 changes: 4 additions & 2 deletions packages/config/__snapshots__/index.spec.ts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
exports['src/index .getBreakingKeys returns list of breaking config keys 1'] = [
"blacklistHosts",
"componentFolder",
"integrationFolder",
"testFiles",
"ignoreTestFiles",
"experimentalComponentTesting",
"experimentalGetCookiesSameSite",
"experimentalNetworkStubbing",
Expand All @@ -10,8 +13,7 @@ exports['src/index .getBreakingKeys returns list of breaking config keys 1'] = [
"firefoxGcInterval",
"nodeVersion",
"nodeVersion",
"pluginsFile",
"testFiles"
"pluginsFile"
]

exports['src/index .getDefaultValues returns list of public config keys 1'] = {
Expand Down
184 changes: 92 additions & 92 deletions packages/config/__snapshots__/validation.spec.ts.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
exports['undefined browsers'] = `
Missing browsers list
`
exports['src/validation .isValidClientCertificatesSet returns error message for certs not passed as an array array 1'] = {
"key": "mockConfigKey",
"value": "1",
"type": "a positive number or null or an object with keys \"openMode\" and \"runMode\" with values of numbers or nulls"
}

exports['empty list of browsers'] = `
Expected at least one browser
`
exports['src/validation .isValidClientCertificatesSet returns error message for certs object without url 1'] = {
"key": "clientCertificates[0].url",
"type": "a URL matcher"
}

exports['browsers list with a string'] = {
"key": "name",
"value": "foo",
"type": "a non-empty string",
"list": "browsers"
exports['missing https protocol'] = {
"key": "clientCertificates[0].url",
"value": "http://url.com",
"type": "an https protocol"
}

exports['invalid url'] = {
"key": "clientCertificates[0].url",
"value": "not *",
"type": "a valid URL"
}

exports['src/validation .isValidBrowser passes valid browsers and forms error messages for invalid ones isValidBrowser 1'] = {
Expand Down Expand Up @@ -82,46 +90,63 @@ exports['src/validation .isValidBrowser passes valid browsers and forms error me
]
}

exports['not one of the strings error message'] = {
"key": "test",
"value": "nope",
"type": "one of these values: \"foo\", \"bar\""
exports['undefined browsers'] = `
Missing browsers list
`

exports['empty list of browsers'] = `
Expected at least one browser
`

exports['browsers list with a string'] = {
"key": "name",
"value": "foo",
"type": "a non-empty string",
"list": "browsers"
}

exports['number instead of string'] = {
"key": "test",
"value": 42,
"type": "one of these values: \"foo\", \"bar\""
exports['invalid retry value'] = {
"key": "mockConfigKey",
"value": "1",
"type": "a positive number or null or an object with keys \"openMode\" and \"runMode\" with values of numbers or nulls"
}

exports['null instead of string'] = {
"key": "test",
"value": null,
"type": "one of these values: \"foo\", \"bar\""
exports['invalid retry object'] = {
"key": "mockConfigKey",
"value": {
"fakeMode": 1
},
"type": "a positive number or null or an object with keys \"openMode\" and \"runMode\" with values of numbers or nulls"
}

exports['not one of the numbers error message'] = {
"key": "test",
"value": 4,
"type": "one of these values: 1, 2, 3"
exports['src/validation .isPlainObject returns error message when value is a not an object 1'] = {
"key": "mockConfigKey",
"value": 1,
"type": "a plain object"
}

exports['string instead of a number'] = {
"key": "test",
"value": "foo",
"type": "one of these values: 1, 2, 3"
exports['src/validation .isNumber returns error message when value is a not a number 1'] = {
"key": "mockConfigKey",
"value": "string",
"type": "a number"
}

exports['null instead of a number'] = {
"key": "test",
exports['src/validation .isNumberOrFalse returns error message when value is a not number or false 1'] = {
"key": "mockConfigKey",
"value": null,
"type": "one of these values: 1, 2, 3"
"type": "a number or false"
}

exports['src/validation .isStringOrFalse returns error message when value is neither string nor false 1'] = {
exports['not qualified url'] = {
"key": "mockConfigKey",
"value": null,
"type": "a string or false"
"value": "url.com",
"type": "a fully qualified URL (starting with `http://` or `https://`)"
}

exports['empty string'] = {
"key": "mockConfigKey",
"value": "",
"type": "a fully qualified URL (starting with `http://` or `https://`)"
}

exports['src/validation .isBoolean returns error message when value is a not a string 1'] = {
Expand All @@ -142,6 +167,12 @@ exports['src/validation .isArray returns error message when value is a non-array
"type": "an array"
}

exports['src/validation .isStringOrFalse returns error message when value is neither string nor false 1'] = {
"key": "mockConfigKey",
"value": null,
"type": "a string or false"
}

exports['not string or array'] = {
"key": "mockConfigKey",
"value": null,
Expand All @@ -158,69 +189,38 @@ exports['array of non-strings'] = {
"type": "a string or an array of strings"
}

exports['src/validation .isNumberOrFalse returns error message when value is a not number or false 1'] = {
"key": "mockConfigKey",
"value": null,
"type": "a number or false"
}

exports['src/validation .isPlainObject returns error message when value is a not an object 1'] = {
"key": "mockConfigKey",
"value": 1,
"type": "a plain object"
}

exports['src/validation .isNumber returns error message when value is a not a number 1'] = {
"key": "mockConfigKey",
"value": "string",
"type": "a number"
}

exports['invalid retry value'] = {
"key": "mockConfigKey",
"value": "1",
"type": "a positive number or null or an object with keys \"openMode\" and \"runMode\" with values of numbers or nulls"
}

exports['invalid retry object'] = {
"key": "mockConfigKey",
"value": {
"fakeMode": 1
},
"type": "a positive number or null or an object with keys \"openMode\" and \"runMode\" with values of numbers or nulls"
}

exports['src/validation .isValidClientCertificatesSet returns error message for certs not passed as an array array 1'] = {
"key": "mockConfigKey",
"value": "1",
"type": "a positive number or null or an object with keys \"openMode\" and \"runMode\" with values of numbers or nulls"
exports['not one of the strings error message'] = {
"key": "test",
"value": "nope",
"type": "one of these values: \"foo\", \"bar\""
}

exports['src/validation .isValidClientCertificatesSet returns error message for certs object without url 1'] = {
"key": "clientCertificates[0].url",
"type": "a URL matcher"
exports['number instead of string'] = {
"key": "test",
"value": 42,
"type": "one of these values: \"foo\", \"bar\""
}

exports['missing https protocol'] = {
"key": "clientCertificates[0].url",
"value": "http://url.com",
"type": "an https protocol"
exports['null instead of string'] = {
"key": "test",
"value": null,
"type": "one of these values: \"foo\", \"bar\""
}

exports['invalid url'] = {
"key": "clientCertificates[0].url",
"value": "not *",
"type": "a valid URL"
exports['not one of the numbers error message'] = {
"key": "test",
"value": 4,
"type": "one of these values: 1, 2, 3"
}

exports['not qualified url'] = {
"key": "mockConfigKey",
"value": "url.com",
"type": "a fully qualified URL (starting with `http://` or `https://`)"
exports['string instead of a number'] = {
"key": "test",
"value": "foo",
"type": "one of these values: 1, 2, 3"
}

exports['empty string'] = {
"key": "mockConfigKey",
"value": "",
"type": "a fully qualified URL (starting with `http://` or `https://`)"
exports['null instead of a number'] = {
"key": "test",
"value": null,
"type": "one of these values: 1, 2, 3"
}
1 change: 1 addition & 0 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@packages/root": "0.0.0-development",
"@packages/ts": "0.0.0-development",
"@packages/types": "0.0.0-development",
"@types/mocha": "9.1.0",
"chai": "4.2.0",
"mocha": "7.0.1"
},
Expand Down
19 changes: 15 additions & 4 deletions packages/config/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import pkg from '@packages/root'

export type BreakingOptionErrorKey =
| 'COMPONENT_FOLDER_REMOVED'
| 'INTEGRATION_FOLDER_REMOVED'
| 'CONFIG_FILE_INVALID_ROOT_CONFIG'
| 'CONFIG_FILE_INVALID_ROOT_CONFIG_E2E'
| 'CONFIG_FILE_INVALID_TESTING_TYPE_CONFIG_COMPONENT'
Expand Down Expand Up @@ -544,6 +545,20 @@ export const breakingOptions: Array<BreakingOption> = [
name: 'componentFolder',
errorKey: 'COMPONENT_FOLDER_REMOVED',
isWarning: false,
}, {
name: 'integrationFolder',
errorKey: 'INTEGRATION_FOLDER_REMOVED',
isWarning: false,
}, {
name: 'testFiles',
errorKey: 'TEST_FILES_RENAMED',
newName: 'specPattern',
isWarning: false,
}, {
name: 'ignoreTestFiles',
errorKey: 'TEST_FILES_RENAMED',
newName: 'excludeSpecPattern',
isWarning: false,
}, {
name: 'experimentalComponentTesting',
errorKey: 'EXPERIMENTAL_COMPONENT_TESTING_REMOVED',
Expand Down Expand Up @@ -586,10 +601,6 @@ export const breakingOptions: Array<BreakingOption> = [
}, {
name: 'pluginsFile',
errorKey: 'PLUGINS_FILE_CONFIG_OPTION_REMOVED',
}, {
name: 'testFiles',
errorKey: 'TEST_FILES_RENAMED',
isWarning: false,
},
]

Expand Down
3 changes: 1 addition & 2 deletions packages/config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"src/*.ts"
],
"exclude": [
"test",
"script"
"test"
],
"compilerOptions": {
"strict": true,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 comments on commit 1de1aa5

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1de1aa5 Mar 24, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.0.0/linux-x64/10.0-release-1de1aa5ccc2989d9a22e4e6ba88573a2c5c392e1/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1de1aa5 Mar 24, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.0.0/darwin-x64/10.0-release-1de1aa5ccc2989d9a22e4e6ba88573a2c5c392e1/cypress.tgz

Please sign in to comment.