【发布时间】:2014-11-21 06:28:49
【问题描述】:
我有一个 AngularJS 应用程序。我正在 typescript 中使用 jasmine(由 karma 运行)编写它的单元测试。以下是我的单元测试的简化 sn-p:
///<reference path="../typings/angularjs/angular.d.ts" />
///<reference path="../typings/jasmine/jasmine.d.ts" />
describe('ABC', () => {
var abc : any;
var $httpBackend : any;
beforeEach(() => {
module('xyz');
inject((_abc_, _$httpBackend_) => {
abc = _abc_;
$httpBackend = _$httpBackend_;
});
});
});
当我执行 grunt build 时,出现以下错误:
error TS2095: Could not find symbol 'module'.
error TS2095: Could not find symbol 'inject'.
我哪里错了?我添加了 Angular 的输入,但它仍然没有被识别。请注意,通过添加 jasmine 输入,describe、beforeEach 等会被 typescript 编译器识别。
【问题讨论】:
标签: angularjs typescript jasmine