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 component tests failing after enabling esbuild in Angular 17 app #20300

Closed
1 of 4 tasks
Tungsten78 opened this issue Nov 16, 2023 · 2 comments
Closed
1 of 4 tasks
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@Tungsten78
Copy link

Current Behavior

nx run my-project:component-test fails with Error: Missing executor options "main".

  • This started occurring after migrating to esbuild in the targeted angular app (devServerTarget).
  • Reverting the application builder restores the tests

image

Expected Behavior

Component tests should work with the application builder.

GitHub Repo

No response

Steps to Reproduce

  1. configure application builder, from browser to application
  2. run component tests

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.16.1
   OS     : win32-x64
   npm    : 9.5.1
   
   nx (global)        : 17.1.2
   nx                 : 17.1.2
   @nx/js             : 17.1.2
   @nx/jest           : 17.1.2
   @nx/eslint         : 17.1.2
   @nx/workspace      : 17.1.2
   @nx/angular        : 17.1.2
   @nx/cypress        : 17.1.2
   @nx/devkit         : 16.10.0
   @nx/eslint-plugin  : 17.1.2
   @nx/web            : 17.1.2
   @nx/webpack        : 17.1.2
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @auth0/auth0-angular         : 2.2.1
   @ngrx/component              : 17.0.0-rc.0
   @ngrx/component-store        : 17.0.0-rc.0
   @nx-dotnet/core              : 1.23.0
   @nxlv/python                 : 16.3.1
   @trumbitta/nx-plugin-openapi : 1.12.1
   ---------------------------------------
   The following packages should match the installed version of nx
     - @nx/devkit@16.10.0
     - @nrwl/devkit@16.10.0

   To fix this, run `nx migrate nx@17.1.2`

Failure Logs

> nx run trends-web-rule-builder-point-of-sale-feature:component-test

DevTools listening on ws://127.0.0.1:64940/devtools/browser/00f688a2-d48e-4401-bcaa-ad8a767e97f0
Your configFile is invalid: C:\Users\Chris Leigh\Source\repos\nx-trends\libs\trends\web\rule-builder\point-of-sale\feature\cypress.config.ts

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

Error: Missing executor options "main"
    at withSchemaDefaults (C:\Users\Chris Leigh\Source\repos\nx-trends\node_modules\@nx\angular\plugins\component-testing.js:203:15)
    at normalizeBuildTargetOptions (C:\Users\Chris Leigh\Source\repos\nx-trends\node_modules\@nx\angular\plugins\component-testing.js:108:26)
    at nxComponentTestingPreset (C:\Users\Chris Leigh\Source\repos\nx-trends\node_modules\@nx\angular\plugins\component-testing.js:58:36)
    at Object.<anonymous> (C:\Users\Chris Leigh\Source\repos\nx-trends\libs\trends\web\rule-builder\point-of-sale\feature\cypress.config.ts:6:38)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module.m._compile (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\ts-node\dist\index.js:857:29)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\ts-node\dist\index.js:859:16)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at loadFile (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:89:14)
    at EventEmitter.<anonymous> (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:116:38)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)
    at process.<anonymous> (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:513:28)
    at process.emit (node:domain:489:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
    at emit (node:internal/child_process:937:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The main reference in the error looks to directly correlate to the change in the angular docs.

Add main back the error changes to:

> nx run core-web-shared-ui:component-test

DevTools listening on ws://127.0.0.1:65502/devtools/browser/2ceef9e8-4ac5-4bbe-af18-6d6878677421
Your configFile is invalid: C:\Users\Chris Leigh\Source\repos\nx-trends\libs\core\web\shared\ui\cypress.config.ts

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

TypeError: Cannot read properties of undefined (reading 'includes')
    at loadFile (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:91:22)
    at EventEmitter.<anonymous> (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:116:38)
    at EventEmitter.emit (node:events:513:28)
    at EventEmitter.emit (node:domain:489:12)
    at process.<anonymous> (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:513:28)
    at process.emit (node:domain:489:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (C:\Users\Chris Leigh\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
    at emit (node:internal/child_process:937:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Nov 16, 2023
@leosvelperez
Copy link
Member

This is a duplicate of #20269 and was fixed by #20214.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants