Skip to content

Instantly share code, notes, and snippets.

@cayblood
Last active December 29, 2015 08:09
Show Gist options
  • Save cayblood/7641434 to your computer and use it in GitHub Desktop.
Save cayblood/7641434 to your computer and use it in GitHub Desktop.
patch for fixing duplicate parsing of coffeescript files in karma-coverage
--- preprocessor.js 2013-11-25 13:48:03.000000000 +0000
+++ preprocessor.old.js 2013-11-25 13:45:33.000000000 +0000
@@ -14,23 +14,19 @@
}
return function(content, file, done) {
- log.debug('Processing originalPath "%s" path "%s".', file.originalPath, file.path);
- log.debug(content);
- log.debug(done);
+ log.debug('Processing "%s".', file.originalPath);
- var jsPath = file.path.replace(basePath + '/', './');
+ var jsPath = file.originalPath.replace(basePath + '/', './');
var which = jsPath.match(/\.coffee$/) ? ibrikwrapper : instrumenter;
- if (!content.match(/__coverage__/)) {
- which.instrument(content, jsPath, function(err, instrumentedCode) {
- if (err) {
- log.error('%s\n at %s', err.message, file.originalPath);
- }
-
- file.path = file.path.replace(/\.coffee$/, '.js');
- done(instrumentedCode);
- });
- }
+ which.instrument(content, jsPath, function(err, instrumentedCode) {
+ if(err) {
+ log.error('%s\n at %s', err.message, file.originalPath);
+ }
+
+ file.path = file.path.replace(/\.coffee$/, '.js');
+ done(instrumentedCode);
+ });
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment