簡體   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