Skip to content

@angular/cli upgrade breaks karma/jasmine sourcemap reporting #14457

Closed
@mbenna

Description

@mbenna

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Yes. Sourcemaps in karma/jasmine worked fine up to and including@angular/cli 8.0.0.beta.9, but from beta.10 to current (rc.4 today) sourcemaps no longer work.

Description

Example working output from beta.9:

Expected true to be falsy.
  at UserContext.<anonymous> (src/app/app.component.spec.ts:32:18)

Example broken output from beta.10+:

Error: Expected true to be falsy.
  at <Jasmine>
  at UserContext.<anonymous> (http://localhost:9877/_karma_webpack_/main.js:304:22)
  at ZoneDelegate.invoke (http://localhost:9877/_karma_webpack_/polyfills.js:3325:26)
  at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhos...

🔬 Minimal Reproduction

  • Follow https://angular.io/guide/quickstart and create a new app.
  • ng test and ensure test passes.
  • add to app.component.spec.ts:
    it('should fail', () => {
      expect(true).toBeFalsy();
    });
    
  • run ng test again and note you get a line number such as at UserContext.<anonymous> (src/app/app.component.spec.ts:32:18)
  • ng update --next --all --force to update to something more recent than 8.0.0.beta.10
  • repeat ng test and note line numbers no longer help you find your spec in app.component.ts. Instead you see something like this:
    Error: Expected true to be falsy.
      at <Jasmine>
      at UserContext.<anonymous> (http://localhost:9877/_karma_webpack_/main.js:304:22)
      at ZoneDelegate.invoke (http://localhost:9877/_karma_webpack_/polyfills.js:3325:26)
      at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke 
    (http://localhos...
    

🔥 Exception or Error

n/a

🌍 Your Environment

ng version:

Angular CLI: 8.0.0-rc.4
Node: 12.1.0
OS: win32 x64
Angular: 8.0.0-rc.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.0-rc.4
@angular-devkit/build-angular     0.800.0-rc.4
@angular-devkit/build-optimizer   0.800.0-rc.4
@angular-devkit/build-webpack     0.800.0-rc.4
@angular-devkit/core              8.0.0-rc.4
@angular-devkit/schematics        8.0.0-rc.4
@ngtools/webpack                  8.0.0-rc.4
@schematics/angular               8.0.0-rc.4
@schematics/update                0.800.0-rc.4
rxjs                              6.5.2
typescript                        3.5.0-rc
webpack                           4.30.0

Anything else relevant?

Not that I know of.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions