-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Bug 913 #914
Bug 913 #914
Conversation
@coreyfarrell @AGrzes this seems reasonable to me. tldr; you're proposing that files that fail the One question for you, I believe sometimes typescript files are laid out in a different directory, and than compiled in another folder, e.g., |
My reasoning (regarding old code) id the following this.walkAllFiles(this.cwd, function (filename) {
filename = path.resolve(_this.cwd, filename)
_this.addFile(filename)
var coverage = coverageFinder()
var lastCoverage = _this.instrumenter().lastFileCoverage()
if (lastCoverage) {
filename = lastCoverage.path
}
if (lastCoverage && _this.exclude.shouldInstrument(filename)) {
coverage[filename] = lastCoverage
}
}) NYC.prototype.addFile = function (filename) {
var relFile = path.relative(this.cwd, filename)
var source = this._readTranspiledSource(path.resolve(this.cwd, filename))
var instrumentedSource = this._maybeInstrumentSource(source, filename, relFile)
return {
instrument: !!instrumentedSource,
relFile: relFile,
content: instrumentedSource || source
}
} NYC.prototype._maybeInstrumentSource = function (code, filename, relFile) {
var instrument = this.exclude.shouldInstrument(filename, relFile)
if (!instrument) {
return null
}
var ext, transform
for (ext in this.transforms) {
if (filename.toLowerCase().substr(-ext.length) === ext) {
transform = this.transforms[ext]
break
}
}
return transform ? transform(code, {filename: filename, relFile: relFile}) : null
}
Regarding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is there anything else to do / explain before this request can be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @AGrzes this is great! going to merge now.
@@ -440,6 +440,26 @@ describe('nyc', function () { | |||
return done() | |||
}) | |||
|
|||
it('Do not transpiles files when not included', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should read:
"does not transpile files when not included"
Proposed fix for #913.
I created simple falling test and did small change to eliminate the issue.
Please let me know if any improvement is needed.