Skip to content

Commit

Permalink
Allow instrumentation of transformed files with weird file extensions
Browse files Browse the repository at this point in the history
The default configuration of babel-plugin-istanbul only allows
instrumentation of files with extensions .js, .cjs, .mjs, .ts, .tsx,
.jsx (https://github.com/istanbuljs/schema/blob/v0.1.2/index.js#L71).
However, we know that we’re running it on code that we just
transformed to JavaScript, so the source language no longer matters,
and we should disable this check to get complete instrumentation.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed Feb 19, 2020
1 parent 9fbe3c5 commit b4c6332
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- `[jest-snapshot]` Downgrade semver to v6 to support node 8 ([#9451](https://github.com/facebook/jest/pull/9451))
- `[jest-snapshot]` Properly indent new snapshots in the presences of existing ones ([#9523](https://github.com/facebook/jest/pull/9523))
- `[jest-transform]` Correct sourcemap behavior for transformed and instrumented code ([#9460](https://github.com/facebook/jest/pull/9460))
- `[jest-transform]` Allow instrumentation of transformed files with weird file extensions ([#9589](https://github.com/facebook/jest/pull/9589))
- `[pretty-format]` Export `OldPlugin` type ([#9491](https://github.com/facebook/jest/pull/9491))

### Chore & Maintenance
Expand Down
1 change: 1 addition & 0 deletions packages/jest-transform/src/ScriptTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export default class ScriptTransformer {
// files outside `cwd` will not be instrumented
cwd: this._config.rootDir,
exclude: [],
extension: false,
// Needed for correct coverage as soon as we start storing a source map of the instrumented code
inputSourceMap: input.map,
useInlineSourceMaps: false,
Expand Down

0 comments on commit b4c6332

Please sign in to comment.