Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/store/fslookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Store.mix(LookupStore, {
return [];
},
get: function (key) {
return fs.readFileSync(key, 'utf8');
return sourceLookup(key)
// return fs.readFileSync(key, 'utf8');
},
hasKey: function (key) {
var stats;
Expand All @@ -59,3 +60,22 @@ Store.mix(LookupStore, {

module.exports = LookupStore;

/* ====================================== */

/**
* fslookup patch
*
* @see https://github.com/vuejs/vue-loader/pull/1372
*/
function sourceLookup (path) {
if (fs.existsSync(path)) {
return fs.readFileSync(path, 'utf8');
}
if (/\.vue\.js$/.test(path)) {
const originalPath = path.substring(0, path.length - 3);
if (fs.existsSync(originalPath)) {
return fs.readFileSync(originalPath, 'utf8');
}
}
throw new Error('Unable to lookup source: ' + path);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-istanbul",
"version": "1.0.5",
"version": "1.0.6",
"description": "Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale",
"keywords": [
"coverage",
Expand Down