We will make two improvements to support runner specific configuration.
Add support for runner specific overrides in cypress.json. Like this:
// cypress.json
{
// defaults
video: true,
// added this e2e key
e2e: {
video: false // override!
},
// added component
component: {
viewportWidth: 500 // video is true - inherited.
}
}
Check if mode (either e2e or component) is already available in config. If not, add a third argument, mode.
// cypress/plugins/index.js
// adding third argument, mode. It can be either `component` or `e2e`.
module.exports = (on, { testingType, ...rest }) => {
if (testingType === 'component') {
// start webpack-dev-server, etc.
}
if (testingType === 'e2e') {
// e2e things
}
// this is how plugins work already. You need to return a config file.
return {...rest}
}
testingType available in the browser on window.Cypress.testingType or window.Cypress.testingType.Cypress.config. Same pattern as browser, platform, arch.This is optional, not required for 7.0. Good to have if it's easy or along the way, though.