让Jasmine在服务器端运行

我正在尝试开始使用Node.JS在服务器端testingJavaScript

我正在使用gruntgrunt-jasmine-node ,但我无法运行我的testing。

它只是logging

PS C:\ Development \ NET \ Source \ jsn> grunt运行“jasmine_node”任务未定义

在0.001秒内完成0个testing,0个断言,0个失败

完成,没有错误。

这是我的Gruntfile.js

 module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jasmine_node: { specNameMatcher: 'spec', projectRoot: '.', requirejs: false, forceExit: true, jUnit: { report: false, savePath : "./build/reports/jasmine/", useDotNotation: true, consolidate: true } } }); grunt.loadNpmTasks('grunt-jasmine-node'); grunt.registerTask('default', 'jasmine_node'); }; 

而我的文件结构是这样的:

enter image description here

那么,我做错了什么?

这就像stub.js文件甚至没有加载,因为它有一个console.log调用来testing。

或者:

  • 确保JavaScripttesting规范的扩展名是.spec.js

要么

  • specNameMatcherreplaceconfiguration选项matchall: true