每当我执行 loadFixture()
调用或在此文本下进行测试时,我都会收到一条错误消息:
Frontend should be able to set fixtures.
TypeError: undefined is not a function
TypeError: undefined is not a function
at jasmine.Fixtures.cleanUp (http://localhost:4567/__spec__/helpers/jasmine-jquery.js:89:5)
at null.<anonymous> (http://localhost:4567/__spec__/helpers/jasmine-jquery.js:641:27)
at jasmine.Block.execute (http://localhost:4567/__jasmine__/jasmine.js:1064:17)
at jasmine.Queue.next_ (http://localhost:4567/__jasmine__/jasmine.js:2096:31)
at http://localhost:4567/__jasmine__/jasmine.js:2086:18
it("should be able to set fixtures", function() {
expect(setFixtures).toBeDefined(); // Notice I took out the ()
});
jasmine-jquery 似乎已加载,否则我会收到 ReferenceError: setFixtures is not Defined
错误。
有任何关于发生什么事的线索吗?
最佳答案
我发现出了什么问题。为了将来引用,我自己回答这个问题:
我的 jasmine-jquery 在我的 jquery 文件之前加载。切换这些就成功了。
关于 Jasmine -jQuery 'undefined is not a function',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20948957/