可能有三个人在做我正在做的事情,但这里是:
- Visual Studio 2012
- 最新网络精华
- TypeScript 项目
- AngularJS 框架
- 使用 Jasmine 运行 Chutzpah 测试
在为 Chutzpah 创建测试时,我不仅需要添加对我的 typescript 文件的引用,还需要添加对我正在使用的 javascript 库的引用。例如:
// Typescript References (for tsc)
/// <reference path="../ref/angular-1.0.d.ts" />
// JavaScript references (for chutzpah)
/// <reference path="../lib/angular.min.js" />
// TS references for what we're actually testing...
/// <reference path="../src/modules.ts" />
使用此设置,我的 typescript 编写的 jasmine 测试运行良好。但是,angular.min.js 文件用数百个投诉填满了我的错误列表。这使得无法找到 typescript 语法检查器报告的错误。
如果我删除对 angular.min.js 的引用,那么 Chutzpah 将无法运行,因为我的代码依赖于该库。
有没有办法强制 Visual Studio 忽略特定 JavaScript 文件引用中的错误?
最佳答案
此问题现已在 Chutzpah 2.4 中解决.
Chutzpah Specific Reference
With the addition of TypeScript support a few releases ago several people reported issues when using Chutzpah with the TypeScript plugin in VS. The problem occurs since both TypeScript and Chutzpah are using the comments for different purposes. To get around this issue Chutzpah now supports two ways to reference dependent files.
The existing general way
/// <reference path="foo.js" />
The new Chutzpah specific way
/// <chutzpah_reference path="foo.js" />
Using the latter will let Chutzpah know about your dependency graph and should not confuse the TypeScript compiler.
关于visual-studio-2012 - Visual Studio 错误列表 : Ignore a JavaScript reference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14487388/