为什么 Karma 启动一个空的浏览器 window?

Why Karma launch an empty browser window?

Karma 是否应该启动加载了我的前端应用程序的浏览器?

如果正确加载了 Karma,我应该会看到我的应用程序的登录页面,对吗?

如果不加载我的应用登录页面,为什么 Karma 会启动一个可见的浏览器?

这是我的karma.config.js 我正在学习业力,不确定我是否做的一切都好。

var webpackConfig = require('./webpack.config.js');
webpackConfig.entry = {};
/*
The entry point from the referenced Webpack configuration 
has to be removed or tests will fail in weird and inscrutable 
ways. Easy enough, just define an empty entry object.
*/

module.exports = function(config) {
  config.set({
    bathPath: './dist/',
    webpack: webpackConfig,
    /* reference the Webpack configuration in the Karma configuration */
    preprocessors: {
        // './dist/bundle.js': ['webpack'],
        './test/*.js': ['webpack']
        /* application’s entry point, karama-webpack plugin requires this */
        /* you have to tell Karma that you want the karma-webpack plugin 
           to process these files. That’s what ['webpack'] does.
        */
    },
    /* 
            The plugins section is missing from my karma.config.js file. 
            When missing, Karma will load any plugins it can find in the 
            node-modules folder. Much simpler in my opinion.
    */
    frameworks: ['jasmine'],
    files: [ {pattern: 'index.html', }, './test/*.js'],
    /* The files array determines which files are included in the 
       browser and which files are watched and served by Karma 
    */
    browsers: ['Chrome'],
    reporters: ['progress'],
    port: 9876
  });
};

这是正确的。 Karma 会加载一个页面,其中包含您的所有 javascript 和所有规格。然后它会运行其中可能存在的任何规范。这不是 完全集成 测试。这是 javascript 单元测试。

如果你想在浏览器中调试,你可以点击debug按钮,你会看到它运行的页面。点击该页面并查看控制台,您将看到您的规范输出。

您需要更多的东西来进行完整的集成测试,例如 protractorcapybara 或 ...

可能取决于您用来构建网站的内容。