Skip to content

Commit b4c6332

Browse files
committed
Allow instrumentation of transformed files with weird file extensions
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>
1 parent 9fbe3c5 commit b4c6332

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- `[jest-snapshot]` Downgrade semver to v6 to support node 8 ([#9451](https://github.com/facebook/jest/pull/9451))
2828
- `[jest-snapshot]` Properly indent new snapshots in the presences of existing ones ([#9523](https://github.com/facebook/jest/pull/9523))
2929
- `[jest-transform]` Correct sourcemap behavior for transformed and instrumented code ([#9460](https://github.com/facebook/jest/pull/9460))
30+
- `[jest-transform]` Allow instrumentation of transformed files with weird file extensions ([#9589](https://github.com/facebook/jest/pull/9589))
3031
- `[pretty-format]` Export `OldPlugin` type ([#9491](https://github.com/facebook/jest/pull/9491))
3132

3233
### Chore & Maintenance

packages/jest-transform/src/ScriptTransformer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export default class ScriptTransformer {
213213
// files outside `cwd` will not be instrumented
214214
cwd: this._config.rootDir,
215215
exclude: [],
216+
extension: false,
216217
// Needed for correct coverage as soon as we start storing a source map of the instrumented code
217218
inputSourceMap: input.map,
218219
useInlineSourceMaps: false,

0 commit comments

Comments
 (0)