Skip to content

Add default support for .cts and .mts file extensions#22

Open
domarmstrong wants to merge 1 commit intoistanbuljs:masterfrom
domarmstrong:patch-1
Open

Add default support for .cts and .mts file extensions#22
domarmstrong wants to merge 1 commit intoistanbuljs:masterfrom
domarmstrong:patch-1

Conversation

@domarmstrong
Copy link
Copy Markdown

I ran in to the fact that jest isn't collecting coverage from .mts files when using babel-jest. It appears this already works in Istanbul but the files are currently excluded. Is there any reason to not include them in the default list of file extensions?

domarmstrong added a commit to domarmstrong/jest that referenced this pull request Mar 10, 2026
Istanbul only collects coverage from files listed in 'extension'. It has a [default list](https://github.com/istanbuljs/schema/blob/master/default-extension.js) of
`.js, .cjs, .mjs, .ts, .tsx, .jsx`. Any other files are ignored. As babel-jest doesn't provide the extension, or a way to provide it yourself, there is currently
no way to collect coverage from .mts, .cts files. I've [proposed adding them to the default Istanbul list](istanbuljs/schema#22). But in the
same fashion that Jest removes all exclusions, it could also provide the extension of the file being transformed to allow Istanbul to collect it's coverage.

I can't think of a situation where you would want a file transformed by babel, but not to be instrumented that wouldn't already be handled by jests coverage include/exclude config.
domarmstrong added a commit to domarmstrong/jest that referenced this pull request Mar 10, 2026
Istanbul only collects coverage from files listed in 'extension'. It has a [default list](https://github.com/istanbuljs/schema/blob/master/default-extension.js) of
`.js, .cjs, .mjs, .ts, .tsx, .jsx`. Any other files are ignored. As babel-jest doesn't provide the extension, or a way to provide it yourself, there is currently
no way to collect coverage from .mts, .cts files. I've [proposed adding them to the default Istanbul list](istanbuljs/schema#22). But in the
same fashion that Jest removes all exclusions, it could also provide the extension of the file being transformed to allow Istanbul to collect it's coverage.

I can't think of a situation where you would want a file transformed by babel, but not to be instrumented that wouldn't already be handled by jests coverage include/exclude config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant