-
Notifications
You must be signed in to change notification settings - Fork 63
Error: Unable to lookup source. #80
Comments
I get the same problem. Some relevant version numbers: istanbul-instrumenter-loader v3.0.0 webpack config: Folder structure:
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var PROD = process.env.NODE_ENV === "production";
var DEV = process.env.NODE_ENV === "development";
var TEST = process.env.NODE_ENV === "test";
var entries = [path.join(__dirname, 'src/index.js')];
if (DEV === true) {
entries.unshift('webpack-hot-middleware/client?reload=true');
}
module.exports = {
entry: entries,
node: {
fs: 'empty'
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.js',
publicPath: '/dist/'
},
module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
}
},{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'body',
filename: 'index.html'
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery'
})
]
};
if (DEV === true) {
module.exports.devtool = 'eval-source-map'
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.HotModuleReplacementPlugin()
]);
}
if (PROD === true) {
module.exports.devtool = 'source-map';
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
]);
}; Karma config: var webpackConfig = require('./webpack.config.js');
delete webpackConfig.entry;
webpackConfig.devtool = 'eval-source-map';
webpackConfig.module.rules[0]['options']['postLoaders'] = {
js: 'istanbul-instrumenter-loader?esModules=true'
};
webpackConfig.module.rules.push({
enforce: 'post',
test: /\.js$/,
exclude: /(node_modules|\.test\.js|test\-loader\.js$)/,
loader: 'istanbul-instrumenter-loader',
query: {
debug: true,
preserveComments: true,
esModules: true
}
});
console.log('webpack conf:', webpackConfig.module.rules);
module.exports = function(config) {
'use strict';
config.set({
browsers: ['PhantomJS'],
frameworks: ['mocha', 'chai'],
files: ['test-loader.js'],
client: {
mocha: {
ui: 'bdd'
}
},
reporters: ['coverage-istanbul'],
preprocessors: {
'test-loader.js': ['webpack']
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
},
coverage: {
reporters: ['text-summary', 'html'],
dir: './reports/coverage'
},
coverageIstanbulReporter: {
dir: './reports/coverage-istanbul',
reports: ['lcov','html'],
fixWebpackSourcePaths: false,
'report-config': {
html: {
subdir: 'html'
}
}
},
port: 9876,
colors: true,
autoWatch: true,
singleRun: true,
logLevel: config.LOG_INFO
});
} test-loader.js const tests = require.context('./tests/', true, /test\.js$/);
tests.keys().forEach(tests);
const components = require.context('./components', true, /\.vue$/);
components.keys().forEach(components);
const scripts = require.context('./src/', true, /\.js$/);
scripts.keys().forEach(scripts); I have one file in /components folder: Error in App.vue coverage report (html) is: Unable to lookup source: As you can see, |
I realise that I have |
For what it's worth, I am getting the same error message trying to get coverage reports on my stack using mocha, webpack, typescript and babel. I will continue digging, but if anyone in the meantime has some ideas, they would be much appreciated. |
Any update for this issue? |
I am also having this issue with webpack 4 and mocha-webpack |
Using '#eval' as devtool for source-map generation solved this issue for me |
'#eval' did not work for me. When I run 1 simple test on a test-project using typescript and webpack 4, I get a lcov.info like this:
The first file has a correct path, but no coverage. |
Any update? I am having the same issue. |
I'm also having this same issue: const webpackOptions = {
resolve: {
extensions: ['.ts', '.js'],
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: 'awesome-typescript-loader',
},
],
},
],
},
};
const options = {
webpackOptions,
};
module.exports = wp(options); Any possible solution? |
thanks, i delete the devtool property,and that is ok! |
Using 3.0.0
the "src/components" showed twice.
The text was updated successfully, but these errors were encountered: