Closed
Description
I'm getting the following error when I run unit tests in an Angular-CLI-created project that injects NgRedux
into its main AppComponent
.
D:\VST\IssueDemoProj>ng test
Chrome 53.0.2785 (Windows 7 0.0.0) ERROR: 'Unhandled Promise rejection:', TypeError{},
'; Zone:', '<root>', '; Task:', 'Promise.then', '; Value:', TypeError{}
...
D:\> ng -v
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: win32 x64
I'm not sure what the root cause might be...but so far I've only experienced this issue if I inject NgRedux.
Steps to reproduce
ng new IssueDemoProj
cd IssueDemoProj
ng serve
(fails with TypeScript issues)- refer to this issue
- Fix by uninstalling and re-installing TypeScript
npm uninstall --save-dev typescript
npm install --save-dev typescript@beta
ng serve
works now
ng test
(different console whileng serve
is still active, runs ok)npm i --save redux ng2-redux
- In
AppModule
,import { NgRedux } from 'ng2-redux';
@NgModule({
...providers: [NgRedux]
...})
- In
AppComponent
,import { NgRedux } from 'ng2-redux';
constructor(private ngRedux: NgRedux<{ prop1: string }>) { }
ng test
(fails now)- Reports different error than aforementioned
'Unhandled Promise rejection:'
... - To see above error, fix up
\node_modules\karma\lib\reporter.js
to handle objects per this issue- Just above
msg = (msg || '').replace(...
line, insertif (msg && typeof (msg) !== 'string') { msg = JSON.stringify(msg); }
- Just above
- Reports different error than aforementioned
- In
AppComponent
, delete the constructor- I.e., remove
private ngRedux: NgRedux<{ prop1: string }>
injection
- I.e., remove
ng test
(works now)
Any ideas as to what might be the root cause here?