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.

"TypeError: Cannot destructure property 'build' of 'architect' as it is undefined." when generating Cypress Angular Component test configuration

See original GitHub issue

Current behavior

I’m attempting to setup Angular component tests by using the Cypress UI tool: image

But I’m getting this error: image

Any advise would be much appreciated 🙏!

Desired behavior

I’d like the tool to generate working configuration(s) enabling me to test Angular components (/not getting “Unexpecting Error”).

Test code to reproduce

I’m using a clean nx-workspace (Angular/NestJS/Cypress), which can be found here: https://github.com/rujorgensen/nx-workspace

Cypress Version

10.7.0

Node version

16.16.0

Operating System

Windows 11

Debug Logs

No response

Other

Complete outputs:

 21 |     const defaultProjectConfig = angularJson.projects[defaultProject];
  22 |     const { architect, root, sourceRoot } = defaultProjectConfig;
> 23 |     const { build } = architect;
     |             ^
  24 |     return {
  25 |         root,
  26 |         sourceRoot,
  27 |         buildOptions: Object.assign(Object.assign({}, build.options), ((_a = build.configurations) === null || _a === void 0 ? void 0 : _a.development) || {}),
TypeError: Cannot destructure property 'build' of 'architect' as it is undefined.
    at getProjectConfig (C:\Users\rj\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:23:13)
    at async getAngularCliWebpackConfig (C:\Users\rj\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:132:117)
    at async angularHandler (C:\Users\rj\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:141:27)
    at async getPreset (C:\Users\rj\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:76:20)
    at async Function.devServer.create (C:\Users\rj\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:93:61)
    at async C:\Users\rj\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:25:24

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ZachJW34commented, Sep 19, 2022

Going to close this issue, we can reopen if we need to make changes on our side to support Nx.

0reactions
ZachJW34commented, Sep 19, 2022

Glad I could help 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot destructure property 'build' of 'architect' as it is ... - GitHub
"TypeError: Cannot destructure property 'build' of 'architect' as it is undefined." when generating Cypress Angular Component test configuration #363.
Read more >
Failed: Cannot destructure property 'xxx' of 'undefined' as it is ...
I try the first time to write an angular test. Failed: Cannot destructure property 'coding' of 'undefined' as it is undefined. Only where...
Read more >
What's New with Cypress Web Testing?
Cypress will throw an error when a user attempts to update a configuration value at run-time using either the Test Configuration or using...
Read more >
Testing Web Components with Karma and TypeScript
Imagine yourself building an electric car. By design, this car has an electric motor, a cooling system, a battery, a charge port, ...
Read more >
error was thrown in afterall | The AI Search Engine You Control
Angular 6 Unit Tests: An error was thrown in afterAll\nReferenceError: Can't find variable: $ thrown. Asked Jul 26, 2018 • 59 votes 12...
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