As the title implies, I want to be able to see the line number when a test fails in my suite. I'm relying on the karma-tap
plugin, the tap
framework, and dots
reporter.
A little context: source-maps are working properly, so exceptions thrown in a test file report the correct line as well as a stack trace. However, when a basic test fails, the "failed" message is outputted without anything about the line or module.
Chrome 50.0.2661 (Mac OS X 10.11.4) should be equal FAILED
{
"operator": "equal",
"expected": 0,
"actual": 1
}
Chrome 50.0.2661 (Mac OS X 10.11.4) should be equal FAILED
{
"operator": "equal",
"expected": 0,
"actual": 1
}
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
...........................
My initial thought was that this is just a limitation of Tap, but I can't imagine that's true. My full Karma config is shown below. Is there something in the configuration that would cause the output of line numbers during a test to fail?
{
plugins: [
require('karma-webpack'),
require('karma-tap'),
require('karma-chrome-launcher'),
require('karma-sourcemap-loader')
],
basePath: '',
frameworks: [ 'tap' ],
files: [
'tests.bootstrap.js',
],
preprocessors: {
'src/**/*.js': ['webpack', 'sourcemap'],
'tests.bootstrap.js': [ 'webpack', 'sourcemap' ]
},
webpack: {
devtool: 'inline-source-map',
externals: {
cheerio: 'window',
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'text-encoding': 'window',
'react/addons': true,
},
module: {
preLoaders: [
{
test: /\.js/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.js$/,
include: [
path.resolve(__dirname, 'src/components/'),
//path.resolve(__dirname, 'src/containers/'),
path.resolve(__dirname, 'src/layouts/'),
path.resolve(__dirname, 'src/reducers/'),
path.resolve(__dirname, 'src/stores/'),
path.resolve(__dirname, 'src/util/')
],
exclude: /-container\.js/,
loader: 'isparta'
}
],
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "source-map-loader"
}, {
test: /\.(png|jpg|jpeg|gif|woff|woff2)$/,
loader: 'url?limit=25000',
include: path.resolve(__dirname, 'src')
}, {
test: /\.svg$/,
loader: 'file-loader'
}
]
},
node : {
fs: 'empty'
},
resolve: {
modulesDirectories: ['src', 'node_modules']
}
},
webpackMiddleware: {
noInfo: true
},
reporters: [ 'dots' ],
client: {
captureConsole: false
},
port: 9878,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
}