cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.06k stars 3.19k forks source link

ERR_UNKNOWN_FILE_EXTENSION with Typescript config and Yarn 3 / Zero install #24209

Closed munkinugget closed 1 year ago

munkinugget commented 2 years ago

Current behavior

This project is a monorepo using Yarn 3, with PnP / zero install, with yarn workspaces. In this environment the minimum settings suggested by your documentation to configure and run cypress with Typescript fails with the following errors:

In the console:

[13636:1011/113117.714003:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
[13636:1011/113117.714036:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
[13636:1011/113117.714044:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
[13636:1011/113117.714048:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.

Within the Cypress UI (Stack trace):

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts
    at new NodeError (node:internal/errors:387:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)
    at defaultLoad (node:internal/modules/esm/load:81:20)
    at nextLoad (node:internal/modules/esm/loader:165:28)
    at load$1 (file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs:179:12)
    at nextLoad (node:internal/modules/esm/loader:165:28)
    at ESMLoader.load (node:internal/modules/esm/loader:608:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)

Desired behavior

Cypress should launch without this error.

Test code to reproduce

You will need a Node ^16 environment with Yarn installed.

Clone my repo: https://github.com/munkinugget/cypress-ts-repro

Run the yarn command once to insure everything is running ok: yarn

Run the following command in the repo directory: yarn test

It will launch cypress, and you should see the error messages in the console and in the app UI.

Cypress Version

10.9.0

Node version

16.17.0

Operating System

macOS 12.6

Debug Logs

cypress:cli:cli cli starts with arguments ["/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node","/Users/mcavana/cypress-ts-repro/.yarn/unplugged/cypress-npm-10.9.0-7807fe85fd/node_modules/cypress/bin/cypress","open"] +0ms
  cypress:cli NODE_OPTIONS=--require /Users/mcavana/cypress-ts-repro/.pnp.cjs --experimental-loader file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs +0ms
  cypress:cli:cli program parsing arguments +1ms
  cypress:cli:cli opening Cypress +1ms
  cypress:cli parsed cli options {} +260ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress +2ms
  cypress:cli Binary is executable? : true +2ms
  cypress:cli binaryDir is  /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app +0ms
  cypress:cli Reading binary package.json from: /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/package.json +0ms
  cypress:cli Found binary version 10.9.0 installed in: /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app +4ms
  cypress:cli { verified: true } +4ms
  cypress:cli is Verified ? true +2ms
  cypress:cli opening from options {"project":"/Users/mcavana/cypress-ts-repro/packages/cypress-tests"} +0ms
  cypress:cli command line arguments ["--project","/Users/mcavana/cypress-ts-repro/packages/cypress-tests"] +0ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +1ms
  cypress:cli spawn args [ '--no-sandbox', '--', '--project', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--cwd', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--userNodePath', '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', '--userNodeVersion', '16.17.0' ] { detached: false, stdio: [ 'inherit', 'inherit', 'pipe' ] } +9ms
  cypress:cli spawning Cypress with executable: /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress +1ms
  cypress:cli piping child STDERR to process STDERR +6ms
[14522:1011/114746.530551:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
[14522:1011/114746.530571:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
[14522:1011/114746.530577:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
[14522:1011/114746.530582:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
  cypress:ts registering ts-node on directory undefined +0ms
  cypress:ts Running without ts-node hook in environment "production" +84ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production/cache +0ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production/browsers +78ms
  cypress:server:cypress starting cypress with argv [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress', '--no-sandbox', '--', '--project', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--cwd', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--userNodePath', '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', '--userNodeVersion', '16.17.0' ] +0ms
  cypress:server:args argv array: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress', '--no-sandbox', '--project', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--cwd', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--userNodePath', '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', '--userNodeVersion', '16.17.0' ] +0ms
  cypress:server:args parsed argv options { options: { _: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, project: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', userNodePath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', userNodeVersion: '16.17.0' } } +1ms
  cypress:server:args argv parsed: { _: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, project: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', userNodePath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', userNodeVersion: '16.17.0', invokedFromCli: true } +2ms
  cypress:server:util:proxy found proxy environment variables { NO_PROXY: 'REDACTED,localhost,cypress,run', HTTP_PROXY: 'http://REDACTED:80', HTTPS_PROXY: 'http://REDACTED:80', no_proxy: 'REDACTED,localhost,cypress,run', http_proxy: 'http://REDACTED:80', https_proxy: 'http://REDACTED:80' } +0ms
  cypress:server:util:proxy overriding uppercase env var with lowercase { name: 'NO_PROXY' } +1ms
  cypress:server:util:proxy overriding uppercase env var with lowercase { name: 'HTTP_PROXY' } +0ms
  cypress:server:util:proxy overriding uppercase env var with lowercase { name: 'HTTPS_PROXY' } +0ms
  cypress:server:util:proxy <-loopback> not found, adding localhost to NO_PROXY +0ms
  cypress:server:util:proxy normalized proxy environment variables { NO_PROXY: 'REDACTED,localhost,cypress,run,127.0.0.1,::1,localhost', HTTP_PROXY: 'http://REDACTED:80', HTTPS_PROXY: 'http://REDACTED:80' } +0ms
  cypress:server:args options { _: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, project: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', userNodePath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', userNodeVersion: '16.17.0', invokedFromCli: true, proxyServer: 'http://REDACTED:80', proxyBypassList: 'REDACTED,localhost,cypress,run,127.0.0.1,::1,localhost', config: {} } +2ms
  cypress:server:args argv options: { _: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, project: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', userNodePath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', userNodeVersion: '16.17.0', invokedFromCli: true, proxyServer: 'http://REDACTED:80', proxyBypassList: 'REDACTED,localhost,cypress,run,127.0.0.1,::1,localhost', config: {}, projectRoot: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests' } +0ms
  cypress:server:cypress from argv [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress', '--no-sandbox', '--project', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--cwd', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--userNodePath', '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', '--userNodeVersion', '16.17.0' ] got options { _: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, project: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', userNodePath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', userNodeVersion: '16.17.0', invokedFromCli: true, proxyServer: 'http://REDACTED:80', proxyBypassList: 'REDACTED,localhost,cypress,run,127.0.0.1,::1,localhost', config: {}, projectRoot: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests' } +7ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production +40ms
  cypress:server:cypress starting in mode interactive with options { _: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, project: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', userNodePath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node', userNodeVersion: '16.17.0', invokedFromCli: true, proxyServer: 'http://REDACTED:80', proxyBypassList: 'REDACTED,localhost,cypress,run,127.0.0.1,::1,localhost', config: {}, projectRoot: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests' } +77ms
  cypress:server:cypress running Electron currently +1ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for Query.cloudLatestRunUpdateSpecData +0ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for Query.cloudProjectBySlug +0ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for Query.cloudProjectsBySlugs +0ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for Query.cloudSpecByPath +0ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for Query.cloudViewer +0ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for Query.versions +1ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for CurrentProject.cloudProject +1ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for RemoteFetchableCloudProjectResult.data +2ms
  cypress:graphql:nexusDeferIfNotLoadedPlugin Adding nexusDeferIfNotLoadedPlugin for RemoteFetchableCloudProjectSpecResult.data +0ms
  cypress:server:browsers:utils getBrowsers +0ms
  cypress:launcher:detect detecting if the following browsers are present [ { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', versionRegex: /Google Chrome (\S+)/m, binary: [ 'google-chrome', 'chrome', 'google-chrome-stable' ], minSupportedVersion: 64 }, { name: 'chromium', family: 'chromium', channel: 'stable', displayName: 'Chromium', versionRegex: /Chromium (\S+)/m, binary: [ 'chromium-browser', 'chromium' ], minSupportedVersion: 64 }, { name: 'chrome', family: 'chromium', channel: 'beta', displayName: 'Chrome Beta', versionRegex: /Google Chrome (\S+) beta/m, binary: 'google-chrome-beta', minSupportedVersion: 64 }, { name: 'chrome', family: 'chromium', channel: 'canary', displayName: 'Canary', versionRegex: /Google Chrome Canary (\S+)/m, binary: 'google-chrome-canary', minSupportedVersion: 64 }, { name: 'firefox', family: 'firefox', channel: 'stable', displayName: 'Firefox', versionRegex: /^Mozilla Firefox ([^\sab]+)$/m, binary: 'firefox', minSupportedVersion: 86, validator: [Function: validator] }, { name: 'firefox', family: 'firefox', channel: 'dev', displayName: 'Firefox Developer Edition', versionRegex: /^Mozilla Firefox (\S+b\S*)$/m, binary: [ 'firefox-developer-edition', 'firefox' ], minSupportedVersion: 86 }, { name: 'firefox', family: 'firefox', channel: 'nightly', displayName: 'Firefox Nightly', versionRegex: /^Mozilla Firefox (\S+a\S*)$/m, binary: [ 'firefox-nightly', 'firefox-trunk' ], minSupportedVersion: 86 }, { name: 'edge', family: 'chromium', channel: 'stable', displayName: 'Edge', versionRegex: /Microsoft Edge (\S+)/m, binary: [ 'edge', 'microsoft-edge' ], minSupportedVersion: 79 }, { name: 'edge', family: 'chromium', channel: 'canary', displayName: 'Edge Canary', versionRegex: /Microsoft Edge Canary (\S+)/m, binary: 'edge-canary', minSupportedVersion: 79 }, { name: 'edge', family: 'chromium', channel: 'beta', displayName: 'Edge Beta', versionRegex: /Microsoft Edge Beta (\S+)/m, binary: 'edge-beta', minSupportedVersion: 79 }, { name: 'edge', family: 'chromium', channel: 'dev', displayName: 'Edge Dev', versionRegex: /Microsoft Edge Dev (\S+)/m, binary: [ 'edge-dev', 'microsoft-edge-dev' ], minSupportedVersion: 79 } ] +0ms
  cypress:server:browsers:utils WebKit is enabled, but there was an error constructing the WebKit browser: { err: Error: Cannot find module 'playwright-webkit' Require stack: - /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/utils.js - /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/index.js - /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/util/process_profiler.js - /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/index.js - /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/index.js -     at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)     at Function.n._resolveFilename (node:electron/js2c/browser_init:245:1105)     at Function.resolve (node:internal/modules/cjs/helpers:108:19) at getWebKitBrowser (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/utils.js:155:36) at Object.getBrowsers (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/utils.js:179:9) at BrowserDataSource.machineBrowsers (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/data-context/src/sources/BrowserDataSource.js:67:45) at ProjectLifecycleManager._setCurrentProject (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/data-context/src/data/ProjectLifecycleManager.js:310:26) at new ProjectLifecycleManager (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/data-context/src/data/ProjectLifecycleManager.js:64:18) at new DataContext (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/data-context/src/DataContext.js:92:33) at makeDataContext (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/makeDataContext.js:28:17) at module.exports (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/modes/index.js:24:82) at /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/cypress.js:86:34 at tryCatcher (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23) at Function.Promise.attempt.Promise.try (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29) at Object.runElectron (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/cypress.js:72:23) at Object.startInMode (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/cypress.js:249:21) at /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/cypress.js:179:19 at tryCatcher (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18) at Promise._fulfill (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:673:18) at Promise._settlePromise (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:617:21) at Promise._settlePromise0 (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18) at Promise._fulfill (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:673:18) at Promise._settlePromise (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:617:21) at Promise._settlePromise0 (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18) at Promise._fulfill (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:673:18) at PromiseArray._resolve (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise_array.js:127:19) at PromiseArray._promiseFulfilled (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise_array.js:145:14) at Promise._settlePromise (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:609:26) at Promise._settlePromise0 (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18) at Promise._fulfill (/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:673:18) at /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/nodeback.js:42:21 at /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/node_modules/fs-extra/node_modules/universalify/index.js:22:54 { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/utils.js', '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/index.js', '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/util/process_profiler.js', '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/index.js', '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/index.js', undefined ] } } +3ms
  cypress:data-context:sources:GitDataSource config: { isRunMode: false, projectRoot: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', onError: [Function (anonymous)], onBranchChange: [Function: onBranchChange], onGitInfoChange: [Function: onGitInfoChange] } +0ms
  cypress:scaffold-config:detect Detected cypress.config.ts - using TS +0ms
  cypress:server:util:editors get user editor +0ms
  cypress:server:saved_state making saved state from /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server +0ms
  cypress:server:saved_state missing project path, looking for project here +0ms
  cypress:lifecycle:ProjectConfigIpc fork child process { CHILD_PROCESS_FILE_PATH: '/Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/require_async_child.js', configProcessArgs: [ '--projectRoot', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', '--file', '/Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts' ], childOptions: { stdio: 'pipe', cwd: '/Users/mcavana/cypress-ts-repro/packages/cypress-tests', execPath: '/Users/mcavana/.nvm/versions/node/v16.17.0/bin/node' } } +0ms
  cypress:lifecycle:ProjectConfigIpc no typescript found, just use regular Node.js +1ms
  cypress:lifecycle:ProjectConfigIpc trigger the load of the file +2ms
  cypress:server:saved_state making saved state from /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server +19ms
  cypress:server:saved_state for project path /Users/mcavana/cypress-ts-repro/packages/cypress-tests +0ms
  cypress:server:saved_state state path for project /Users/mcavana/cypress-ts-repro/packages/cypress-tests +16ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/cypress-tests-f2459a17808c57ce1786c6117081a215/state.json +1s
  cypress:server:saved_state full state path /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/cypress-tests-f2459a17808c57ce1786c6117081a215/state.json +0ms
  cypress:server:saved_state making new state file around /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/cypress-tests-f2459a17808c57ce1786c6117081a215/state.json +0ms
  cypress:server:saved_state state path for global mode +40ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +40ms
  cypress:server:saved_state full state path /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +0ms
  cypress:server:saved_state making new state file around /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +0ms
  cypress:data-context:sources:GitDataSource On current branch main +123ms
  cypress:server:windows creating electron window with options { url: 'http://localhost:53539/__launchpad/index.html', backgroundColor: 'white', width: 1200, height: 800, minWidth: 597, minHeight: 400, x: 115, y: 258, type: 'INDEX', devTools: false, trackState: { width: 'appWidth', height: 'appHeight', x: 'appX', y: 'appY', devTools: 'isAppDevToolsOpen' }, onBlur: [Function: onBlur], onFocus: [Function: onFocus], onClose: [Function: onClose], show: true, frame: true, transparent: false, webPreferences: { contextIsolation: true, partition: null, webSecurity: false, nodeIntegration: false, backgroundThrottling: false }, contextMenu: false, recordFrameRate: null, onCrashed: [Function: onCrashed], onNewWindow: [Function: onNewWindow] } +0ms
  cypress:lifecycle:child:run_require_async_child:14534 configFile: /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts +0ms
  cypress:lifecycle:child:run_require_async_child:14534 projectRoot: /Users/mcavana/cypress-ts-repro/packages/cypress-tests +1ms
  cypress:lifecycle:child:run_require_async_child:14534 try loading /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts +11ms
  cypress:lifecycle:child:run_require_async_child:14534 Loading file /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts +1ms
  cypress:lifecycle:child:run_require_async_child:14534 User is loading an ESM config file +2ms
  cypress:lifecycle:child:run_require_async_child:14534 importing esm file file:///Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts +0ms
  cypress:lifecycle:child:run_require_async_child:14534 error loading file via native Node.js module loader Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts +1ms
  cypress:lifecycle:ProjectConfigIpc error loading config {
  name: 'Error',
  message: 'Your \x1B[33mconfigFile\x1B[39m is invalid: \x1B[94m/Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\x1B[39m\n' +
    '\n' +
    'It threw an error when required, check the stack trace below:',
  stack: 'TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\n' +
    '    at new NodeError (node:internal/errors:387:5)\n' +
    '    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)\n' +
    '    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)\n' +
    '    at defaultLoad (node:internal/modules/esm/load:81:20)\n' +
    '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' +
    '    at load$1 (file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs:179:12)\n' +
    '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' +
    '    at ESMLoader.load (node:internal/modules/esm/loader:608:26)\n' +
    '    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)\n' +
    '    at new ModuleJob (node:internal/modules/esm/module_job:63:26)\n' +
    '    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)\n' +
    '    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)\n' +
    '    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)',
  type: 'CONFIG_FILE_REQUIRE_ERROR',
  details: 'TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\n' +
    '    at new NodeError (node:internal/errors:387:5)\n' +
    '    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)\n' +
    '    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)\n' +
    '    at defaultLoad (node:internal/modules/esm/load:81:20)\n' +
    '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' +
    '    at load$1 (file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs:179:12)\n' +
    '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' +
    '    at ESMLoader.load (node:internal/modules/esm/loader:608:26)\n' +
    '    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)\n' +
    '    at new ModuleJob (node:internal/modules/esm/module_job:63:26)\n' +
    '    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)\n' +
    '    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)\n' +
    '    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)',
  isCypressErr: true,
  messageMarkdown: 'Your `configFile` is invalid: `/Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts`\n' +
    '\n' +
    'It threw an error when required, check the stack trace below:',
  originalError: [Object]
} +426ms
  cypress:lifecycle:ProjectConfigManager catch { name: 'Error', message: 'Your \x1B[33mconfigFile\x1B[39m is invalid: \x1B[94m/Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\x1B[39m\n' + '\n' + 'It threw an error when required, check the stack trace below:', stack: 'TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\n' + '    at new NodeError (node:internal/errors:387:5)\n' + '    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)\n' + '    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)\n' + '    at defaultLoad (node:internal/modules/esm/load:81:20)\n' + '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' + '    at load$1 (file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs:179:12)\n' + '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' + '    at ESMLoader.load (node:internal/modules/esm/loader:608:26)\n' + '    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)\n' + '    at new ModuleJob (node:internal/modules/esm/module_job:63:26)\n' + '    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)\n' + '    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34)\n' + '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)', type: 'CONFIG_FILE_REQUIRE_ERROR', details: 'TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\n' + '    at new NodeError (node:internal/errors:387:5)\n' + '    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)\n' + '    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)\n' + '    at defaultLoad (node:internal/modules/esm/load:81:20)\n' + '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' + '    at load$1 (file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs:179:12)\n' + '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' + '    at ESMLoader.load (node:internal/modules/esm/loader:608:26)\n' + '    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)\n' + '    at new ModuleJob (node:internal/modules/esm/module_job:63:26)\n' + '    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)\n' + '    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34)\n' + '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)', isCypressErr: true, messageMarkdown: 'Your `configFile` is invalid: `/Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts`\n' + '\n' + 'It threw an error when required, check the stack trace below:', originalError: { name: 'TypeError', message: 'Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts', stack: 'TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/mcavana/cypress-ts-repro/packages/cypress-tests/cypress.config.ts\n' + '    at new NodeError (node:internal/errors:387:5)\n' + '    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)\n' + '    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)\n' + '    at defaultLoad (node:internal/modules/esm/load:81:20)\n' + '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' + '    at load$1 (file:///Users/mcavana/cypress-ts-repro/.pnp.loader.mjs:179:12)\n' + '    at nextLoad (node:internal/modules/esm/loader:165:28)\n' + '    at ESMLoader.load (node:internal/modules/esm/loader:608:26)\n' + '    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)\n' + '    at new ModuleJob (node:internal/modules/esm/module_job:63:26)\n' + '    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)\n' + '    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34)\n' + '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)', code: 'ERR_UNKNOWN_FILE_EXTENSION' } } +0ms
  cypress:server:util:editors user has the following editors: [ { id: 'vim', binary: 'vim', name: 'Vim' } ] +452ms
  cypress:server:saved_state making saved state from /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server +377ms
  cypress:server:saved_state missing project path, looking for project here +0ms
  cypress:server:saved_state state path for global mode +28ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +405ms
  cypress:server:saved_state full state path /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +0ms
  cypress:server:util:editors saved preferred editor: undefined +49ms
  cypress:server:util:editors return available editors: [ { id: 'computer', name: 'Finder', binary: 'computer' }, { id: 'vim', name: 'Vim', binary: 'vim' } ] +0ms
  cypress:server:saved_state making saved state from /Users/mcavana/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server +26ms
  cypress:server:saved_state missing project path, looking for project here +0ms
  cypress:server:saved_state state path for global mode +20ms
  cypress:server:appdata path: /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +46ms
  cypress:server:saved_state full state path /Users/mcavana/Library/Application Support/Cypress/cy/production/projects/__global__/state.json +1ms
  cypress:server:browsers:utils found browsers { browsers: [ { name: 'firefox', family: 'firefox', channel: 'stable', displayName: 'Firefox', version: '102.3.0', path: '/Applications/Firefox.app/Contents/MacOS/firefox', minSupportedVersion: 86, majorVersion: '102' } ] } +597ms

Other

I've been troubleshooting this issue for a while now and can't seem to move past this. I'm trying to move my project to Yarn PnP and zero installs, and this is the last hangup. Any help or insight would be greatly appreciated.

amehta265 commented 2 years ago

@munkinugget Thank you for posting this issue and attaching a reproducible project.

After cloning your project and following your setup instructions, I was able to obtain the same error as you posted. Upon further investigation, it seems like the packages/cypress-tests folder contained a cypress.config.ts file which was the file that was causing this error. What was irregular in the repository is that you have a cypress.config.ts file but do not have a cypress folder within your packages/cypress-tests which would contain support files and other important files used by cypress.

The work around to avoid the problem above is:

I followed the steps above to get the typescript project working with cypress.

amehta265 commented 2 years ago

Closing as resolved.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

munkinugget commented 2 years ago

Dang, I did not catch this before you closed it. I cannot replicate your solution. Would you be willing to share the working tsconfig.json? I'm not sure what I'm doing wrong.

amehta265 commented 2 years ago

@munkinugget After going over this issue again it seems as though my solution does not entirely solve the typescript errors associated with cypress in your Yarn 3 project.

For the time being it seems as though Yarn 3 is not correctly handling tsconfig types correctly as you will see in this issue and here. This is why you see the NODE_Options errors in your console because the node types have not be recognized correctly.

I am looking further into this and hopefully should find a work around for Cypress

amehta265 commented 2 years ago

Related issue: issue-19229

rockindahizzy commented 1 year ago

Hey @munkinugget we have a few issues related to pnp. This one is the current 'main' issue https://github.com/cypress-io/cypress/issues/22747. I'm going to close this for now. Feel free to re-open if you think they aren't related!