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 13 and MFE breaks with Cypress

See original GitHub issue

Current Behavior

The styles defined in angular.json cannot be injected default value = inject:true. Causes the test to fail completely.

Expected Behavior

Steps to Reproduce

  1. Create a fresh nx workspace
  2. add an angular app with mfe preconfigured
  3. run e2e tests.

The nx custom webpack config breaks the tests. Remove the custom webpack config and the e2e tests work again.

Failure Logs

       "before each" hook for "should display welcome message":
     SyntaxError: The following error originated from your application code, not from Cypress.

  > Cannot use 'import.meta' outside a module

When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.

https://on.cypress.io/uncaught-exception-from-application

Environment

>  NX  Report complete - copy this into the issue template

  Node : 14.16.0
  OS   : darwin x64
  npm  : 6.14.11
  
  nx : 13.2.4
  @nrwl/angular : 13.2.4
  @nrwl/cli : 13.2.4
  @nrwl/cypress : 13.2.4
  @nrwl/devkit : 13.2.4
  @nrwl/eslint-plugin-nx : 13.2.4
  @nrwl/express : undefined
  @nrwl/jest : 13.2.4
  @nrwl/linter : 13.2.4
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : undefined
  @nrwl/nx-cloud : undefined
  @nrwl/react : undefined
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.2.4
  @nrwl/web : undefined
  @nrwl/workspace : 13.2.4
  @nrwl/storybook : 13.2.4
  @nrwl/gatsby : undefined
  typescript : 4.4.4
  rxjs : 7.4.0
  ---------------------------------------
  Community plugins:
         @angular-architects/module-federation: 12.5.3
         @angular/animations: 13.0.3
         @angular/common: 13.0.3
         @angular/compiler: 13.0.3
         @angular/core: 13.0.3
         @angular/forms: 13.0.3
         @angular/platform-browser: 13.0.3
         @angular/platform-browser-dynamic: 13.0.3
         @angular/router: 13.0.3
         @angular-devkit/build-angular: 13.0.4
         @angular/cli: 13.0.4
         @angular/compiler-cli: 13.0.3
         @angular/language-service: 13.0.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Coly010commented, Feb 8, 2022

I should update this to mention that we are working on addressing this to provide an improved out-of-box experience with MFEs.

1reaction
Coly010commented, Dec 10, 2021

This is related to an issue with Webpack compiling to use module syntax with Angular 13.

A fix for Webpack and MFEs was released in Nx 13.3 yesterday.

Could you try it again using 13.3? If you have a workspace already, make sure to run the migrations as it should patch your webpack config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nx v14 is out — Here is all you need to know!
There have been a lot of highlights for the Nx Angular plugin since v13. Here are some: Support and migrations for Angular 13...
Read more >
Angular Quickstart - Cypress Documentation
This tutorial will walk you through creating an Angular app and using Cypress Component Testing to test it. ... Let's break down the...
Read more >
Listen to The Angular Plus Show podcast - Deezer
The Angular Plus Show is the home of ng-conf's official all-Angular podcast. ... anticipated new features is the GA release of Cypress Component...
Read more >
nx cannot read properties of undefined (reading 'endswith')
Add logic to Cypress e2e projects to ignore this error.", "factory": "./src/migrations/update-13-8-1/add-cypress-mfe-workaround", "package": "@nrwl/angular" ...
Read more >
Topic: Angular - MeetupFeed
Amazing E2e testing experience with Cypress and Angular | Christoffer Noring ... Angular for Architects Workshop w/ John Papa & Dan Wahlin |...
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