-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include/exclude files from coverage #197
Comments
This plugin attempts to mimic istanbul's api surface as much (https://github.com/istanbuljs/istanbuljs), not the high level api wraps those such as nyc does. If istanbuljs have such interfaces, it can be added. Otherwise, it should be configured by caller instead. |
Gotcha thanks. I think that the includes / excludes files feature is a part of nyc & babel-plugin-istanbul. Unfortunately, this is going to prevent us from switching from babel to SWC with Next.js until we can target coverage instrumentation for only certain files. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Please do not leave redundant comment. |
This comment was marked as off-topic.
This comment was marked as off-topic.
In .nycrc-config, have you tried using the exclude option with |
Using excludeAfterRemap fixed issue with node_modules showing. So it's viable for me. |
This prevents me from using Middleware in a Next.js project, because this plugin instruments all files, including But the instrumented Here is a codesandbox with the reproduced error: With |
This comment was marked as off-topic.
This comment was marked as off-topic.
Hello!
If babel-plugin-istanbul have such interface, can it be added to swc-plugin? https://github.com/istanbuljs/babel-plugin-istanbul?tab=readme-ov-file#ignoring-files |
I'm still not fully convinced if plugin should support this or not, however to see if this things works or not added unstable options to the plugin. swc-plugin-coverage-instrument/spec/plugin.spec.ts Lines 19 to 21 in 4689fc9
|
Hello @kwonoj, thanks for this update. What should the file look like when it is in the exclude pattern? I added a middleware file from Next.js to the unstableExclude pattern. But the file looks the same whether I add it to the pattern. I removed the plugin and compared the compiled version of the middleware with the one with an activated plugin; it looks different. At first, I thought the pattern was not working. However, after debugging the plugin and compiling a version I tested locally, I can confirm that the pattern matches. I expect the excluded file matched by the pattern to look like the file when the plugin is inactive. Is that correct? If so, I will debug more and find a solution. |
You may refer the test case to see how things work. If the patter matches it should not trigger transform. |
@kwonoj I saw the test case but I wanted to double check my hypothesis. I take you comment as a confirmation that the code of the excluded file should look like the file without the plugin. Since it's not the case it must be a bug in Next.js SWC implementation or the library. Let's see. |
Next-swc's plugin runs same as @swc/core. I do not think there is next.js specific swc bugs. |
Hi,
Thanks for providing this plugin, I was wondering if it was possible to include or exclude files for coverage similar to how nyc has the option to here? https://github.com/istanbuljs/nyc#using-include-and-exclude-arrays
I'm trying to get this working with Cypress and Next.js. Currently I have this plugin included but the coverage report includes more files than we would like to report on
in next.config.js
The text was updated successfully, but these errors were encountered: