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

Error during npm test after updating Angular #20103

Closed
madoar opened this issue Feb 21, 2021 · 2 comments · Fixed by #20110
Closed

Error during npm test after updating Angular #20103

madoar opened this issue Feb 21, 2021 · 2 comments · Fixed by #20110

Comments

@madoar
Copy link

madoar commented Feb 21, 2021

🐞 bug report

Affected Package

I believe the issue was introduced by one of the updated packages by ng update @angular/core @angular/cli.

Is this a regression?

Yes, the issue was not present in version 11.0.0

Description

After updating the Angular dependencies of the library angular-archwizard from 11.0.x to latest by executing ng update @angular/core @angular/cli, npm test fails with the following error message:

$ npm test

> [email protected] test ~/git/angular-archwizard
> ng test && ng test --tsConfig=tsconfig-noIvy.spec.json

Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
⠋ Generating browser application bundles...21 02 2021 18:51:49.235:INFO [framework.detect-browsers]: The following browsers will be used: [ 'FirefoxHeadless' ]
⠙ Generating browser application bundles (phase: building)...21 02 2021 18:51:49.325:INFO [karma-server]: Karma v6.1.1 server started at http://localhost:9876/
21 02 2021 18:51:49.325:INFO [launcher]: Launching browsers FirefoxHeadless with concurrency unlimited
21 02 2021 18:51:49.327:INFO [launcher]: Starting browser FirefoxHeadless
✔ Browser application bundle generation complete.
21 02 2021 18:51:53.859:INFO [Firefox 85.0 (Linux x86_64)]: Connected on socket xICXANRpTidBS4xtAAAB with id 42976427
Firefox 85.0 (Linux x86_64) ERROR
  An error was thrown in afterAll
  ReferenceError: undefinedundefinedundefinedundefinedundefined is not defined
  ierq@http://localhost:9876/_karma_webpack_/main.js:5603:1
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  HACE@http://localhost:9876/_karma_webpack_/main.js:3229:100
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  uFF0@http://localhost:9876/_karma_webpack_/main.js:6561:109
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  llYR@http://localhost:9876/_karma_webpack_/main.js:5709:95
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  webpackContext@http://localhost:9876/_karma_webpack_/main.js:5298:9
  CB3P@http://localhost:9876/_karma_webpack_/main.js:2095:16
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  checkDeferredModules@http://localhost:9876/_karma_webpack_/main.js:46:23
  @http://localhost:9876/_karma_webpack_/main.js:153:18
  @http://localhost:9876/_karma_webpack_/main.js:156:10
Firefox 85.0 (Linux x86_64): Executed 0 of 0 ERROR (0.042 secs / 0 secs)
npm ERR! Test failed.  See above for more details.

🔬 Minimal Reproduction

  1. clone angular-archwizard from https://github.com/madoar/angular-archwizard
  2. install all required dependencies (npm install)
  3. update all Angular dependencies (ng update @angular/core @angular/cli)
  4. execute the tests npm test
  5. see above error message in the terminal

🔥 Exception or Error

21 02 2021 18:51:53.859:INFO [Firefox 85.0 (Linux x86_64)]: Connected on socket xICXANRpTidBS4xtAAAB with id 42976427
Firefox 85.0 (Linux x86_64) ERROR
  An error was thrown in afterAll
  ReferenceError: undefinedundefinedundefinedundefinedundefined is not defined
  ierq@http://localhost:9876/_karma_webpack_/main.js:5603:1
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  HACE@http://localhost:9876/_karma_webpack_/main.js:3229:100
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  uFF0@http://localhost:9876/_karma_webpack_/main.js:6561:109
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  llYR@http://localhost:9876/_karma_webpack_/main.js:5709:95
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  webpackContext@http://localhost:9876/_karma_webpack_/main.js:5298:9
  CB3P@http://localhost:9876/_karma_webpack_/main.js:2095:16
  __webpack_require__@http://localhost:9876/_karma_webpack_/main.js:80:30
  checkDeferredModules@http://localhost:9876/_karma_webpack_/main.js:46:23
  @http://localhost:9876/_karma_webpack_/main.js:153:18
  @http://localhost:9876/_karma_webpack_/main.js:156:10
Firefox 85.0 (Linux x86_64): Executed 0 of 0 ERROR (0.042 secs / 0 secs)
npm ERR! Test failed.  See above for more details.

🌍 Your Environment

$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.2.1
Node: 14.15.5
OS: linux x64

Angular: 11.2.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.1
@angular-devkit/build-angular   0.1102.1
@angular-devkit/core            11.2.1
@angular-devkit/schematics      11.2.1
@schematics/angular             11.2.1
@schematics/update              0.1102.1
rxjs                            6.6.3
typescript                      4.0.7

Anything else relevant?
For the tests Firefox has been used. I didn't test whether this issue also occurs with a different browser.

@gkalpak gkalpak transferred this issue from angular/angular Feb 21, 2021
@alan-agius4
Copy link
Collaborator

The issue appears to be caused by declaration and declarationMap in the test pipeline.
https://github.com/madoar/angular-archwizard/blob/e3818d657818fd3ef9ac2fc8efa37b23dc106c68/tsconfig.spec.json#L5-L6

The mentioned options are only to be used when building a library.

In version 11.2, we introduced a new Webpack plugin and unlike previously now we pass these options to the TS compiler.

alan-agius4 added a commit that referenced this issue Feb 22, 2021
…onMap

When building an application or testing a library. TypeScript declarations are not needed.

Closes #20103

(cherry picked from commit 2ef3949)
alan-agius4 added a commit that referenced this issue Feb 22, 2021
…onMap

When building an application or testing a library. TypeScript declarations are not needed.

Closes #20103
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants