-
Notifications
You must be signed in to change notification settings - Fork 3
Coverage and Testing
Tape is used for testing in this project.
Test cases are loaded through babel require hook, and the require hook is registered with compiled version of the convert function(/lib/convert.js), which is instrumented by istanbul when loading.
The coverage map of compiled version is generated after running test cases, and transformed to coverage of original source(/src/*) by remap. This tool use source maps to find source locations of coverage hits, coverage locations are dropped if source locations can't be found.
Since the convert function becomes self-hosting(testing is self-hosted from the beginning), the instrumentation step can be done while code transformation, instead of instrumenting compiled code via istanbul require hook.
Coverage tool is switched to nyc for that.
The testing still starts with registering babel require hook with compiled version of parse (and convert) function, with additional instrument plugin. The hook is used to (and only for) directly load the source(/src/*.ls) and apply instrumentation, and instrumented source is used to register babel require hook again, to load test cases.
Coverage is more accurate in this way, since the instrumentation is done with source location, no need to transform it back with source maps, information loss is avoided.