2014-11-01 94 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