Closed
Description
I created a new blank angular 9 project using next commands:
ng new my-app
npm install
ng serve
I added then()
to test:
Then run:
ng test
Error occured:
ERROR in src/app/app.component.spec.ts:20:30 - error TS2339: Property 'then' does not exist on type 'boolean'.
20 expect(app).toBeTruthy().then(() => { });
~~~~
After removing "@types/jasminewd2": "~2.0.3", from package.json, deleting then() of course and running:
npm install
ng test // no compilation error
Visual studio code reported that expect() matcher is sync method and returns boolean instead of Promise, just removed the .then() and everything works as it should.
## my environment
**Angular Version:**
Angular CLI: 9.1.1
Node: 12.16.1
OS: win32 x64
Angular: 9.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.1
@angular-devkit/build-angular 0.901.1
@angular-devkit/build-optimizer 0.901.1
@angular-devkit/build-webpack 0.901.1
@angular-devkit/core 9.1.1
@angular-devkit/schematics 9.1.1
@angular/cli 9.1.1
@ngtools/webpack 9.1.1
@schematics/angular 9.1.1
@schematics/update 0.901.1
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
D:\my-app>node -v
v12.16.1
D:\my-app>npm -v
6.13.4
Not really sure this is an Angular bug, but package @types/jasminewd2 comes by default I suppose.