-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Code coverage: cannot cover type of express request #5161
Comments
When Typescript transpiles the decorators it adds generated code that is included in source maps. There's a Ideally Typescript should not include this in source maps. Then code coverage tools would not consider it as your source code, and they would exclude it from the report automatically.
vitest/packages/coverage-v8/src/provider.ts Lines 363 to 385 in 4e17942
|
Are there any plans to implement this hack or a permanent solution to this problem? For now, I am ignoring decorators via Thanks! |
It actually looks like the Could you try if disabling SWC helps? |
Yes, disabling SWC fixes the problem from my minimal reproduction repo. But on a larger nestjs repository, removing One example of such error is:
On Also, it was stated here: |
Ok, disabling SWC is not an option as decorator metadata support of esbuild doesn't seem to work with NestJs. I did some testing here AriPerkkio@42e1e1b and it seems to work on the minimal reproduction. I'll need to look into |
@AriPerkkio Awesome! |
Describe the bug
I have a simple
nestjs
controller that I am testing that acceptsexpress
-request
as its param.I achieved almost 100% code coverage except:
I cannot cover the type of
Request
from code coverage. I am usingvitest-mock-express
to mock the request object passed to the controller. I also triednode-mocks-http
and had the same result.vitest-mock-express
:node-mocks-http
:The following test cases should cover all of the code:
Coverage result:
I have a repo for reproduction at: https://github.com/wataruian/vitest-nestjs-repro
Reproduction
https://github.com/wataruian/vitest-nestjs-repro
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: