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

Regression wrong error message during tests if runtime error occurs after constructor #7296

Closed
JSMike opened this issue Aug 7, 2017 · 55 comments

Comments

Projects
None yet
@JSMike
Copy link
Contributor

commented Aug 7, 2017

Bug Report or Feature Request (mark with an x)

- [ x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.2.2
node: 6.11.0
os: win32 x64
@angular/animations: 4.3.3
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.2.2
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3

Repro steps.

  • Create new project with @angular/cli version 1.2.2 or newer
  • Modify src/app/app.component.ts, add OnInit interface and add any runtime error to ngOnInit
  • run ng test

Simple runtime error example:

...
export class AppComponent implements OnInit {
  title = 'app';
  example: string;

  ngOnInit() {
    console.log(this.example.length);
  }
}

The log given by the failure.

 Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/AppComponent_Host.ngfactory.js'.
   at http://localhost:9876/_karma_webpack_/polyfills.bundle.js:5182:35
   at XMLHttpRequest.proto.(anonymous function) [as send] (http://localhost:9876/_karma_webpack_/polyfills.bundle.js:3767:20)
   at Array.<anonymous> (node_modules/source-map-support/browser-source-map-support.js:107:176)
   at node_modules/source-map-support/browser-source-map-support.js:101:106
   at Array.<anonymous> (node_modules/source-map-support/browser-source-map-support.js:107:474)
   at node_modules/source-map-support/browser-source-map-support.js:101:106
   at a (node_modules/source-map-support/browser-source-map-support.js:101:312)
   at b (node_modules/source-map-support/browser-source-map-support.js:104:348)
   at node_modules/source-map-support/browser-source-map-support.js:105:245
   at Array.map (native)

Desired functionality.

Display the actual error message with details about the error. Here's the output from 1.2.1.

@angular/cli: 1.2.1
node: 6.11.0
os: win32 x64
@angular/animations: 4.3.3
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.2.1
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3

Failed: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at AppComponent.webpackJsonp.../../../../../src/app/app.component.ts.AppComponent.ngOnInit (http://localhost:9876/_karma_webpack_/main.bundle.js:120:33)
    at checkAndUpdateDirectiveInline (http://localhost:9876/_karma_webpack_/vendor.bundle.js:47071:19)
    at checkAndUpdateNodeInline (http://localhost:9876/_karma_webpack_/vendor.bundle.js:48567:17)
    at checkAndUpdateNode (http://localhost:9876/_karma_webpack_/vendor.bundle.js:48506:16)
    at debugCheckAndUpdateNode (http://localhost:9876/_karma_webpack_/vendor.bundle.js:49367:59)
    at debugCheckDirectivesFn (http://localhost:9876/_karma_webpack_/vendor.bundle.js:49308:13)
    at Object.eval [as updateDirectives] (ng:///DynamicTestModule/AppComponent_Host.ngfactory.js:8:5)
    at Object.debugUpdateDirectives [as updateDirectives] (http://localhost:9876/_karma_webpack_/vendor.bundle.js:49293:21)
    at checkAndUpdateView (http://localhost:9876/_karma_webpack_/vendor.bundle.js:48473:14)
    at callWithDebugContext (http://localhost:9876/_karma_webpack_/vendor.bundle.js:49693:42)

Mention any other details that might be useful.

This error is still occurring in 1.3.0-rc.5, the regression was added in 1.2.2, 19f04af.

If a runtime errors occur during the constructor then the proper error displays, but sourcemaps still fail to show line in TypeScript.

It would be best if the actual error and line in typescript could be referenced.

@JSMike JSMike changed the title Regression sourcemaps failing to load during tests if runtime error occurs after constructor Regression wrong error message during tests if runtime error occurs after constructor Aug 7, 2017

@playground

This comment has been minimized.

Copy link

commented Aug 8, 2017

For me it's failing in addEventListner()

  receiveMessage() {
    this.commonService.getNativeWindow().addEventListener(
      'message',
      (e) => {
        if(e.origin.match(/localhost/) && e.data['myIframe']) {
          if(!this.bypassCookie) {
            this.getConfig(e.data);
          }
        }
      }, false)
  }
zone.js:2642 XMLHttpRequest cannot load ng:///DynamicTestModule/MyComponent_Host.ngfactory.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
(anonymous) @ zone.js:2642
proto.(anonymous function) @ zone.js:1227
(anonymous) @ browser-source-map-support.js:107
(anonymous) @ browser-source-map-support.js:101
(anonymous) @ browser-source-map-support.js:107
(anonymous) @ browser-source-map-support.js:101
a @ browser-source-map-support.js:101
b @ browser-source-map-support.js:104
(anonymous) @ browser-source-map-support.js:105
f @ browser-source-map-support.js:105
ExceptionFormatter.stack @ jasmine.js:1500
stack @ jasmine.js:1645
buildExpectationResult @ jasmine.js:1610
expectationResultFactory @ jasmine.js:655
Spec.addExpectationResult @ jasmine.js:342
onException @ jasmine.js:398
onException @ jasmine.js:373
onException @ jasmine.js:1988
handleException @ jasmine.js:1992
attemptSync @ jasmine.js:1952
QueueRunner.run @ jasmine.js:1938
(anonymous) @ jasmine.js:1962
(anonymous) @ jasmine.js:1905
(anonymous) @ testing.es5.js:92
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
webpackJsonp.../../../../zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke @ async-test.js:49
webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke @ proxy.js:76
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:390
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run @ zone.js:141
(anonymous) @ testing.es5.js:87
(anonymous) @ async-test.js:38
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:424
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:191
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:498
ZoneTask.invoke @ zone.js:487
timer @ zone.js:1829
setTimeout (async)
scheduleTask @ zone.js:1839
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:410
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:235
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleMacroTask @ zone.js:258
(anonymous) @ zone.js:1865
proto.(anonymous function) @ zone.js:1227
(anonymous) @ async-test.js:36
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:391
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run @ zone.js:141
webpackJsonp.../../../../zone.js/dist/async-test.js.AsyncTestZoneSpec._finishCallbackIfDone @ async-test.js:35
webpackJsonp.../../../../zone.js/dist/async-test.js.AsyncTestZoneSpec.onHasTask @ async-test.js:68
webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onHasTask @ proxy.js:116
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.hasTask @ zone.js:444
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate._updateTaskCount @ zone.js:464
webpackJsonp.../../../../zone.js/dist/zone.js.Zone._updateTaskCount @ zone.js:288
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:208
drainMicroTaskQueue @ zone.js:595
Promise resolved (async)
scheduleMicroTask @ zone.js:578
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:413
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:235
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleMicroTask @ zone.js:255
webpackJsonp.../../../../zone.js/dist/jasmine-patch.js.jasmine.QueueRunner.ZoneQueueRunner.execute @ jasmine-patch.js:129
queueRunnerFactory @ jasmine.js:714
TreeProcessor.execute @ jasmine.js:2426
Env.execute @ jasmine.js:776
(anonymous) @ adapter.js:336
../../../../../src/test.ts @ test.ts:32
__webpack_require__ @ bootstrap 8398b79f44fceec48211:54
webpackJsonpCallback @ bootstrap 8398b79f44fceec48211:25
(anonymous) @ main.bundle.js:1
zone.js:195 Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/MyComponent_Host.ngfactory.js'.
    at http://localhost:9876/_karma_webpack_/webpack:/Users/ljeff/git_repo/sandbox/angular/~/zone.js/dist/zone.js:2642:1
    at XMLHttpRequest.proto.(anonymous function) [as send] (http://localhost:9876/_karma_webpack_/webpack:/Users/ljeff/git_repo/sandbox/angular/~/zone.js/dist/zone.js:1227:1)
    at Array.<anonymous> (http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:107:176)
    at http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:101:106
    at Array.<anonymous> (http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:107:474)
    at http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:101:106
    at a (http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:101:312)
    at b (http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:104:348)
    at http://localhost:9876/base/node_modules/@angular/cli/node_modules/source-map-support/browser-source-map-support.js:105:245
    at Array.map (<anonymous>)

Running cli 1.2.4

@JSMike

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2017

@playground as a temporary workaround you can run tests with --sourcemaps=false to see the actual error message but lets keep this issue more generic, this issue occurs with any runtime error, as per the example. Your service/function may not be returning what you expect, you'll see a better message with sourcemaps off.

@nathanBrenner

This comment has been minimized.

Copy link

commented Aug 9, 2017

@playground I had this same issue, and when I ran ng test --sourcemaps=false, I got feedback on the test that failed like "TypeError: Cannot read property 'count' of undefined", where I had a child component like this:

<span>{{entity.count}}</span>

Where entity was defined in the parent component, and defined asynchronously. So I added the safe navigation operator to the property binding like {{entity?.count}}, and that error went away.

@playground

This comment has been minimized.

Copy link

commented Aug 9, 2017

@JSMike @nathanBrenner thanks, I will give that a try.

@ciesielskico

This comment has been minimized.

Copy link

commented Aug 17, 2017

@nathanBrenner thanks, disabling sourcemaps for unit tests lets me now debug the actual error

I have a component with a formGroup, and I accessed its status value in my template. During unit-tests the formgroup was undefined, which caused a runtime null-pointer. The error message was the same as OP.

@sharikovvladislav

This comment has been minimized.

Copy link

commented Aug 20, 2017

I have same result on 1.3.0:

sharikovvlad:ng2-diary-book svlad$ ng --version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.3.0
node: 8.3.0
os: darwin x64
@angular/animations: 4.3.5
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.3.5
@angular/compiler: 4.3.5
@angular/core: 4.3.5
@angular/forms: 4.3.5
@angular/http: 4.3.5
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.5
@angular/platform-browser-dynamic: 4.3.5
@angular/router: 4.3.5
@angular/cli: 1.3.0
@angular/compiler-cli: 4.3.5
@angular/language-service: 4.3.5

Same inputs and outputs. I have some component with exception and I get error like topic started mentioned. I expect that I will see exception.

@adrienplg

This comment has been minimized.

Copy link

commented Sep 22, 2017

When the project has been ejected, how can we translate the --source=false option into karma.conf.js options?
#6583 mentions a few options but nothing seems very conclusive.

herkulano added a commit to RADAR-base/RADAR-Dashboard that referenced this issue Sep 22, 2017

adamcoard-maximus pushed a commit to bcgov/MyGovBC-MSP that referenced this issue Oct 20, 2017

Have all unit tests passing, comitting from yesterday.
This was particularly tricky due to an angular-cli bug, documented here:
angular/angular-cli#7296

Recommendation: use `ng test --sourcemaps=false` for now while running unit tests.
@kuncevic

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2017

Had that issue until I just reinstalled the node_modules.
Running angular cli 1.4.9 on Windows with npm 5.5.1, node 8.7.0

@kamok

This comment has been minimized.

Copy link

commented Oct 23, 2017

Sadly, the npm test --source=false flag does not work for me. I still can't see the right error message. I've also tried doing rm -rf node_modules && npm cache clean && npm install.

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.4.4
node: 6.9.1
os: darwin x64
@angular/animations: 4.4.6
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/flex-layout: 2.0.0-beta.9-7dcd97b
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.4
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4
@etaiso

This comment has been minimized.

Copy link

commented Oct 23, 2017

@kamok Try running ng test --sourcemaps=false (and not using npm)

@kamok

This comment has been minimized.

Copy link

commented Oct 23, 2017

@etaiso That was it. I upgraded to the latest node and angular/cli and it still didn't work with npm test. ng test with the --sourcemaps=false allows me to see the error. Thanks.

Edit: So turns out you need another -- to pass arguments into npm scripts. So npm test -- --sourcemaps=false is equivalent to ng test --sourcemaps=false. More here: https://stackoverflow.com/questions/11580961/sending-command-line-arguments-to-npm-script

harunurhan added a commit to harunurhan/ng2-json-editor that referenced this issue Oct 24, 2017

harunurhan added a commit to harunurhan/ng2-json-editor that referenced this issue Oct 24, 2017

upgrade tslint codelyzer, fix test
* Fixes existing lint errors.

* mport FormsModule for required test modules

* Fix failing unit test message  on travis
Reference: angular/angular-cli#7296

* Removes yarn due to failing tests on travis only.
@joey-borowicz

This comment has been minimized.

Copy link

commented Oct 27, 2017

Whether I run ng test --sourcemaps=false or npm test -- --sourcemaps=false I still get [object ErrorEvent] thrown with no further details. Any ideas?

@benelliott

This comment has been minimized.

Copy link

commented Oct 27, 2017

@joey-borowicz full stack trace?

@joey-borowicz

This comment has been minimized.

Copy link

commented Oct 27, 2017

@benelliott sorry, should have been more clear. There is no stack trace, and I was hoping that --sourcemaps=false would produce a more traceable error.
image

@benelliott

This comment has been minimized.

Copy link

commented Oct 27, 2017

@joey-borowicz Have you tried re-enabling source maps, then using the Debug button in the Karma window and opening up your console to see the error?

@joey-borowicz

This comment has been minimized.

Copy link

commented Oct 27, 2017

@benelliott thanks, now I see that I am getting a server error

@sharikovvladislav

This comment has been minimized.

Copy link

commented Oct 27, 2017

@kamok "npm test --anything" is not working. You have to use "npm test -- --anything" to pass parameters to whatever npm test is. So in your case it will be converted to: ng test --anything.

Or you also can just run ng test --anything as mentioned above.

@asnowwolf

This comment has been minimized.

Copy link
Contributor

commented Nov 21, 2017

This approach, ng test -sm=false works, but I do not think it has solved the fundamental problem. I did some experiments today, studied it in depth, and share some results @here, hoping to be helpful.

In Chrome, some additional information appeared in the browser console of Karma DEBUG runner:

ng: ///DynamicTestModule/SandboxComponent.ngfactory.js: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

I think the root cause is here.

So, I switch to Firefox. It works.

So, I think the fundamental reason here is that Chrome's cross-domain detection is stronger than Firefox, blocking the ng:/// protocol in the sourcemaps, causing this issue.

So, I think, maybe we can just replace the "ng: ///" prefix with a prefix such as "http: ///" to resolve this issue.

@Toxicable

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2017

I found that this only happens when an error occurs during CD in my case.
This can range from things like you template referencing components that aren't in the module or having an exception thrown in a lifecycle hook or any view related errors.

to confirm this you can do

it('should fail', () => {
    component.detectChanges();
    component.componentInstance.throw();
    expect(true).toEqual(false);
  })

with your component looking like

throw(){
  throw new Error('err');
}
ngOnInit(){
  throw new Error('err');
}

Now if you run with ng test the browser will hang and eventually crash, you can see the error in the chrome log.
However, if you remove the error from ngOnInit then it throws it as expected and dosen't break
then swapping to ng test --sm=false it always works as expected

@ZeekoZhu

This comment has been minimized.

Copy link

commented May 11, 2018

I solved this problem by using propa?.propb instead of propa.propb in my template, without turn off source map, and the ng:// protocol works well in Chrome.

image

@danguilherme

This comment has been minimized.

Copy link

commented May 25, 2018

Angular CLI v6 doesn't seem to support the --sourcemap=false flag:

$ ng test --sourcemap=false
> Unknown option: '--sourcemap'
ng version

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

Angular CLI: 6.0.3
Node: 8.11.2
OS: darwin x64
Angular: 6.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.1
@angular-devkit/build-angular      0.6.1
@angular-devkit/build-ng-packagr   0.6.3
@angular-devkit/build-optimizer    0.6.1
@angular-devkit/core               0.6.1
@angular-devkit/schematics         0.6.3
@angular/cli                       6.0.3
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.1
@schematics/angular                0.6.3
@schematics/update                 0.6.3
ng-packagr                         3.0.0-rc.5
rxjs                               6.1.0
typescript                         2.7.2
webpack                            4.6.0

@diminutivesloop

This comment has been minimized.

Copy link

commented May 25, 2018

@danguilherme It's still there you just need to configure it via angular.json.

@danguilherme

This comment has been minimized.

Copy link

commented May 25, 2018

@diminutivesloop Thanks, it worked!

Just for completeness, in angular.json the property is called sourceMap.
If the flag --sourceMap=false (note the capital M) is passed, it works.

@FDIM

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2018

In angular 6, the cryptic error message related to http call is now replaced with [object ErrorEvent] thrown

Also for command line: --source-map=false argument continues to work

EDIT: in our case we also ended up getting [object ErrorEvent] thrown when change detection threw an error that a component is destroyed, but something tried to update the view (turned out to be not mocked setTimeout in some previous test). The correct error message was visible in chrome console, but only cryptic one in command line window. This wasn't obvious as we usually run the tests in headless chrome

@Viktor-Bredihin

This comment has been minimized.

Copy link

commented Jul 19, 2018

any update? sourceMap=false doesn't help (angular-cli 6.0.8)

@JSMike

This comment has been minimized.

Copy link
Contributor Author

commented Jul 25, 2018

@Viktor-Bredihin it's --source-map=false now

@mark-wiemer

This comment has been minimized.

Copy link

commented Aug 9, 2018

Using Angular CLI 1.3.2, Angular 4.4.7, and the given demo, I get

Chrome 67.0.3396 (Mac OS X 10.13.6): Executed 0 of 4 DISCONNECTED (10.003 secs / 0 secs)

instead of the failed to execute send. The above workaround still works.

@dirkluijk

This comment has been minimized.

Copy link

commented Aug 17, 2018

We have had this issue for more than a year now. We have to switch between --source-map=true and --source-map=false all the time. Is there a better solution?

@dirkluijk

This comment has been minimized.

Copy link

commented Aug 17, 2018

I have found the cause. It has nothing to do with karma, but the issue is triggered by the source-map-support package which is installed by @angular/cli.

The Angular source maps refer to paths like ng:///DynamicTestModule/YourComponent.ngfactory.js which triggers CORS errors.

Should be fixed by evanw/node-source-map-support#222 and/or by the Angular CLI.

@TitaneBoy

This comment has been minimized.

Copy link

commented Aug 22, 2018

After deleted my node_modules and install them again with yarn, I still have the same issue as described here:

image

Here is my package.json:

{
  "name": "mywebclient",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint --type-check",
    "e2e": "ng e2e",
  },
  "dependencies": {
    "@angular/animations": "6.1.3",
    "@angular/cdk": "6.4.6",
    "@angular/common": "6.1.3",
    "@angular/compiler": "6.1.3",
    "@angular/core": "6.1.3",
    "@angular/flex-layout": "6.0.0-beta.17",
    "@angular/forms": "6.1.3",
    "@angular/http": "6.1.3",
    "@angular/material": "6.4.6",
    "@angular/platform-browser": "6.1.3",
    "@angular/platform-browser-dynamic": "6.1.3",
    "@angular/router": "6.1.3",
    "@ngx-translate/core": "10.0.2",
    "@ngx-translate/http-loader": "3.0.1",
    "@types/chart.js": "2.7.31",
    "bootstrap": "4.1.3",
    "chart.js": "2.7.2",
    "chartjs-plugin-zoom": "0.6.4",
    "core-js": "2.5.7",
    "font-awesome": "4.7.0",
    "hammerjs": "2.0.8",
    "material-design-icons": "3.0.1",
    "ng-event-source": "1.0.11",
    "rxjs": "6.2.2",
    "typedoc": "0.12.0",
    "typescript": "2.9.2",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.7.4",
    "@angular/cli": "6.1.4",
    "@angular/compiler-cli": "6.1.3",
    "@angular/language-service": "6.1.3",
    "@types/jasmine": "2.8.8",
    "@types/jasminewd2": "2.0.3",
    "@types/node": "10.7.1",
    "codelyzer": "4.4.4",
    "jasmine-core": "3.2.1",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "3.0.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-cli": "1.0.1",
    "karma-coverage": "1.1.2",
    "karma-coverage-istanbul-reporter": "2.0.1",
    "karma-firefox-launcher": "1.1.0",
    "karma-jasmine": "1.1.2",
    "karma-jasmine-html-reporter": "1.3.1",
    "karma-json-reporter": "1.2.1",
    "karma-junit-reporter": "1.2.0",
    "ngx-i18nsupport": "0.17.0",
    "protractor": "5.4.0",
    "ts-node": "7.0.1",
    "tslint": "5.11.0"
  }
}

jjelschen added a commit to test-editor/web-testeditor-commons that referenced this issue Sep 20, 2018

disable source maps for unit testing
workaround for known bug in Angular CLI
angular/angular-cli#7296
@felikf

This comment has been minimized.

Copy link

commented Sep 24, 2018

In my case the error was reported to unrelated test, tried to comment out tests until I found the cause.

The test alone (fit) was passing but with all test running failed causing jasmine to report other test as faield - not sure why.

In my case I was missing the error handler in subscribe() function:

service.getOperations().subscribe(() => {
      fail('Should not be here.');
    },
      () => { /* must be defined in order to test success */ }, // after adding this the error disappeared
      () => { });
@djindjic

This comment has been minimized.

Copy link

commented Sep 24, 2018

I found same solution like @felikf

gunther-bachmann added a commit to test-editor/web-testeditor-commons that referenced this issue Sep 24, 2018

migrate and adapt indicator box component from workspace navigator (#20)
* migrate and adapt indicator box component from workspace navigator

* disable source maps for unit testing

workaround for known bug in Angular CLI
angular/angular-cli#7296
@hansl

This comment has been minimized.

Copy link
Contributor

commented Sep 27, 2018

Closing this as I cannot reproduce locally the first issue on master:

image

Please note that the comments about subscription and asynchronicity in Jasmine are not CLI issues, and are working as intended. Do you need to have a done argument in your Jasmine test handler? That might be the cause, if your tests are asynchronous and not handling Zone properly.

@hansl hansl closed this Sep 27, 2018

@hansl

This comment has been minimized.

Copy link
Contributor

commented Sep 27, 2018

If you find a similar or different issue, please open a new issue so we can track that one. Original issue was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.