繁体   English   中英

让Jasmine在服务器端运行

[英]Getting Jasmine to run on the server-side

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

我正在使用gruntgrunt-jasmine-node ,但我无法让它运行我的测试。

它只是记录

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

完成0.001秒0测试,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调用来测试它。

或者:

  • 确保您的javascript测试规范的扩展名为.spec.js

要么

  • matchall: true替换配置选项specNameMatcher

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM