karma plugin issue

Run any karma test that has a failing test - it will be marked as a failure.

Correct the test, save the file, and re-run the test; don't stop the running karma server.

It is still marked as a failure - it's like the file was never changed.

If you completely stop the karma server and re-launch the test it works correctly. Also, because of this, selecting the "auto-test" toggle does not work either  (nice feature btw, - use it a lot)

 

IntelliJ IDEA 2016.3 EAP
Build #IU-163.7342.3, built on November 1, 2016
IntelliJ IDEA EAP User
Expiration date: December 1, 2016
JRE: 1.8.0_112-release-408-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Karma Plugin:

Version: 163.6110.28

Integration with Karma, a spectacular test runner for JavaScript
Vendor
JetBrains

0
3 comments

What karma packages do you use? Please attach your karma.config.json

0
Avatar
Permanently deleted user
'use strict';

let path = require('path'),
webpackConfig = require('./webpack.config'),
targetBrowsers = [],
isProd = process.env.NODE_ENV === 'production',
plugins = [
'karma-webpack',
'karma-jasmine',
'karma-htmlfile-reporter',
'karma-coverage',
'karma-spec-reporter',
'karma-source-map-support',
'karma-sourcemap-loader'
],
hasCoverage = global.process.argv.reduce((result, arg) => arg.indexOf('coverage') !== -1 || result, false),
include = [path.resolve('./app')],
webpack_module = {
preLoaders: hasCoverage && isProd ? [
// Load src files through isparta for transpiling + instrumentation; exclude .spec and .conf files + modules
{
test: /\.js$/,
loader: 'isparta',
include: /app/,
exclude: [/\.(?:spec|conf)\.js$/, /node_modules/, /app/]
},
// Load .spec and .conf files through babel for transpiling
{
loader: 'babel',
test: /\.(?:spec|conf)\.js$/,
include: /app|test/
}
] : [],
loaders: webpackConfig.module.loaders
};

if (isProd) {
targetBrowsers.push('PhantomJS');
plugins.push('karma-phantomjs-launcher')
}
else {
targetBrowsers.push('Chrome');
plugins.push('karma-chrome-launcher');
}

if (hasCoverage)
webpack_module.postLoaders = [{
test: /\.js$/,
include: include,
loader: 'istanbul-instrumenter'
}];

module.exports = (config) => {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',

// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine', 'source-map-support'],

// list of files / patterns to load in the browser
files: ['spec.js'],
webpack: {
devtool: 'inline-source-map',
module: webpack_module,
cache: true
},
webpackMiddleware: {
stats: {
chunkModules: false,
colors: true
}
},

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

//
// For unit tests to run successfully, you must be on the finra.org domain
//
// Edit this file as Admin: C:\Windows\System32\drivers\etc\hosts (On Windows)
// Add this entry to the end:
// 127.0.0.1 localhost local.finra.org
// Access your web server this way:
// http://local.finra.org
//
hostname: 'localhost',
port: 9018,
runnerPort: 9100,
colors: true,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.ERROR,

preprocessors: {
'spec.js': ['webpack', 'sourcemap'],
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'src/*.js': ['coverage']
},

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

// it is kinda slow with Jenkins
browserNoActivityTimeout: 100000,
browsers: targetBrowsers,

coverageReporter: {
dir: 'coverage/',
subdir: '.',
reporters: [
{type: 'text', file: 'text.txt'},
{type: 'text-summary', file: 'text-summary.txt'},
{type: 'lcov'},
{type: 'clover'}
]
},

plugins: plugins,

reporters: ['progress', 'html', 'spec', 'coverage'],

htmlReporter: {
outputFile: 'test/unit.html'
},

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true
});
};
0

I see. The problem is that the actual spec files you are editing are not loaded by karma - it loads the generated bundle instead. Please see https://youtrack.jetbrains.com/issue/WEB-21308#comment=27-1411115

0

Please sign in to leave a comment.