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.

Angular CT in Nx monorepo fails when interpreting `angular.json`

See original GitHub issue

Current behavior

When trying to implement component testing in our monorepo I get the error:

TypeError
Your configFile threw an error from: cypress.config.ts

We stopped running your tests because your config file crashed.

..\..\..\..\Users\me\AppData\Local\Cypress\Cache\10.10.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:27:61
  25 |         root,
  26 |         sourceRoot,
> 27 |         buildOptions: Object.assign(Object.assign({}, build.options), ((_a = build.configurations) === null || _a === void 0 ? void 0 : _a.development) || {}),
     |                                                             ^
  28 |     };
  29 | }
  30 | exports.getProjectConfig = getProjectConfig;
  31 | function getAngularBuildOptions(buildOptions, tsConfig) {

We use Nx (14.6.3) to manage our Angular (14.0.1) repo and test with Cypress (10.10.0) through Storybook. The angular.json config the error originates from is generated by the @nrwl/cypress@14.6.3 generator. This means any apps/foo-e2e is configured in angular.json without the foo-e2e/architect/build object (which is what is being destructured in angularHandler.js:23).

Desired behavior

I presume we should be able to use both component testing and regular e2e testing.

Test code to reproduce

Generate an application through Nx with Cypress tests and try to run component testing.

Cypress Version

10.10.0

Node version

16.17.0

Operating System

Windows

Debug Logs

No response

Other

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ChristofFritzcommented, Dec 8, 2022

I’ll assemble a minimal example tomorrow

1reaction
ChristofFritzcommented, Nov 30, 2022

But what we have is: Multiple angular projects in one. So I set the sourceRoot in the devServer options in the cypress.config.ts to the “newProjectRoot” of the angular.json and now it seems to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular CLI and Nx — Why?. In this blog post, I'll present a…
In this blog post, I'll present a comparison of both the Angular CLI and the Nx CLI and present some evaluations on the...
Read more >
Nx 13 Migration failure: update-tasks-runner - Stack Overflow
It turns out there is an issue with the migration scripts from Nx; they require you to have tasksRunnerOptions present in your nx.json...
Read more >
Advantages of Monorepo - An architechtural concept of code ...
Monorepo, as the name suggests, is a repository that contains the source code for all your applications, libraries, and tools used by them....
Read more >
Getting Started with Monorepo with Nx Nrwl - Rupesh Tiwari
Create Monorepo using Nx with angular projects and applications. ... Karma failing when no test present; Monorepo Architecture Guideline for ...
Read more >
@nrwl/cypress: Versions | Openbase
Note: Version bump only for package @nrwl/nx-source ... angular: expand extends property when reading nx.json in the angular cli adapter (#10165) (0a1e822) ...
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