question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypres reloads when config file is updated despite setting `watchForFileChanges: false`

See original GitHub issue

Current behavior

This is really similar to this closed issue. Cypress doesn’t watch my spec files for changes, but it does watch my configs.

Desired behavior

cypress should not watch any files for changes.

Test code to reproduce

start a test with watchForFileChanges: false and make a change to a cypress.config.js or any of it’s requirements.

Cypress Version

10.0.3

Other

my full defineConfig looks like this. though i doubt the settings are stepping over each other

...
module.exports = defineConfig({
  env: {
    // some stuff here
  },
  chromeWebSecurity: false,
  watchForFileChanges: false,
  viewportWidth: 1280,
  viewportHeight: 720,
  videoUploadOnPasses: false,
  e2e: {
    baseUrl,
    setupNodeEvents(on, config) {
      // log printer
      const log_printer_options = {
        outputRoot: config.projectRoot + "/cypress/",
        printLogsToFile: "always",
        // Used to trim the base path of specs and reduce nesting in the
        // generated output directory.
        specRoot: path.relative(config.fileServerFolder, config.specPattern.split("*")[0]),
        outputTarget: {
          "logs|txt": "txt",
        },
        // these defaults are not being handled as expected in plugin, setting explicitly until fixed upstream
        commandTrimLength: 2000,
        defaultTrimLength: 2000,
      };
      require("cypress-terminal-report/src/installLogsPrinter")(on, log_printer_options);
    },
    experimentalSessionAndOrigin: true,
  },
});

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jcom000commented, Jul 28, 2022

even if i’m not checking out. it’s still annoying to make trival changes to my config, like a comment, and then watch my test progress disappear. that’s why i opted into watchForFileChanges: false in the first place. If this is all still intended, then I guess I’d convert this ticket to a feature request for a watchForAllFileChanges option

0reactions
jcom000commented, Jul 28, 2022

Yeah just as I thought. a few issues with run --headed.

  • I lose your wonderful UI
  • I also lose the ability to click on sidebar items and interact with them through the console output
  • I have to be really fast in order to interact with a debugger statement

not a good dev experience.

One other thing. How come y’all change behavior when the config is broken? It’s like sometimes you watch for changes, and sometimes you explicitly ask for me to retry. which is it? image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress App reload in the middle of a test run if config file is ...
Current behavior I was working on updating Cypress to v10 in our project and was running some tests with 'cypress open' locally.
Read more >
Configuration - Cypress Documentation
This guide is for Cypress 10 and the new JavaScript configuration file format. ... watchForFileChanges, true, Whether Cypress will watch and restart tests ......
Read more >
Cypress - automatically run all tests in browser, with hot reload
If you run Cypress tests headlessly cypress run it runs all tests ... the global configuration option watchForFileChanges as detailed here.
Read more >
Configurations in Cypress and How to Disable Default ...
This configuration specifies whether Cypress will watch and restart tests on any runtime changes in the test files. What are the default ...
Read more >
Writing and Organizing Tests - cypress - w3resource
You can set watchForFileChanges configuration property to false to disable file watching. . Follow us on Facebook for latest updates. Exercises ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found