【发布时间】:2015-04-26 17:56:53
【问题描述】:
我的 jasmine-node 测试执行了两次。
我从 Grunt 任务和 Jasmine 命令运行这些测试。结果是一样的,我的测试运行了两次。 我的 package.json :
{
"name": "test",
"version": "0.0.0",
"dependencies": {
"express": "4.x",
"mongodb": "~2.0"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-jasmine-node":"~0.3.1 "
}
}
这是我的 Gruntfile.js 提取:
grunt.initConfig({
jasmine_node: {
options: {
forceExit: true,
match: '.',
matchall: true,
extensions: 'js',
specNameMatcher: 'spec'
},
all: ['test/']
}
});
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.registerTask('jasmine', 'jasmine_node');
我的一个测试文件:
describe("Configuration setup", function() {
it("should load local configurations", function(next) {
var config = require('../config')();
expect(config.mode).toBe('local');
next();
});
it("should load staging configurations", function(next) {
var config = require('../config')('staging');
expect(config.mode).toBe('staging');
next();
});
it("should load production configurations", function(next) {
var config = require('../config')('production');
expect(config.mode).toBe('production');
next();
});
});
我有 4 个断言的 2 个测试文件
这是我的提示:
grunt jasmine
Running "jasmine_node:all" (jasmine_node) task
........
Finished in 1.781 seconds
8 tests, 8 assertions, 0 failures, 0 skipped
你有什么想法吗?
【问题讨论】:
-
你的问题解决了吗?
-
你好,很遗憾没有,然后我转移到摩卡测试
标签: node.js tdd jasmine jasmine-node