[英]Getting started with Karma and Jasmine installed - jasmine.Suite() required error
I'm trying to get started with karma and jasmine. 我正试图开始使用业力和茉莉。
I've installed them both. 我已经安装了它们。 I believe that Karma can locate my JavaScript files.
我相信Karma可以找到我的JavaScript文件。 When I run
karma start
, my browsers open and state: 当我运行
karma start
,我的浏览器打开并说明:
Karma v0.12.23 - connected
IE 11.0.0 (Windows 8.1) is idle
Firefox 29.0.0 (Windows 8.1) is idle
Chrome 37.0.2062 (Windows 8.1) is idle
I added a JavaScript file to a location that I thought Karma was monitoring: 我将一个JavaScript文件添加到我认为Karma正在监控的位置:
it('y should have a length of 1', function () {
var y = '1';
expect(y.length).toBe(0);
});
Where would I look to see the unit test fail? 我在哪里看到单元测试失败?
If I open resharper in vs2013, I see the unit test. 如果我在vs2013中打开resharper,我会看到单元测试。 When I go to run it, a new browser window opens, and it's blank.
当我去运行它时,会打开一个新的浏览器窗口,它是空白的。 The console does show on this page:
控制台确实显示在此页面上:
ncaught Error: jasmine.Suite() required
How do I get it to pick up my test? 如何让它拿起我的考试?
As described in the Jasmine nomenclature a suite 如茉莉花命名法中所述
Suites: describe Your Tests
套房:描述您的测试
A test suite begins with a call to the global Jasmine function describe with two parameters: a string and a function.
测试套件以对两个参数的全局Jasmine函数描述的调用开始:字符串和函数。 The string is a name or title for a spec suite – usually what is being tested.
字符串是规范套件的名称或标题 - 通常是正在测试的内容。 The function is a block of code that implements the suite.
该函数是一个实现套件的代码块。
So I guess you have to wrap your test in a describe statement
所以我想你必须在一个
describe statement
包装你的测试
describe('my test suite',function(){
it('my test case',function(){
//some assertions
})
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.