Skip to content

Commit 39bfc89

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 <[email protected]>
1 parent 1ed46e7 commit 39bfc89

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGELOG.md

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

3132
### 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: [''],
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)