为什么业力不执行任何测试?

时间:2015-02-27 20:02:18

标签: javascript jasmine karma-jasmine jhipster

我创建了一个JHipster项目并创建了一个javascript规范,但是当我运行 karma start 时,我得到了这个输出:

~/projetos/consami/src/test/javascript$ karma start
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Linux)]: Connected on socket -yuANSJ71nx8EeeomeZW with id 73836995

这是JHipster提供的配置:

module.exports = function (config) {
config.set({
    basePath: '../../',
    frameworks: ['jasmine'],
    files: [
        'main/webapp/bower_components/modernizr/modernizr.js',
        'main/webapp/bower_components/jquery/dist/jquery.js',
        'main/webapp/bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
        'main/webapp/bower_components/json3/lib/json3.js',
        'main/webapp/bower_components/angular/angular.js',
        'main/webapp/bower_components/angular-ui-router/release/angular-ui-router.js',
        'main/webapp/bower_components/angular-resource/angular-resource.js',
        'main/webapp/bower_components/angular-cookies/angular-cookies.js',
        'main/webapp/bower_components/angular-sanitize/angular-sanitize.js',
        'main/webapp/bower_components/angular-translate/angular-translate.js',
        'main/webapp/bower_components/angular-translate-storage-cookie/angular-translate-storage-cookie.js',
        'main/webapp/bower_components/angular-translate-loader-partial/angular-translate-loader-partial.js',
        'main/webapp/bower_components/angular-dynamic-locale/src/tmhDynamicLocale.js',
        'main/webapp/bower_components/angular-local-storage/dist/angular-local-storage.js',
        'main/webapp/bower_components/angular-cache-buster/angular-cache-buster.js',
        'main/webapp/bower_components/angular-mocks/angular-mocks.js',
        'main/webapp/scripts/app/app.js',
        'main/webapp/scripts/app/**/*.js',
        'main/webapp/scripts/components/**/*.js',
        'test/javascript/**/!(karma.conf).js'
    ],

    exclude: [],
    port: 9876,
    logLevel: config.LOG_INFO,
    autoWatch: false,
    browsers: ['PhantomJS'],
    singleRun: false
});
};

我是业力新手,但它应该显示规格的执行,不是吗?

新信息

我不知道它是否正确,但当我在Chrome中打开karma时,导入javascript的唯一行是:

<script src="socket.io/socket.io.js"></script>
<script src="karma.js"></script>

我可能错了,但它不应该加载文件数组中的所有文件吗?

2 个答案:

答案 0 :(得分:2)

karma start --browsers Chrome --single-run您要找的是什么?

答案 1 :(得分:1)

我最终找到了解决方案:

安装karma-jasmine-html-reporter并执行:

karma start src/test/javascript/karma.conf.js --reporters html

现在,我可以在浏览器中单击调试按钮,看到测试结果。