您如何使用Jasmine + Resharper引用外部库 [英] How do you reference external libraries with Jasmine + Resharper
问题描述
我有一个问题,通常在html页面(即我的case Ext-Js)的任何Javascript引用,那么我不能使用Resharper测试运行器,因为你似乎没有访问Resharper使用的HTML页面。 (我认为它是生成的,因为我无法找到它在磁盘上)
我在想,如果有一种方法来调用或加载您的外部库引用从Javascript测试文件直接而不是通过html页面,然后我可以得到这个工作。我还没有发现是否可以使用Javascript(或Ext-Js)。
似乎目前的方式是将include语句硬编码为套件文件中的特殊注释(称为文档注释引用),例如:
//包含外部文件:
///< reference path =/ path / to / external-file.js/>
//像往常一样写你的测试套件:
describe('愚蠢的套件',function(){
it('应该测试一些事情发生',function ){
expect(something).toBe('occurrence');
});
});
请参阅 ReSharper社区的这个线程,作为这个建议的来源。
I can run Jasmine unit tests from the Resharper 8.0 unit test runner. I have a problem where any Javascript references that are normally in the html page (ie in my case Ext-Js) then I can't use the Resharper test runner, as you don't seem to have access to the HTML page that Resharper uses. (I assume it's generated as I could not locate it on disk)
I was thinking if there is a way to call or load your external library references from the Javascript test file directly instead of via the html page, then I could get this to work. I've not found if that is possible with Javascript (or Ext-Js) yet.
It seems the way to go at the moment is hardcoding include statements as special comments in the suite file (called doc-comments references), e.g.:
// include external files like so:
/// <reference path="/path/to/external-file.js" />
// than write your testing suite as usual:
describe('a silly suite', function() {
it('should test something is happening', function() {
expect(something).toBe('happening');
});
});
See this thread on the ReSharper community, as the source of this recommendation.
这篇关于您如何使用Jasmine + Resharper引用外部库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!