Jasmine -jQuery 'undefined is not a function'

标签 jasmine middleman jasmine-jquery

每当我执行 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/

相关文章:

jasmine - 助焊剂商店 - 单元测试

angular - ActivatedRoute Angular 7 的 Jasmine 测试

javascript - Jasmine Jquery Spy AJAX完整功能

ruby - 如何启动中间人?无法加载此类文件 -- less (LoadError)

Javascript JsTestDriver Jasmine 和 Jasmine-jquery

javascript - 在 Jasmine 中测试 SVG 对象时遇到问题

javascript - Jasmine 是否有类似最小起订量的 It.IsAny?

angularjs - Protractor 测试: Can someone tell me what I'm doing wrong with Require?

javascript - 如何成功地将 Middleman frontmatter 变量集成到用 haml 编写的布局页面中的 javascript 片段中?

ruby - 在中间人中包含纯 HTML 部分