-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Karma testing output not the same in angular/cli versions after 1.0.6 #6583
Comments
To explain the relevancy of this problem: |
I'm sorry, I don't understand what you're trying to show here. I don't see any error message on the logs your provided... there seems to be a stack trace perhaps? But I don't know what for. Can you set up a github simple repo showing this issue please? E.g. a project created from |
Thank you for the feedback. I will try to create a project to reproduce the steps today or tomorrow. Sorry my original description was not clear enough. The key problem is that the stack trace previously (in This is a problem for when I write unit tests. |
Issue reproduced with a clean-install using command
notice the Now change the 1.1.0 error log:
Notice that the stack trace no longer includes |
Got it, seems like a sourcemap problem. Will investigate. |
@whyboris I tried your repro but I can't see the original file either:
Does this repro still work for you? If you still have an old version that works, maybe there's something different in the dependencies. Could you put the result of Also, what version of chrome are you using? |
Ran
Note
Notice |
Updated Ran
Note
Notice |
To summarize: the repo https://github.com/whyboris/cli106 (master branch) still works -- installs with Please let me know if you have any (more) questions. |
I have experienced the same issue and have stayed with 1.0.6 for the time being. Related to this issue, I have never seen useful file and line number information displayed inside the browser when running tests. I have always relied on the information displayed in the console. When using 1.0.6, the stack traces in the chrome look like this:
and like this in the console:
|
Got it, was able to reproduce now. Dug into it a bit and think I know the cause. It's a complicated problem to solve, might take a bit. |
I have a solution for now:
It will show you the original file, but in an weird URL (
|
#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
Awesome! Thanks! Please let us know when this is released. |
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
Closed by release |
On a brand new project created with 1.2.2, I still can't see any original source file in the stack trace, and when debugging in Chrome, the original source files are not listed either in the sources panel:
|
@filipesilva can confirm the problem persists
(even tried placing Currently we have: Output still contains no note of original file where the error is:
|
Thank you @filipesilva for your work. Let me know if there's anything you'd like me to test out. |
|
After updating to |
@diminutivesloop -- precisely what I noticed. For example:
(note Output when
for the same failed test! |
Yes, there should be no need to modify I don't think I can fix sourcemap reporting on PhantomJS unfortunately. That would require a new karma feature to be implemented (karma-runner/karma#2774). What I can say is that Chrome Headless (available now in Linux and OSX and on the next version of Windows) should overall be a better option to PhantomJS. |
Also AFAIK there is no sourcemap trouble with Firefox and |
I just successfully solved the problem by going to Chrome Headless. ps - PhantomJS hasn't had a new release since January 2016 |
That is very similar to the changes I did in #7084 to use headless in our travis setups. |
Hi - I'm trying to come up to speed on Karma/Jasmine, and based on the responses in this thread, I think I'm pretty current with my angular.
I'm running Ubuntu 16.04 in a VirtualBox VM on my Windows 7 host (wouldn't think that would be relevant). When rewriting my first Jasmine test to fail, in Chrome Developer Tools (rt-click --> Inspect), I do see the failure reported with a weird path, as you mention above. My results: From @filipesilva above: When i click on this link, I am supposed to be mapped back to the line of code that generates the error, but instead the browser page loads with 'Not found'. I installed the karma-source-map-support module as you suggested, although I infer from your later post that it should not be necessary to install, nor to modify karma.conf.js at all starting with @angular/cli version 1.2.3. Shouldn't I be able to successfully link to the code that is in error by following that link with the "weird path"? Did I understand you correctly @filipesilva ? Thank you for any clarification or guidance. |
I'm unsure whether what you've discovered is a separate issue or not. |
In a new project generated with Angular CLI 1.4.2 I can't debug the TypeScript files in Firefox. |
Maybe the issue is not with the Angular CLI but rather with Firefox. With Angular CLI 1.4.4 I can successfully set breakpoints and debug TypeScript sources in Chrome, Safari and Edge. Only Firefox does not allow me to set breakpoints. Still, with Angular CLI 1.0.6 it is working in all browsers including Firefox. |
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
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Summary:
Full:
Repro steps.
Create a project, write some unit tests, make at least one test fail (e.g. expect true to be false), run
ng test
karma.conf.js
has these features:package.json
has these features (probably irrelevant since older versions of these packages were working fine too before the cli upgrade):The log given by the failure.
When using later versions of
@angular/cli
theng test
output looks something like this:Desired functionality.
When using
@angular/cli 1.0.6
(and 1.0.1 and earlier) the output ofng test
would look something like this:Mention any other details that might be useful.
Please let me know if I should clarify anything. I confirmed the error is caused by angular-cli: when I rolled back to version 1.0.6 the
ng test
unit test errors were logged as they were logged previously (as desired).The text was updated successfully, but these errors were encountered: