cypress: Config settings is not overwritten when use cli command

Current behavior

Config settings is not overwritten when use cli command. npx cypress run --config videosFolder='vids',screenshotsFolder='pics'

(Screenshots)

  • C:\foo\cypress\screenshots\foo.cy.ts\bar (failed).png (1280x720)

(Video)

  • Started processing: Compressing to 32 CRF
  • Finished processing: C:\foo\cypress\videos\foo.cy.ts.mp4 (2 seconds)

Desired behavior

Used folders should be vids and pics instead.

(Screenshots)

  • C:\foo\cypress\pics\foo.cy.ts\bar (failed).png (1280x720)

(Video)

  • Started processing: Compressing to 32 CRF
  • Finished processing: C:\foo\cypress\vids\foo.cy.ts.mp4 (2 seconds)

Test code to reproduce

npx cypress run --config videosFolder='pics',screenshotsFolder='vids'

cypress.config.ts

import { defineConfig } from 'cypress';

export default defineConfig({
	e2e: {
		screenshotsFolder: 'screenshots',
		videosFolder: 'videos'
	}
});

Cypress Version

10.1

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

I ran into this bug and commented on my experience here: https://github.com/cypress-io/cypress/issues/28332#issue-1993243797

Hi @szykov, I’ve been away for 1 month, but now I am back in action. Regarding this bug: has not been fixed yet. Is this something you’d like to try patching? If so, happy to link you some places in the code base to look at.

Also - any specific use case? I’m asking since there might be another way to work around it. Since cypress.config is a JS module now, you can do something like

export default defineConfig({
  e2e: {
    videosFolder: process.env.FOO === "BAR" ? "some_folder" : "another_folder"
  }
})

Not a fix, but a good work around until there is a fix.

A little late but I did look into this and confirm it’s definitely a bug in how we are resolving configuration precedence. Seems like a regression. We will fix this soon.

Hey, thanks for the bug report - I’ll look into this one for you, first thing next week.