茉莉花穿梭在咕噜噜唧唧喳喳的失败
我为我的插件创build了一些茉莉花testing。
他们都通过浏览器(铬),但由于某种原因,当我在我的terminal使用“grunt-contrib-jasmine”任务,他们大多失败。
这里是一个例子:
it("scroll to the correct floor", function() { // return and instance of my plugin (ascensor) var ascensor = getInstanceOfAscensor({}); var floorArray; // Triggered when 'next' is triggered ascensor.on("scrollStart", function(event, floor) { // floor look like {from:0, to:1} floorArray = floor; }); // trigger an 'next' event which // trigger a 'scrollStart' // event inside the plugin ascensor.trigger("next"); // Spec expect(floorArray.from).toBe(0); expect(floorArray.to).toBe(1); }); Terminal Output: TypeError: 'undefined' is not an object (evaluating 'floorArray.from')
完整的testing: https : //github.com/kirkas/Ascensor.js/blob/master/test/spec/optionsSpec.js
我发现这个问题,我使用了jasmine-jquery中的loadFixtures
函数,它指向一个相对path( "spec/javascripts/fixtures"
)。
解决的办法是把这条线放在我testing的顶部,这是指夹具文件夹。
jasmine.getFixtures().fixturesPath = 'path/to/your/fixture';
- Yeoman Angular.js grunt serve-d应用从livereload.js有很长的延迟?snipver = 1
- grunt-contrib-connect代理给出错误500.如何debugging?
- 在另一个任务之前asynchronous运行grunt任务
- AWS Elastic Beanstalk运行Grunt任务
- Yeoman返回'env:node \ r:没有这样的文件或目录'
- grunt-contrib-jshint警告:path必须是string;
- gruntjs服务器任务的目的是什么?
- 如何在节点中使用spec – grunt + karma + jasmine
- 我如何使用GruntJS运行一个特定的CucumberJSfunction?