我很难让JSTD加载一个夹具HTML文件。当我使用JsTestDriver时,我在哪里放置HTML装置?
我的目录结构是:
localhost/JsTestDriver.conf
localhost/JsTestDriver.jar
localhost/js/App.js
localhost/js/App.test.js
localhost/fixtures/index.html
我的conf文件说:
server: http://localhost:4224
serve:
- fixtures/*.html
load:
- http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js
- jasmine/lib/jasmine-1.1.0/jasmine.js
- jasmine/jasmine-jquery-1.3.1.js
- jasmine/jasmine-jstd.js
- js/App.js
test:
- js/App.test.js
我的测试是:
describe("App", function(){
beforeEach(function(){
jasmine.getFixtures().fixturesPath = 'fixtures';
loadFixtures('index.html'); **//THIS LINE CAUSES IT TO FAIL**
});
describe("When App is loaded", function(){
it('should have a window object', function(){
expect(window).not.toBe(null);
});
});
});
我的控制台输出为:
我看着this question但它并没有帮助我找到答案。奇怪的是,当我注释掉
loadFixtures('index.html');
行,测试通过。
任何想法?
然后我得到“错误:Fixture无法加载:/fixtures/index.html(status:error,message:undefined)”。无论如何感谢:) – marclar 2012-01-18 22:11:14
你最终解决这个问题吗?我得到了确切的错误,虽然有时它会更改为浏览器错误 – 2012-03-08 23:40:34
嘿,戴夫 - 我在上面添加了我的答案,以防您仍在寻找。 – marclar 2012-06-05 14:44:24