Closed JaKXz closed 8 years ago
Excludes don't use globs, just prefix matching. You're certainly not the first to ask for this, though. I can probably hack up a fix, but not 'till later in the week. If you're really interested, I'd welcome a PR, although ideally one that's backwards compatible.
If you've just got one file you want to exclude, then exclude: ['-cli.coffee']
ought to do it (assuming this file is in "#{__dirname}/src/".) You can read the exclude code here.
@jwalton thanks for the response. I am doing exclude: ['-cli.coffee']
with no luck unfortunately. There's also a conf.coffee
file in #{__dirname}/
that's being instrumented as well (which shouldn't be).
I read through the exclude code last night and wasn't really sure how it actually determines the file path from the register
method. It looks at options.exclude
, the array, but then never really does anything with it... I just assumed I'm misreading something.
The magic happens here, where we call into excludeFile()
, and then if it returns true, compile the file without any instrumentation. (There's also a little bit of magic over here for when we walk through all the files in the world to generate initialization, if the initAll
option is true.) Some well place console.log
s in excludeFile()
would probably go a long way towards figuring out what's going on.
Interesting - so they are being excluded when I use initAll: false
, but the coverage summary is not being updated with the istanbul report text-summary lcov
command. That's kinda strange.
Excludes now us globs! I'll close this, but feel free to raise another issue if you're still having problems.
My
coffee-coverage-loader.coffee
looks like this:and I've tried all manner of globs for the exclude paths. For this library I've just got one file I want to instrument, and a
-cli.coffee
that I would like to ignore. Mymocha.opts
looks like this:The problem could be because of istanbul ignoring the
basePath
, but I'm not sure.I'm using the given
npm test
command from the Travis CI tutorial.I also tried using an
.istanbul.yml
file with no luck, mostly because I wasn't sure which options applied to instrumenting coffeescript...