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 <[email protected]>
  • Loading branch information
andersk committed Feb 18, 2020
1 parent 1ed46e7 commit 39bfc89
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 @@ -26,6 +26,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: [''],
// 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 39bfc89

Please sign in to comment.