Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoverageError when trying coffee-coverage-loader.js #76

Open
dynnamitt opened this issue Feb 2, 2016 · 5 comments
Open

CoverageError when trying coffee-coverage-loader.js #76

dynnamitt opened this issue Feb 2, 2016 · 5 comments
Assignees

Comments

@dynnamitt
Copy link

node v4.2.6

when

./node_modules/.bin/mocha -R spec --compilers coffee:coffee-script/register --require ./coffee-coverage-loader

I get

(node) child_process: options.customFds option is deprecated. Use options.stdio instead.

/home/kfm/code/ds3g/readin/node_modules/coffee-coverage/lib/coffeeCoverage.js:279
throw new CoverageError("Could not parse " + fileName + ": " + err.stack);
^
CoverageError: Could not parse /home/kfm/code/ds3g/readin/node_modules/halbert/node_modules/browserify/node_modules/browser-resolve/test/fixtures-coffee/foo.coffee: SyntaxError: unexpected //
at Object.exports._runInstrumentor (/home/kfm/code/ds3g/readin/node_modules/coffee-coverage/lib/coffeeCoverage.js:279:13)
at CoverageInstrumentor.exports.CoverageInstrumentor.CoverageInstrumentor.instrumentCoffee (/home/kfm/code/ds3g/readin/node_modules/coffee-coverage/lib/coffeeCoverage.js:237:24)
at CoverageInstrumentor.exports.CoverageInstrumentor.CoverageInstrumentor.instrumentFile (/home/kfm/code/ds3g/readin/node_modules/coffee-coverage/lib/coffeeCoverage.js:219:21)
at CoverageInstrumentor.exports.CoverageInstrumentor.CoverageInstrumentor.instrumentDirectory (/home/kfm/code/ds3g/readin/node_modules/coffee-coverage/lib/coffeeCoverage.js:196:27)
at CoverageInstrumentor.exports.CoverageInstrumentor.CoverageInstrumentor.instrumentDirectory (/home/kfm/code/ds3g/readin/node_modules/coffee-coverage/lib/coffeeCoverage.js:182:23)

@dynnamitt
Copy link
Author

coffee-coverage-loader.js is copy-paste from sample...

@dynnamitt
Copy link
Author

FIX;

changed exclude into

  exclude: ['**/test', '**/node_modules', '**/.git'],

@jwalton
Copy link
Contributor

jwalton commented Feb 2, 2016

Hmm... Sounds like we broke something when we added glob support in 1.0.0.

@jwalton jwalton self-assigned this Feb 2, 2016
@jwalton
Copy link
Contributor

jwalton commented Feb 2, 2016

Ok, this is weird though, because I just tried upgrading to latest coffee-coverage in amqp-connnection-manager, and it runs fine, even though it's using the defaults. Even if I npm install halbert, so I have this exact same file locally...

Do you have an example project that reproduces this? Also, when you're running mocha, you're running it a ./node_modules/.bin/mocha? Not trying to run it from another folder?

Thanks!

@dynnamitt
Copy link
Author

yes,
My halberd ver tag is ^0.1.0 if it helps.

Im fine as long as I use this file
(changed projectRoot and paths in .exclude I did)

var COV_DIR = 'coverage';
var COV_DEST = 'coverage-coffee.json';

var path = require('path');
var coffeeCoverage = require('coffee-coverage');
var projectRoot = __dirname;
var coverageVar = coffeeCoverage.findIstanbulVariable();
// Only write a coverage report if we're not running inside of Istanbul.

/* jshint ignore:start /
var writeOnExit = (coverageVar == null) ? (projectRoot + '/' + COV_DIR + '/' + COV_DEST) : null;
/
jshint ignore:end */

coffeeCoverage.register({
instrumentor: 'istanbul',
basePath: projectRoot,
exclude: ['test', 'node_modules', '.git', 'features', '_*' ,'coverage'],
coverageVar: coverageVar,
writeOnExit: writeOnExit,
initAll: true
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants