grunt-template-jasmine-istanbul
grunt-template-jasmine-istanbul copied to clipboard
exports.process function works incorrectly if instrumentedSource contains "parent directory" pattern
Hi,
We are using grunt-template-jasmine-istanbul in dash.js project and we recently faced the following issue:
In scr/main/js/template.js
there is exports.process
function. It has a check at line #193:
if (!grunt.file.isMatch(files, instrumentedSource)) {
return;
}
Where var files = context.options.files || '**/*';
If files = '**/*'
and instrumentedSource
contains a "parent directory" pattern, e.g. '../someFile.js' the result of the grunt.file.isMatch
function is always false. Thus, the function always returns right after the check and never goes farther.
We were able to fix it locally this way:
• Replace the pattern with '*.*'
• Add {matchBase: true}
option as a first parameter of isMatch function
We found out that the issue was introduced by this commit: https://github.com/maenu/grunt-template-jasmine-istanbul/commit/d2212fbd5439052a55af8f9c1bea971b9f7a9cc9
The intention of '**/*'
was that it matches any path, so this is definitely a bug. I am a bit surprised that this doesn't work with parent directories. We need to find out which pattern needs to be used and some tests.