Angular 6 for Enterprise:Ready Web Applications
上QQ阅读APP看书,第一时间看更新

Generic ErrorEvents

Error events are generic errors that hide the underlying cause:

[object ErrorEvent] thrown

To expose the root cause of a generic error, implement a new test:debug script:

  1. Implement test:debug, as shown, in package.json:
package.json
...
"scripts": {
...
"test:debug": "ng test --sourcemaps=false",
...
}
  1. Execute npm run test:debug
  2. Now the Karma runner will likely reveal the underlying issue
  3. If necessary, follow the stack trace to find the child component that may be causing the issue

If this strategy is not helpful, you may be able to glean more information on what's going wrong by break point debugging your unit tests.