2014-11-01 121 views
2

我正在建立一個新的項目,並試圖獲得業力工作。當我運行業力,它不斷報告:噶沒有運行茉莉花規格

執行0或0錯誤。

此時我的項目只包含幾個js文件和一個test.js文件。這裏是我的karma.conf.js:

module.exports = function(config) { 
    config.set({ 

    // base path that will be used to resolve all patterns (eg. files, exclude) 
    basePath: '', 


    // frameworks to use 
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 
    frameworks: ['jasmine'], 


    // list of files/patterns to load in the browser 
    files: [ 
     {pattern: '../app/**/*.js', included: false}, 
     {pattern: '**/*.js', included: false} 
    ], 


    // list of files to exclude 
    exclude: [], 


    // preprocess matching files before serving them to the browser 
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 
    preprocessors: { 
    }, 


    // test results reporter to use 
    // possible values: 'dots', 'progress' 
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter 
    reporters: ['progress'], 


    // web server port 
    port: 9876, 


    // enable/disable colors in the output (reporters and logs) 
    colors: true, 


    // level of logging 
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 
    logLevel: config.LOG_DEBUG, 


    // enable/disable watching file and executing tests whenever any file changes 
    autoWatch: true, 


    // start these browsers 
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 
    browsers: ['Chrome'], 


    // Continuous Integration mode 
    // if true, Karma captures browsers, runs the tests and exits 
    singleRun: false, 

    plugins: [ 
     'karma-jasmine', 
     'karma-chrome-launcher', 

    ] 
    }); 
}; 

我可以看到,它是通過打開日誌調試加載我的測試文件,我看到:

DEBUG [watcher]: Resolved files: 
    ... 
    c:/dev/forms/tests/forms/form-page-controller-tests.js 
    ... 

的內容形式,頁面級控制器tests.js是:

describe("A suite", function() { 
    it("contains spec with an expectation", function() { 
     expect(true).toBe(true); 
    }); 
}); 

然而它,如果我有茉莉框架規定仍然說伏法的0.0和茉莉插件指定的,爲什麼它沒有看到,並執行這個測試?

回答

6

您聲明{pattern: '**/*.js', included: false}作爲文件模式。這告訴業力不要加載任何JS文件,包括你的測試文件。 嘗試將included更改爲true

+0

D'oh!我怎麼沒有看到這一點。謝謝。 – 2014-11-06 01:03:45