Angular-cli: ng test, multiple requests for files

Created on 12 Nov 2019  ·  2Comments  ·  Source: angular/angular-cli

🐞 Bug report

Command (mark with an x)

  • [ ] new
  • [ ] build
  • [ ] serve
  • [x] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Description

Can't figure out why karma with ng-cli, requires main.js/vendors.js/boot.js multiple times ( 3 times )

In our case, this is a problem, because final size of all sources that downloaded by browser ~ 760mb

Снимок экрана 2019-11-12 в 13 27 09
Снимок экрана 2019-11-12 в 13 23 16

🔬 Minimal Reproduction

ng new karma-app
ng test
open devtools, see network tab

🌍 Your Environment



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


Angular CLI: 8.3.18
Node: 12.12.0
OS: darwin x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.18
@angular-devkit/build-angular     0.803.18
@angular-devkit/build-optimizer   0.803.18
@angular-devkit/build-webpack     0.803.18
@angular-devkit/core              8.3.18
@angular-devkit/schematics        8.3.18
@angular/cli                      8.3.18
@ngtools/webpack                  8.3.18
@schematics/angular               8.3.18
@schematics/update                0.803.18
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2
devkibuild-angular browser low memorperformance triage #1 bufix

Most helpful comment

Experiencing the same issue here, this seems to causes memory problems on CI builds when there are a very large number of tests. We've been running tests with source maps and code coverage enabled. We have observed that if we turn off source maps (--source-map=false) the issue does not occur and only single files are added.

All 2 comments

I played around a bit in a local project and it seems that zone.js is interfering with this:

with import 'zone.js/dist/long-stack-trace-zone';
image

without:
image

This is also a reason why we had issues with unit tests failing with out of memory errors with ~5000 tests and code coverage enabled.

@novathore are you using long stack trace import?

EDIT: Looking it the long-stack-trace-zone.js, its kind of hard to see how such side effect could happen

Experiencing the same issue here, this seems to causes memory problems on CI builds when there are a very large number of tests. We've been running tests with source maps and code coverage enabled. We have observed that if we turn off source maps (--source-map=false) the issue does not occur and only single files are added.

Was this page helpful?
0 / 5 - 0 ratings