Can't run tests - property "toBeDefined" is missing
Pirozek opened this issue · comments
Hi,
I am trying to use your starter kit and I have encountered problem with tests. Normal build gulp serve-dev
is running just fine, but gulp test
gives me this error - app\app.component.spec.ts(42,34): error TS2339: Property 'toBeDefined' does not exist on type 'NgMatchers'.
Any idea how to solve this? I have tried to manually install jasmine typings, but it doesn't solve the issue :-(
Thanks for reporting, looks like it's angular2 typings problem, can you try on gulp tsc
, gulp tsc-unit
?
Hi, thans for quick response!
`C:\xampp\htdocs\angular2-starter>gulp tsc
[09:37:24] Using gulpfile C:\xampp\htdocs\angular2-starter\gulpfile.js
[09:37:24] Starting 'clean-ts-app'...
[09:37:24] Starting 'clean-ts-test'...
[09:37:24] Finished 'clean-ts-app' after 22 ms
[09:37:24] Finished 'clean-ts-test' after 17 ms
[09:37:24] Starting 'clean-ts'...
[09:37:24] Finished 'clean-ts' after 18 us
[09:37:24] Starting 'tsc'...
app\app.component.spec.ts(42,34): error TS2339: Property 'toBeDefined' does not exist on type 'NgMatchers'.
C:\xampp\htdocs\angular2-starter>gulp tsc-unit
[09:38:31] Using gulpfile C:\xampp\htdocs\angular2-starter\gulpfile.js
[09:38:31] Starting 'clean-ts-test'...
[09:38:31] Finished 'clean-ts-test' after 21 ms
[09:38:31] Starting 'tsc-unit'...
app\app.component.spec.ts(42,34): error TS2339: Property 'toBeDefined' does not exist on type 'NgMatchers'.
`
How about removing expect
from imports? that means we will use original matcher
Not working -> app\app.component.spec.ts(40,17): error TS2304: Cannot find name 'expect'.
Can you verify the typings installed correctly? It should be loaded through typings/browser.d.ts
, and have jasmine reference
I think it's OS related issue since it works on mine
Hmm... I don't have browser.d.ts
in typings directory, I only have tsd.d.ts
with /// <reference path="jasmine/jasmine.d.ts" />
inside. Where do I get browser.d.ts
? I thought it is generated
it should be done through post npm install
, please remove typings
folder and run typings install
Ha! Nice! :) It seems to be working now, only karma bitches about PhantomJS 09 03 2016 10:01:07.575:WARN [launcher]: Can not load "PhantomJS", it is not registered!
but that Windows specific problem and I will solve it on my own. Thank you very much for your help!
My pleasure 😃