-
-
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
Rewrite custom require hook & source map tests #73
Conversation
\o/ this is looking great, and is very much appreciated. let me know when you need a thorough review. |
Use a spy to verify custom require hooks are wrapped correctly. Remove the more complicated test using babel-register and clean up dependencies. Stop sharing an nyc instance between the wrap tests.
Use source-map-fixtures to get a fixture file with an inline source map. Add a script to generate a coverage report for this specific fixture. Rewrite tests to use the fixture, without (too much) hardcoding of values. This will make it easier to upgrade the fixture in the future, as well as regenerate the coverage report.
d3e008f
to
f410b7c
Compare
@bcoe I'm finished with this now, thanks. |
// Write the coverage file so reports can be loaded. | ||
nyc.writeCoverageFile() | ||
|
||
var reports = _.values(nyc._loadReports()[0]) |
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 is a great approach for generating the fixtures, and I love the module source-map-fixtures
.
The tests run way faster without the babel step, this is great. |
Rewrite custom require hook & source map tests
This is a rewrite of the source map tests so I can add the test coverage required in #66. This necessitated replacing the Babel test with a better one for generic custom require hooks.
This uses a new npm package named source-map-fixtures. It provides a few source files with different source map variants, making it easier to generate fixtures. I'm planning on updating the source map tests in AVA as well.
I've solved the problem of generating coverage reports for testing by adding a
_generateCoverage
script intest/fixtures
. It generates a report for the source map fixtures.And finally I've excluded the two tests from the coverage report. Seemed silly to get missing test coverage for the tests…