karma-teamcity-reporter
karma-teamcity-reporter copied to clipboard
Stacktrace does not respect sourcemap
I have karma configured with webpack, sourcemap, coverage, and teamcity reporter. The teamcity reported does not report stack traces using sourcemap.
When run with the dots
reporter (karma start --reporters dots,coverage
),
# %> karma start --reporters dots,coverage
PhantomJS 2.1.1 (Mac OS X 0.0.0) HelloWorld should have a specified name FAILED
expected 'Hello robbie!' to equal 'Hello robbieee!'
AssertionError@/Users/pkmiec/src/mycase_login/test/tests.webpack.js:9:845890 <- webpack:///~/assertion-error/index.js:73:0
assert@/Users/pkmiec/src/mycase_login/test/tests.webpack.js:9:1024987 <- webpack:///~/chai/lib/chai/assertion.js:111:7
assertEqual@/Users/pkmiec/src/mycase_login/test/tests.webpack.js:9:1034894 <- null:0:0
/Users/pkmiec/src/mycase_login/test/tests.webpack.js:9:1013343 <- webpack:///~/chai/lib/chai/utils/addMethod.js:41:0
/Users/pkmiec/src/mycase_login/test/tests.webpack.js:9:7199 <- webpack:///~/react/lib/React.js:41:0
However, when I run with the teamcity reporter (karma start --reporters teamcity,coverage
),
##teamcity[testFailed name='should have a specified name' message='FAILED' details='expected |'Hello robbie!|' to equal |'Hello robbieee!|'|nAssertionError@base/test/tests.webpack.js?fca989f0cecb15b72a5eb4f51114c2b65dc10553:9:845890|nassert@base/test/tests.webpack.js?fca989f0cecb15b72a5eb4f51114c2b65dc10553:9:1024987|nassertEqual@base/test/tests.webpack.js?fca989f0cecb15b72a5eb4f51114c2b65dc10553:9:1034894|nbase/test/tests.webpack.js?fca989f0cecb15b72a5eb4f51114c2b65dc10553:9:1013343|nbase/test/tests.webpack.js?fca989f0cecb15b72a5eb4f51114c2b65dc10553:9:7199']
Am I missing something?
My karma.config.js,
var webpackConfig = require('./config/webpack.config.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: ['mocha'],
// list of files / patterns to load in the browser
files: [
'test/tests.webpack.js'
],
// 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/tests.webpack.js': [ 'webpack', 'sourcemap', 'sourcemap-writer', 'coverage' ] //preprocess with webpack and our sourcemap loader
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots', 'coverage'],
// 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_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
webpack: { //kind of a copy of your webpack config
devtool: 'inline-source-map',
module: webpackConfig.module,
resolve: webpackConfig.resolve,
},
webpackMiddleware: {
noInfo: true //please don't spam the console when running in karma!
},
coverageReporter: {
type: 'json',
subdir: '.',
file: 'coverage-final.json'
},
plugins: [
require('karma-webpack'),
require('karma-mocha'),
require('karma-firefox-launcher'),
require('karma-phantomjs-launcher'),
require('karma-sourcemap-loader'),
require('karma-sourcemap-writer'),
require('karma-teamcity-reporter'),
require('karma-coverage'),
],
phantomjsLauncher: {
// Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
exitOnResourceError: true
}
})
}
did you find any solution to this ?