jest
jest copied to clipboard
[Bug]: Jest coverage is reporting a line as untested
Version
28.1.3
Steps to reproduce
Steps:
- Clone https://github.com/Shereef/graphql-jest-coverage-attribute
- run
npm run test:cov
Expected behavior
Should get 100%
coverage
Actual behavior
It's reporting 85.71%
because of an attribute @Query(() => String)
Additional context
If you look at this file and delete the attribute parameter to @Query()
you will get 100% coverage but the project will not work.
import { Resolver, Query } from '@nestjs/graphql';
@Resolver()
export class AppResolver {
@Query(() => String)
getHello(): string {
return 'Hello World!';
}
}
Environment
System:
OS: macOS 13.0.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.14.2 - /usr/local/bin/node
npm: 8.19.2 - ~/node_modules/.bin/npm
npmPackages:
jest: 28.1.3 => 28.1.3
I didn't know which package introduced this so I also filed this https://github.com/istanbuljs/istanbuljs/issues/707
Did you find a solution?
Did you find a solution?
No sir, just put /* istanbul ignore next */
before the arrow function
P.S. I hand typed this comment from my phone Please spell check the code
Hey, thanks for answering, but my issue was regarding an nx/Angular project, so a case different from yours.
I found the solution here
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Any update on this ?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.