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

fix(@angular/cli): fix ng test report sourcemaps #6968

Merged
merged 1 commit into from
Jul 19, 2017

Conversation

filipesilva
Copy link
Contributor

#6160 broke ng test sourcemaps in Chrome, this PR fixes it.

Before:

kamik@T460p MINGW64 D:/sandbox/master-project (master)
$ ng test --sr
 10% building modules 1/1 modules 0 active13 07 2017 16:38:43.942:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
13 07 2017 16:38:43.945:INFO [launcher]: Launching browser Chrome with unlimited concurrency
13 07 2017 16:38:43.953:INFO [launcher]: Starting browser Chrome                                                    13 07 2017 16:38:54.099:INFO [Chrome 59.0.
3071 (Windows 10 0.0.0)]: Connected on socket Xdep72ofT_Q7MWBHAAAA with id 76010950
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> (http://localhost:9876/_karma_webpack_/main.bundle.js:89:27)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9
876/_karma_webpack_/polyfills.bundle.js:2704:26)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke (
http://localhost:9876/_karma_webpack_/vendor.bundle.js:55972:39)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localh
ost:9876/_karma_webpack_/vendor.bundle.js:56735:39)
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 2 of 3 (1 FAILED) (0 secs / 0.162 secs)
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> (http://localhost:9876/_karma_webpack_/main.bundle.js:89:27)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9
876/_karma_webpack_/polyfills.bundle.js:2704:26)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke (
http://localhost:9876/_karma_webpack_/vendor.bundle.js:55972:39)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localh
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 3 of 3 (1 FAILED) (0.225 secs / 0.204 secs)

After:

kamik@T460p MINGW64 D:/sandbox/master-project (master)
$ ng test --sr
 10% building modules 1/1 modules 0 active13 07 2017 16:37:59.478:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
13 07 2017 16:37:59.481:INFO [launcher]: Launching browser Chrome with unlimited concurrency
13 07 2017 16:37:59.487:INFO [launcher]: Starting browser Chrome                                                    13 07 2017 16:38:08.559:INFO [Chrome 59.0.
3071 (Windows 10 0.0.0)]: Connected on socket ixHN4NzVFTEW1iYiAAAA with id 92819713
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> D:/sandbox/master-project/src/app/app.component.spec.ts:23:23)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke D:/sandbox/master-p
roject/node_modules/zone.js/dist/zone.js:391:1)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke D
:/sandbox/master-project/node_modules/zone.js/dist/async-test.js:49:1)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke D:/sandbox/mas
ter-project/node_modules/zone.js/dist/proxy.js:76:1)
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 2 of 3 (1 FAILED) (0 secs / 0.367 secs)
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> D:/sandbox/master-project/src/app/app.component.spec.ts:23:23)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke D:/sandbox/master-p
roject/node_modules/zone.js/dist/zone.js:391:1)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke D
:/sandbox/master-project/node_modules/zone.js/dist/async-test.js:49:1)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke D:/sandbox/mas
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 3 of 3 (1 FAILED) (0.421 secs / 0.4 secs)

Fix #6583

* to let the dependency validator know they are used.
*
* require('karma-source-map-support')
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment block necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise the dependency validator thinks this dependency is not used. It's needed but it's required via require.resolve() instead of require(), so the automatic detection does not work. The same workaround is used in webpack-configs/common.ts for loaders.

Brocco
Brocco previously approved these changes Jul 14, 2017
angular#6160 broke `ng test` sourcemaps in Chrome, this PR fixes it.

Before:
```
kamik@T460p MINGW64 D:/sandbox/master-project (master)
$ ng test --sr
 10% building modules 1/1 modules 0 active13 07 2017 16:38:43.942:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
13 07 2017 16:38:43.945:INFO [launcher]: Launching browser Chrome with unlimited concurrency
13 07 2017 16:38:43.953:INFO [launcher]: Starting browser Chrome                                                    13 07 2017 16:38:54.099:INFO [Chrome 59.0.
3071 (Windows 10 0.0.0)]: Connected on socket Xdep72ofT_Q7MWBHAAAA with id 76010950
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> (http://localhost:9876/_karma_webpack_/main.bundle.js:89:27)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9
876/_karma_webpack_/polyfills.bundle.js:2704:26)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke (
http://localhost:9876/_karma_webpack_/vendor.bundle.js:55972:39)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localh
ost:9876/_karma_webpack_/vendor.bundle.js:56735:39)
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 2 of 3 (1 FAILED) (0 secs / 0.162 secs)
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> (http://localhost:9876/_karma_webpack_/main.bundle.js:89:27)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9
876/_karma_webpack_/polyfills.bundle.js:2704:26)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke (
http://localhost:9876/_karma_webpack_/vendor.bundle.js:55972:39)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke (http://localh
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 3 of 3 (1 FAILED) (0.225 secs / 0.204 secs)
```

After:
```
kamik@T460p MINGW64 D:/sandbox/master-project (master)
$ ng test --sr
 10% building modules 1/1 modules 0 active13 07 2017 16:37:59.478:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
13 07 2017 16:37:59.481:INFO [launcher]: Launching browser Chrome with unlimited concurrency
13 07 2017 16:37:59.487:INFO [launcher]: Starting browser Chrome                                                    13 07 2017 16:38:08.559:INFO [Chrome 59.0.
3071 (Windows 10 0.0.0)]: Connected on socket ixHN4NzVFTEW1iYiAAAA with id 92819713
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> D:/sandbox/master-project/src/app/app.component.spec.ts:23:23)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke D:/sandbox/master-p
roject/node_modules/zone.js/dist/zone.js:391:1)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke D
:/sandbox/master-project/node_modules/zone.js/dist/async-test.js:49:1)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke D:/sandbox/mas
ter-project/node_modules/zone.js/dist/proxy.js:76:1)
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 2 of 3 (1 FAILED) (0 secs / 0.367 secs)
Chrome 59.0.3071 (Windows 10 0.0.0) AppComponent should have as title 'app' FAILED
        Expected 'app' to equal 'forced bug'.
            at Object.<anonymous> D:/sandbox/master-project/src/app/app.component.spec.ts:23:23)
            at ZoneDelegate.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke D:/sandbox/master-p
roject/node_modules/zone.js/dist/zone.js:391:1)
            at AsyncTestZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke D
:/sandbox/master-project/node_modules/zone.js/dist/async-test.js:49:1)
            at ProxyZoneSpec.webpackJsonp.../../../../../../../sandbox/master-project/node_modules/zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke D:/sandbox/mas
Chrome 59.0.3071 (Windows 10 0.0.0): Executed 3 of 3 (1 FAILED) (0.421 secs / 0.4 secs)
```

Fix angular#6583
@Brocco Brocco merged commit 455d56e into angular:master Jul 19, 2017
@filipesilva filipesilva deleted the test-sourcemaps branch July 19, 2017 15:39
@Meligy
Copy link
Contributor

Meligy commented Jul 28, 2017

For the record, I think it's not completely fixed.

See #7117

@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 Sep 12, 2019
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 this pull request may close these issues.

Karma testing output not the same in angular/cli versions after 1.0.6
4 participants