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

chore: code tidy up and new test #1036

Merged
merged 3 commits into from
Mar 28, 2019
Merged

Conversation

AndrewFinlay
Copy link
Contributor

Cleanup instrumentation code again with a focus on absolute and relative paths

The main aim of this has been to clarify whether we're working with relative or absolute file paths, and removing unnecessary transformations. Although I've made a few other 'small' changes here and there.

Key changes:

  • Created a new private method NYC._transform, common to _maybeInstrumentSource and instrumentAllFiles.
  • Renamed the param in walkAllFiles forEach handler to relFile to explicitly state the file representation being used.
  • Let the addAllFiles visitor function rely on testExclude to determine which files to instrument
  • Test that the instrument command returns unmodified source if there is no transform found for a file extension.

Andrew Finlay added 2 commits March 20, 2019 10:02
…s no transform found for a file extension.

Currently this behaviour can only be reached when trying to instrument a single file.
In the case of instrumenting a directory, files with an extension with no matching transform are filtered out before they can be instrumented.
The main aim of this has been to clarify whether we're working with relative or absolute file paths, and removing unnecessary transformations.  Although I've made a few other 'small' changes here and there.

Key changes:
	* Created a new private method `NYC._transform`, common to `_maybeInstrumentSource` and `instrumentAllFiles`.
	* Renamed the param in `walkAllFiles` forEach handler to `relFile` to explicitly state the file representation being used.
	* Let the `addAllFiles` visitor function rely on `testExclude` to determine which files to instrument
@coveralls
Copy link

coveralls commented Mar 20, 2019

Coverage Status

Coverage decreased (-0.07%) to 96.349% when pulling 82bb259 on AndrewFinlay:cwd-cleanup into 1f6c3d4 on istanbuljs:master.

@AndrewFinlay AndrewFinlay changed the title chore: Code tidy up and new test chore: code tidy up and new test Mar 20, 2019
Copy link
Member

@coreyfarrell coreyfarrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just a couple minor requests.

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@JaKXz JaKXz merged commit 5c1eb38 into istanbuljs:master Mar 28, 2019
@AndrewFinlay AndrewFinlay deleted the cwd-cleanup branch April 2, 2019 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants