Skip to content
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

Cypress generates an invalid config file #22107

Closed
noelrappin opened this issue Jun 4, 2022 · 3 comments
Closed

Cypress generates an invalid config file #22107

noelrappin opened this issue Jun 4, 2022 · 3 comments
Labels
stage: awaiting response Potential fix was proposed; awaiting response v10.0.0 🐛 Issue present since 10.0.0

Comments

@noelrappin
Copy link

Current behavior

Brand new download of Cypress 10.0.2 using esbuild, converting an existing Cypress configuration. This setup did work under Cypress 9.x

The old config

{
  "screenshotsFolder": "tmp/cypress_screenshots",
  "videosFolder": "tmp/cypress_videos",
  "trashAssetsBeforeRuns": false
}

Cypress converts this to

import { defineConfig } from 'cypress'

export default defineConfig({
  screenshotsFolder: 'tmp/cypress_screenshots',
  videosFolder: 'tmp/cypress_videos',
  trashAssetsBeforeRuns: false,
})

Then cypress immediately gives me a "Your configFile is invalid: north_by_seven/cypress.config.ts"

With this stack trace:

Error: Dynamic require of "tty" is not supported
    at file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:12:9
    at node_modules/debug/src/node.js (file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:783:15)
    at __require2 (file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:15:50)
    at node_modules/debug/src/index.js (file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:957:25)
    at __require2 (file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:15:50)
    at node_modules/cypress/index.js (file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:89654:17)
    at __require2 (file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:15:50)
    at file:///Users/noel/projects/pragmatic/north_by_seven/cypress.config.bundled_1654357374176.mjs:89678:30
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async extractResult (/Users/noel/Library/Caches/Cypress/10.0.2/Cypress.app/Contents/Resources/app/node_modules/bundle-require/dist/index.cjs:185:13)
    at async loadFile (/Users/noel/Library/Caches/Cypress/10.0.2/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:120:15)
    at async EventEmitter. (/Users/noel/Library/Caches/Cypress/10.0.2/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:139:32)

I don't seem to have a cypress.config.bundled_1654357374176.mjs even though it is being referenced.

I'm not sure what's going on here, and would appreciate any help.

I've tried deleting the old config file and starting fresh, but I still get the same error.

What am I doing incorrectly?

Desired behavior

I'd expect Cypress to start normally.

Test code to reproduce

{
  "screenshotsFolder": "tmp/cypress_screenshots",
  "videosFolder": "tmp/cypress_videos",
  "trashAssetsBeforeRuns": false
}

Cypress Version

10.0.2

Other

No response

@lmiller1990 lmiller1990 added the v10.0.0 🐛 Issue present since 10.0.0 label Jun 6, 2022
@lmiller1990
Copy link
Contributor

lmiller1990 commented Jun 6, 2022

Hi! I think this is related: #22074

I have no idea why it's complaining about tty. Weird.

Are you able to create a minimal reproduction? I tried your cypress.json to a project, used the Cypress 10 migration tool, it worked as expected. I then repeated the process with "type": "module" but this worked fine, too. I must be missing something that leads to the error you are experiencing.

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Jun 6, 2022
@mjhenkes
Copy link
Member

Right now there doesn't seem to be enough information to reproduce the problem on our end. We'll have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Please open a new issue with a reproducible example and link to this issue. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

@mortik
Copy link

mortik commented Aug 14, 2022

Tried to upgrade to Cypress 10.0.0 from 9.5.3 and after conversion of my cypress.json i'm getting the same error.

my cypress.json:

{
  "baseUrl": "http://fleetyards.test",
  "fixturesFolder": "test/javascript/e2e/fixtures",
  "pluginsFolder": "test/javascript/e2e/plugins",
  "integrationFolder": "test/javascript/e2e/specs",
  "screenshotsFolder": "test/javascript/e2e/screenshots",
  "supportFile": "test/javascript/e2e/support",
  "video": false,
  "videosFolder": "test/javascript/e2e/videos",
  "videoUploadOnPasses": false,
  "videoCompression": 0,
  "viewportWidth": 2560,
  "viewportHeight": 1440,
  "defaultCommandTimeout": 10000,
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "test/reports/e2e"
  }
}

and the generated cypress.config.ts:

import { defineConfig } from 'cypress'

export default defineConfig({
  fixturesFolder: 'test/javascript/e2e/fixtures',
  screenshotsFolder: 'test/javascript/e2e/screenshots',
  pluginsFolder: 'test/javascript/e2e/plugins',
  video: false,
  videosFolder: 'test/javascript/e2e/videos',
  videoUploadOnPasses: false,
  videoCompression: 0,
  viewportWidth: 2560,
  viewportHeight: 1440,
  defaultCommandTimeout: 10000,
  reporter: 'cypress-mochawesome-reporter',
  reporterOptions: {
    reportDir: 'test/reports/e2e',
  },
  e2e: {
    baseUrl: 'http://fleetyards.test',
    specPattern: 'test/javascript/e2e/specs/**/*.{js,jsx,ts,tsx}',
    supportFile: 'test/javascript/e2e/support',
  },
})

I also tried the latest 10.x version but than the error message gets even more obscure.

Are there any depedencies i need to update or install additionally on Intel Macbook with OSX 12.4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: awaiting response Potential fix was proposed; awaiting response v10.0.0 🐛 Issue present since 10.0.0
Projects
None yet
Development

No branches or pull requests

4 participants