Skip to content

karma-server breaks on hot reload #21384

@psoares-resilient

Description

@psoares-resilient

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

Before updating to this version, running the tests in jasmine/karma (pretty standard setup) is ok and the hot reload works as expected whenever something changes in code/test. Each time you save, it generates the bundles and causes the tests to rerun (even if midway through).

With the update, every time something changes during the test run (an expectation, hitting save, etc... ) the test runner just breaks and kills the runner instead of reloading making it pretty much unusable.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Generating browser application bundles...21 07 2021 13:33:03.601:ERROR [karma-server]: UncaughtException: TypeError: Cannot read property 'jsonData' of undefined
    at JsonGenerator.getSize (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/json/JsonGenerator.js:119:31)
    at NormalModule.size (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:1224:43)
    at NormalModule.cleanupForCache (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:364:9)
    at NormalModuleFactory.cleanupForCache (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModuleFactory.js:670:11)
    at Compiler._cleanupLastNormalModuleFactory (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:383:34)
    at Compiler.createNormalModuleFactory (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1049:8)
    at Compiler.newCompilationParams (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1071:30)
    at Compiler.compile (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1082:23)
    at /Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Watching.js:188:19
    at _next0 (eval at create (/Users/p.soares/projects/fraud-investigation-ui/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
21 07 2021 13:33:03.602:ERROR [karma-server]: TypeError: Cannot read property 'jsonData' of undefined
    at JsonGenerator.getSize (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/json/JsonGenerator.js:119:31)
    at NormalModule.size (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:1224:43)
    at NormalModule.cleanupForCache (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:364:9)
    at NormalModuleFactory.cleanupForCache (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModuleFactory.js:670:11)
    at Compiler._cleanupLastNormalModuleFactory (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:383:34)
    at Compiler.createNormalModuleFactory (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1049:8)
    at Compiler.newCompilationParams (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1071:30)
    at Compiler.compile (/Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1082:23)
    at /Users/p.soares/projects/fraud-investigation-ui/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Watching.js:188:19
    at _next0 (eval at create (/Users/p.soares/projects/fraud-investigation-ui/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)


### Please provide the environment you discovered this bug in

```true
Angular CLI: 12.1.2
Node: 14.17.3
Package Manager: npm 7.20.0
OS: darwin x64

Angular: 12.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.2
@angular-devkit/build-angular   12.1.2
@angular-devkit/core            12.1.2
@angular-devkit/schematics      12.1.2
@schematics/angular             12.1.2
rxjs                            6.6.7
typescript                      4.2.4

Anything else?

The previous version (below) does not have this issue:

Angular CLI: 12.1.1
Node: 14.17.3
Package Manager: npm 7.20.0
OS: darwin x64

Angular: 12.1.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.1
@angular-devkit/build-angular   12.1.1
@angular-devkit/core            12.1.1
@angular-devkit/schematics      12.1.1
@schematics/angular             12.1.1
rxjs                            6.6.7
typescript                      4.2.4

The current repo is quite big, trying to reduce to a minimal stage at the moment. I'll post this without the reproducible repo In case someone knows what is going on before I can make it reproducible.

Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions