Closed duncanhunter closed 8 years ago
+1
Did you figure this out?
Getting the same...
try noResolve: false
When I added something like...
/// <reference path="../_typings/jasmine/jasmine.d.ts" />
... to the top of my specs.ts file, it worked. Not sure why I need it here and not other places.
Hi @cwiederspan I still have the same issue now even though I've included jasmine to my spec file. I'm unsure still too as to why I need it here...
Any suggestions?
/// <reference path="../../../../typings/tsd.d.ts" />
/// <reference path="../../../../typings/jasmine/jasmine.d.ts" />
describe("CampaignsService", () => {
var $httpBackend : ng.IHttpBackendService;
var campaignsService : ICampaignsService;
beforeEach(module('olCampaigns'));
beforeEach(() => {
inject(function ( _$httpBackend_, _Campaigns_) {
$httpBackend = _$httpBackend_;
campaignsService = _Campaigns_;
});
});
afterEach(function () {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it("should initialize correctly", () => {
expect(campaignsService).toBeDefined();
});
it("should GET campaigns", () => {
$httpBackend.expectGET("campaigns.json").respond([
{"id": "1", "name": "Campaign 1", "description": "My new campaign", "status": "live", "start": new Date(2015, 6, 2), "end": new Date(2016, 3, 5),"createdAt": new Date(2015, 6, 2),
"updatedAt": new Date(2016, 3, 5)},
{"id": "2", "name": "Campaign 2", "description": "My old campaign", "status": "complete", "start": new Date(2014, 3, 3), "end": new Date(2015, 3, 5), "createdAt": new Date(2015, 6, 2),
"updatedAt": new Date(2016, 3, 5)}
]);
var campaigns = campaignsService.query(function(){
expect(campaigns).toBeDefined();
});
$httpBackend.flush();
});
});
I get the error error TS2304: Cannot find name 'module'
in line 10. Any suggestions as to how to best include this module?
This is resolved after I change my karma.config.js to:
noResolve: false.
have you guys tried including tsd.d.ts to the beginning of the globs?
adding reference on jasmine definitions in the spec file should fix the issue
Hi
Thanks for a great tool
When I run the below test I get a successful result (shown below) but only after I get an error for every jasmine symbol in the spec file.
example error and then passing tests:
ERROR [preprocessor.typescript]: C:/app/foodTracker/foodTracker.controller.spec.ts.ktp.ts(23,9): error TS2304: Cannot find name 'expect'. PhantomJS 1.9.8 (Windows 8): Executed 3 of 3 SUCCESS (0.004 secs / 0.002 secs)
example spec file