You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When cypress.json has an invalid value we show a good error message during cypress open. For example, an invalid viewportWidth
{
"viewportWidth": "foo"
}
leads to
and during cypress run shows the error
We found an invalid value in the file: `cypress.json`
Expected `viewportWidth` to be a number. Instead the value was: `"foo"`
But if we return invalid viewportWidth from file cypress/integration/plugins.js like this
module.exports=(on,config)=>{// `on` is used to hook into various events Cypress emits// `config` is the resolved Cypress configreturn{viewportWidth: 'foo'}}
The cypress open is happy, yet the browser shows NaN
and in this simple test cypress run finishes.
Using invalid baseUrl returned from plugins file breaks cypress run
module.exports=(on,config)=>{// `on` is used to hook into various events Cypress emits// `config` is the resolved Cypress configreturn{viewportWidth: 'foo',baseUrl: 123}}
$ npm run dev -- --run-project ~/git/cypress-test-tiny/
> [email protected] dev /Users/gleb/git/cypress
> node ./scripts/start.js "--run-project" "/Users/gleb/git/cypress-test-tiny/"
TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type number
at validateString (internal/validators.js:105:11)
at Url.parse (url.js:154:3)
at Object.urlParse [as parse] (url.js:149:13)
at Object.exports.isListening (/Users/gleb/git/cypress/packages/server/lib/util/ensure-url.ts:50:18)
at run (/Users/gleb/git/cypress/packages/server/lib/util/ensure-url.ts:29:24)
at Object.exports.retryIsListening (/Users/gleb/git/cypress/packages/server/lib/util/ensure-url.ts:46:12)
at Server._retryBaseUrlCheck (/Users/gleb/git/cypress/packages/server/lib/server.coffee:615:15)
at /Users/gleb/git/cypress/packages/server/lib/server.coffee:246:23
Goal
Validate the configuration object returned from the plugins file the same way as we validate object loaded from cypress.json
The text was updated successfully, but these errors were encountered:
The code for this is done in cypress-io/cypress#5068, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Cypress v3.6.1
Example in https://github.com/cypress-io/cypress-test-tiny/tree/return-invalid-value-from-plugins
When
cypress.json
has an invalid value we show a good error message duringcypress open
. For example, an invalidviewportWidth
leads to
and during
cypress run
shows the errorBut if we return invalid
viewportWidth
from filecypress/integration/plugins.js
like thisThe
cypress open
is happy, yet the browser shows NaNand in this simple test
cypress run
finishes.Using invalid
baseUrl
returned from plugins file breaks cypress runGoal
Validate the configuration object returned from the plugins file the same way as we validate object loaded from
cypress.json
The text was updated successfully, but these errors were encountered: