-
Notifications
You must be signed in to change notification settings - Fork 39
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
Error in auto merge using Cypress flag --config-file #134
Comments
I think I made it works, but I had to re-cofigure the registerReportPortalPlugin() in custom env file. The initial setup on base config file (cypress.config.js) not persisted. Looking anothers plugins it not seens a default way to manage plugins when the project uses custom config files, the configs persisting from the base config file. |
I found other issue about this error. It also happen when the first spec file to be executed by Cypress start without tests or it just has one test. |
Hi @notfounnd do you still have the custom env file which you mentioned? i'm facing the same error. |
You can check below a complete example. If you copy this, pay attention about the dependencies. run command example yarn cypress run --config-file ./cypress/environments/debug.config.js cypress.config.js (base config file - location: ./) /// <reference types="cypress" />
const { defineConfig } = require('cypress')
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin')
const defaultConfig = {
e2e: {
setupNodeEvents (on, config) {
// setup @cypress/grep plugin
// https://github.com/cypress-io/cypress/tree/develop/npm/grep
require('@cypress/grep/src/plugin')(config)
// setup report portal plugin
// https://github.com/reportportal/agent-js-cypress
return registerReportPortalPlugin(on, config)
},
chromeWebSecurity: false,
defaultCommandTimeout: 45000,
requestTimeout: 45000,
responseTimeout: 45000,
viewportWidth: 1366,
viewportHeight: 768,
screenshotsFolder: 'cypress/reports/screenshots',
videosFolder: 'cypress/reports/videos',
video: false,
retries: {
runMode: 2,
openMode: 0
},
env: {
grepFilterSpecs: true,
grepOmitFiltered: true,
hideXhr: false
},
reporter: 'cypress-multi-reporters',
reporterOptions: {
reporterEnabled: ['mochawesome'],
mochawesomeReporterOptions: {
reportDir: './cypress/reports/mocha',
quite: true,
overwrite: false,
html: false,
json: true
}
}
}
}
module.exports = defineConfig(defaultConfig) test.config.js (env config file - location: ./cypress/environments) /// <reference types="cypress" />
const { defineConfig } = require('cypress')
const { defu } = require('defu') // yarn add -D defu
const { setupReportPortalConfig } = require('../../helpers/setup-report-portal')
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin')
// setup environment config file
// https://github.com/cypress-io/cypress/discussions/22517
const defaultConfig = require('../../cypress.config')
const environmentConfig = {
e2e: {
setupNodeEvents (on, config) {
// implement node event listeners here
return registerReportPortalPlugin(on, config)
},
baseUrl: 'https://example.cypress.io/',
env: {
environment: 'debug',
exampleUrl: 'https://swapi.dev/',
serviceUrl: 'https://swapi.dev/api/',
exampleKey: 'Key Value',
customValue: 5000
},
reporterOptions: {
reporterEnabled: ['@reportportal/agent-js-cypress'],
reportportalAgentJsCypressReporterOptions: {
endpoint: 'https://reportportal.xxxxxxxxxxxxxxxxx.com/api/v1',
token: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
launch: 'LAUNCH_NAME_EXAMPLE',
project: 'demo_project',
description: 'DESCRIPTION_LAUNCH_EXAMPLE',
autoMerge: true,
restClientConfig: {
timeout: 300000
},
attributes: [
{ value: 'e2e' },
{ value: 'default' }
]
}
}
}
}
// setup report portal configuration
// this is a helper used to setup RP configuration
// firstly you can remove this and use hard code setup on this file
const setupConfig = setupReportPortalConfig(environmentConfig)
console.log('-----------------------------------')
console.log('setup configuration:')
console.log('+ %s', setupConfig.e2e.env.environment)
console.log('-----------------------------------')
module.exports = defineConfig(defu(setupConfig, defaultConfig)) |
|
Hi everyone.
I'm migrating my project to Cypress 10 and when I setup the project to use a custom config file I get the following error:
In my custom config file I get the general configs from cypress.config.js and merge it with custom configs from my test.config.js.
When I not set the custom config file, it works ok.
Project settings:
Package scritp:
I also tryed without the cypress-grep and I getted the same error.
cypress.config.js
test.config.js
The text was updated successfully, but these errors were encountered: