Skip to content

cypress.config.ts does not work with ESM: "exports is not defined in ES module scope" #23552

@nwalters512

Description

@nwalters512

Current behavior

I would expect Cypress to work out of the box with TypeScript and ESM:

  • "type": "module" in package.json

  • The following tsconfig.json:

    {
      "compilerOptions": {
        "target": "ESNext",
        "module": "NodeNext",
        "moduleResolution": "NodeNext"
      }
    }
  • The following cypress.config.ts:

    import { defineConfig } from 'cypress';
    
    export default defineConfig({});

However, with that setup, Cypress currently fails with the following error:

Your configFile is invalid: /Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts

It threw an error when required, check the stack trace below:

ReferenceError: exports is not defined in ES module scope
    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)
    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)

Desired behavior

Cypress should work with this setup.

Test code to reproduce

Clone https://github.com/nwalters512/cypress-esm-typescript-config, then run yarn && yarn cypress. Observe the following error message:

Cypress Version

10.6.0

Node version

16.13.0

Operating System

macOS 12.5

Debug Logs

cypress:cli:cli cli starts with arguments ["/Users/nathan/.nvm/versions/node/v16.13.0/bin/node","/Users/nathan/git/cypress-esm-typescript-config/node_modules/.bin/cypress","run"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +1ms
  cypress:cli:cli running Cypress with args [ Command { _events: [Object: null prototype] { 'option:browser': [Function (anonymous)], 'option:ci-build-id': [Function (anonymous)], 'option:component': [Function (anonymous)], 'option:config': [Function (anonymous)], 'option:config-file': [Function (anonymous)], 'option:e2e': [Function (anonymous)], 'option:env': [Function (anonymous)], 'option:group': [Function (anonymous)], 'option:key': [Function (anonymous)], 'option:headed': [Function (anonymous)], 'option:headless': [Function (anonymous)], 'option:no-exit': [Function (anonymous)], 'option:parallel': [Function (anonymous)], 'option:port': [Function (anonymous)], 'option:project': [Function (anonymous)], 'option:quiet': [Function (anonymous)], 'option:record': [Function (anonymous)], 'option:reporter': [Function (anonymous)], 'option:reporter-options': [Function (anonymous)], 'option:spec': [Function (anonymous)], 'option:tag': [Function (anonymous)], 'option:dev': [Function (anonymous)] }, _eventsCount: 22, _maxListeners: undefined, commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], parent: Command { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, commands: [Array], options: [Array], parent: null, _allowUnknownOption: false, _args: [], rawArgs: [Array], _scriptPath: '/Users/nathan/git/cypress-esm-typescript-config/node_modules/.bin/cypress', _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: null, _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: undefined, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '<command> [options]', args: [Array], [Symbol(kCapture)]: false }, _allowUnknownOption: false, _args: [], rawArgs: null, _scriptPath: null, _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: [Function: listener], _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: 0, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, exit: true, args: [], [Symbol(kCapture)]: false } ] +0ms
  cypress:cli:cli variable-length opts parsed { args: [ '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', '/Users/nathan/git/cypress-esm-typescript-config/node_modules/.bin/cypress', 'run' ], opts: Command { _events: [Object: null prototype] { 'option:browser': [Function (anonymous)], 'option:ci-build-id': [Function (anonymous)], 'option:component': [Function (anonymous)], 'option:config': [Function (anonymous)], 'option:config-file': [Function (anonymous)], 'option:e2e': [Function (anonymous)], 'option:env': [Function (anonymous)], 'option:group': [Function (anonymous)], 'option:key': [Function (anonymous)], 'option:headed': [Function (anonymous)], 'option:headless': [Function (anonymous)], 'option:no-exit': [Function (anonymous)], 'option:parallel': [Function (anonymous)], 'option:port': [Function (anonymous)], 'option:project': [Function (anonymous)], 'option:quiet': [Function (anonymous)], 'option:record': [Function (anonymous)], 'option:reporter': [Function (anonymous)], 'option:reporter-options': [Function (anonymous)], 'option:spec': [Function (anonymous)], 'option:tag': [Function (anonymous)], 'option:dev': [Function (anonymous)] }, _eventsCount: 22, _maxListeners: undefined, commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], parent: Command { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, commands: [Array], options: [Array], parent: null, _allowUnknownOption: false, _args: [], rawArgs: [Array], _scriptPath: '/Users/nathan/git/cypress-esm-typescript-config/node_modules/.bin/cypress', _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: null, _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: undefined, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '<command> [options]', args: [Array], [Symbol(kCapture)]: false }, _allowUnknownOption: false, _args: [], rawArgs: null, _scriptPath: null, _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: [Function: listener], _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: 0, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, exit: true, args: [], [Symbol(kCapture)]: false } } +44ms
  cypress:cli parsed cli options {} +46ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +0ms
  cypress:cli checking if executable exists /Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress +2ms
  cypress:cli Binary is executable? : true +1ms
  cypress:cli binaryDir is  /Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app +0ms
  cypress:cli Reading binary package.json from: /Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/package.json +0ms
  cypress:cli Found binary version 10.6.0 installed in: /Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app +2ms
  cypress:cli { verified: true } +1ms
  cypress:cli is Verified ? true +1ms
  cypress:cli:run processing run options { key: null, spec: null, reporter: null, reporterOptions: null, project: '/Users/nathan/git/cypress-esm-typescript-config' } +0ms
  cypress:cli:run --key is not set, looking up environment variable CYPRESS_RECORD_KEY +0ms
  cypress:cli:run run to spawn.start args ["--run-project","/Users/nathan/git/cypress-esm-typescript-config"] +0ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +0ms
  cypress:cli spawn args [ '--no-sandbox', '--', '--run-project', '/Users/nathan/git/cypress-esm-typescript-config', '--cwd', '/Users/nathan/git/cypress-esm-typescript-config', '--userNodePath', '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', '--userNodeVersion', '16.13.0' ] { detached: false, stdio: [ 'inherit', 'inherit', 'pipe' ] } +4ms
  cypress:cli spawning Cypress with executable: /Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress +0ms
  cypress:cli piping child STDERR to process STDERR +3ms
  cypress:ts registering ts-node on directory undefined +0ms
  cypress:ts Running without ts-node hook in environment "production" +30ms
  cypress:server:appdata path: /Users/nathan/Library/Application Support/Cypress/cy/production/cache +0ms
  cypress:server:appdata path: /Users/nathan/Library/Application Support/Cypress/cy/production/browsers +25ms
  cypress:server:cypress starting cypress with argv [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress', '--no-sandbox', '--', '--run-project', '/Users/nathan/git/cypress-esm-typescript-config', '--cwd', '/Users/nathan/git/cypress-esm-typescript-config', '--userNodePath', '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', '--userNodeVersion', '16.13.0' ] +0ms
  cypress:server:args argv array: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress', '--no-sandbox', '--run-project', '/Users/nathan/git/cypress-esm-typescript-config', '--cwd', '/Users/nathan/git/cypress-esm-typescript-config', '--userNodePath', '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', '--userNodeVersion', '16.13.0' ] +0ms
  cypress:server:args parsed argv options { options: { _: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, 'run-project': '/Users/nathan/git/cypress-esm-typescript-config', runProject: '/Users/nathan/git/cypress-esm-typescript-config', cwd: '/Users/nathan/git/cypress-esm-typescript-config', userNodePath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', userNodeVersion: '16.13.0' } } +1ms
  cypress:server:args argv parsed: { _: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, runProject: '/Users/nathan/git/cypress-esm-typescript-config', cwd: '/Users/nathan/git/cypress-esm-typescript-config', userNodePath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', userNodeVersion: '16.13.0', invokedFromCli: true } +1ms
  cypress:server:util:proxy found proxy environment variables {} +0ms
  cypress:server:args options { _: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, runProject: '/Users/nathan/git/cypress-esm-typescript-config', cwd: '/Users/nathan/git/cypress-esm-typescript-config', userNodePath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', userNodeVersion: '16.13.0', invokedFromCli: true, config: {} } +1ms
  cypress:server:args argv options: { _: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, runProject: '/Users/nathan/git/cypress-esm-typescript-config', cwd: '/Users/nathan/git/cypress-esm-typescript-config', userNodePath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', userNodeVersion: '16.13.0', invokedFromCli: true, config: {}, projectRoot: '/Users/nathan/git/cypress-esm-typescript-config' } +0ms
  cypress:server:cypress from argv [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress', '--no-sandbox', '--run-project', '/Users/nathan/git/cypress-esm-typescript-config', '--cwd', '/Users/nathan/git/cypress-esm-typescript-config', '--userNodePath', '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', '--userNodeVersion', '16.13.0' ] got options { _: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, runProject: '/Users/nathan/git/cypress-esm-typescript-config', cwd: '/Users/nathan/git/cypress-esm-typescript-config', userNodePath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', userNodeVersion: '16.13.0', invokedFromCli: true, config: {}, projectRoot: '/Users/nathan/git/cypress-esm-typescript-config' } +4ms
  cypress:server:cypress scaling electron app in headless mode +0ms
  cypress:server:appdata path: /Users/nathan/Library/Application Support/Cypress/cy/production +25ms
  cypress:server:cypress starting in mode run with options { _: [ '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/MacOS/Cypress' ], sandbox: false, runProject: '/Users/nathan/git/cypress-esm-typescript-config', cwd: '/Users/nathan/git/cypress-esm-typescript-config', userNodePath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node', userNodeVersion: '16.13.0', invokedFromCli: true, config: {}, projectRoot: '/Users/nathan/git/cypress-esm-typescript-config' } +44ms
  cypress:server:cypress running Electron currently +0ms
  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 +0ms
  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:scaffold-config:detect Detected cypress.config.ts - using TS +0ms
  cypress:server:video using ffmpeg from /Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/node_modules/@ffmpeg-installer/darwin-arm64/ffmpeg +0ms
  cypress:lifecycle:ProjectConfigIpc fork child process { CHILD_PROCESS_FILE_PATH: '/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/require_async_child.js', configProcessArgs: [ '--projectRoot', '/Users/nathan/git/cypress-esm-typescript-config', '--file', '/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts' ], childOptions: { stdio: 'pipe', cwd: '/Users/nathan/git/cypress-esm-typescript-config', execPath: '/Users/nathan/.nvm/versions/node/v16.13.0/bin/node' } } +0ms
  cypress:lifecycle:ProjectConfigIpc trigger the load of the file +3ms
(node:46444) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
  cypress:server:browsers:utils found browsers { browsers: [ { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '104.0.5112.101', path: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', minSupportedVersion: 64, majorVersion: '104' }, { name: 'firefox', family: 'firefox', channel: 'stable', displayName: 'Firefox', version: '103.0.1', path: '/Applications/Firefox.app/Contents/MacOS/firefox', minSupportedVersion: 86, majorVersion: '103' } ] } +161ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │      pids      │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'cypress' │      1       │    '46435'     │   102.3    │     102.3      │  13.19   │    13.19     │    13.19    │
  cypress:server:util:process_profiler │    1    │  'other'  │      2       │ '46438, 46439' │     0      │       0        │   0.39   │     0.39     │    0.39     │
  cypress:server:util:process_profiler │    2    │  'TOTAL'  │      3       │      '-'       │   102.3    │     102.3      │  13.58   │    13.58     │    13.58    │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +0ms
  cypress:lifecycle:child:run_require_async_child:46444 configFile: /Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts +0ms
  cypress:lifecycle:child:run_require_async_child:46444 projectRoot: /Users/nathan/git/cypress-esm-typescript-config +1ms
  cypress:lifecycle:child:run_require_async_child:46444 try loading /Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts +6ms
  cypress:lifecycle:child:run_require_async_child:46444 Loading file /Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts +0ms
  cypress:lifecycle:child:run_require_async_child:46444 User is loading an ESM config file +5ms
  cypress:lifecycle:child:run_require_async_child:46444 importing esm file file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts +0ms
  cypress:lifecycle:child:run_require_async_child:46444 error loading file via native Node.js module loader exports is not defined in ES module scope +29ms
  cypress:lifecycle:ProjectConfigIpc error loading config {
  name: 'Error',
  message: 'Your \x1B[33mconfigFile\x1B[39m is invalid: \x1B[94m/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts\x1B[39m\n' +
    '\n' +
    'It threw an error when required, check the stack trace below:',
  stack: 'ReferenceError: exports is not defined in ES module scope\n' +
    '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' +
    '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' +
    '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' +
    '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' +
    '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)',
  type: 'CONFIG_FILE_REQUIRE_ERROR',
  details: 'ReferenceError: exports is not defined in ES module scope\n' +
    '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' +
    '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' +
    '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' +
    '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' +
    '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)',
  isCypressErr: true,
  messageMarkdown: 'Your `configFile` is invalid: `/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts`\n' +
    '\n' +
    'It threw an error when required, check the stack trace below:',
  originalError: [Object]
} +213ms
  cypress:lifecycle:ProjectConfigManager catch { name: 'Error', message: 'Your \x1B[33mconfigFile\x1B[39m is invalid: \x1B[94m/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts\x1B[39m\n' + '\n' + 'It threw an error when required, check the stack trace below:', stack: 'ReferenceError: exports is not defined in ES module scope\n' + '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' + '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' + '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' + '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)', type: 'CONFIG_FILE_REQUIRE_ERROR', details: 'ReferenceError: exports is not defined in ES module scope\n' + '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' + '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' + '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' + '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)', isCypressErr: true, messageMarkdown: 'Your `configFile` is invalid: `/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts`\n' + '\n' + 'It threw an error when required, check the stack trace below:', originalError: { name: 'ReferenceError', message: 'exports is not defined in ES module scope', stack: 'ReferenceError: exports is not defined in ES module scope\n' + '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' + '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' + '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' + '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)' } } +0ms
  cypress:lifecycle:ProjectConfigManager catch { name: 'Error', message: 'Your \x1B[33mconfigFile\x1B[39m is invalid: \x1B[94m/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts\x1B[39m\n' + '\n' + 'It threw an error when required, check the stack trace below:', stack: 'ReferenceError: exports is not defined in ES module scope\n' + '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' + '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' + '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' + '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)', type: 'CONFIG_FILE_REQUIRE_ERROR', details: 'ReferenceError: exports is not defined in ES module scope\n' + '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' + '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' + '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' + '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)', isCypressErr: true, messageMarkdown: 'Your `configFile` is invalid: `/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts`\n' + '\n' + 'It threw an error when required, check the stack trace below:', originalError: { name: 'ReferenceError', message: 'exports is not defined in ES module scope', stack: 'ReferenceError: exports is not defined in ES module scope\n' + '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' + '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' + '    at async Promise.all (index 0)\n' + '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' + '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' + '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' + '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)' } } +1ms
  cypress:server:cypress exiting with err {
  name: 'Error',
  message: 'Your \x1B[33mconfigFile\x1B[39m is invalid: \x1B[94m/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts\x1B[39m\n' +
    '\n' +
    'It threw an error when required, check the stack trace below:',
  stack: 'ReferenceError: exports is not defined in ES module scope\n' +
    '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' +
    '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' +
    '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' +
    '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' +
    '    at async EventEmitter.<anonymous> (/Users/nathan/Library/CacheYour configFile is invalid: /Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts

It threw an error when required, check the stack trace below:

ReferenceError: exports is not defined in ES module scope
    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)
    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)
s/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)',
  type: 'CONFIG_FILE_REQUIRE_ERROR',
  details: 'ReferenceError: exports is not defined in ES module scope\n' +
    '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' +
    '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' +
    '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' +
    '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' +
    '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)',
  isCypressErr: true,
  messageMarkdown: 'Your `configFile` is invalid: `/Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts`\n' +
    '\n' +
    'It threw an error when required, check the stack trace below:',
  originalError: {
    name: 'ReferenceError',
    message: 'exports is not defined in ES module scope',
    stack: 'ReferenceError: exports is not defined in ES module scope\n' +
      '    at file:///Users/nathan/git/cypress-esm-typescript-config/cypress.config.ts:2:23\n' +
      '    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)\n' +
      '    at async Promise.all (index 0)\n' +
      '    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n' +
      '    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)\n' +
      '    at async loadFile (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:106:14)\n' +
      '    at async EventEmitter.<anonymous> (/Users/nathan/Library/Caches/Cypress/10.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_require_async_child.js:116:32)'
  }
} +576ms
  cypress:server:cypress calling exit 1 +1ms
  cypress:server:cypress about to exit with code 1 +0ms
  cypress:server:browsers browsers.kill called with no active instance +0ms
  cypress:proxy:http:util:prerequests metrics: { browserPreRequestsReceived: 0, proxyRequestsReceived: 0, immediatelyMatchedRequests: 0, unmatchedRequests: 0, unmatchedPreRequests: 0 } +0ms
  cypress:cli child event fired { event: 'exit', code: 1, signal: null } +1s
  cypress:cli child event fired { event: 'close', code: 1, signal: null } +1ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions