我很難讓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