We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
29.7.0
''when testing an injected service (class) and calling its methods, non of its methods reported by jest coverage as covered
for a NestJs project
@Injectable() export class DriverService { findAll(){ ... } }
test:
beforeEach(async () => { let module: TestingModule = await Test.createTestingModule({ providers: [ DriverService ], }).compile(); service = module.get<DriverService>(DriverService); }); test('defined', ()=>{ expect(service).toBeDefined(); // pass }) test('findAll', ()=>{ mockRepo.findBy.mockResolvedValue(null); mockRepo.save.mockResolvedValue(mockValue ); let _result = await service.findAll(); // <--- findAll() is called here expect(mockRepo.findAll).toHaveBeenCalled; })
running the coverage report I see that findAll (and all other methods) are not covered
The method is covered
The method is not covered
No response
System: OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm) CPU: (8) x64 AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx Binaries: Node: 22.12.0 - /usr/local/bin/node Yarn: 1.22.22 - /usr/local/bin/yarn npm: 10.9.0 - /usr/local/bin/npm pnpm: 9.15.4 - /usr/local/share/npm-global/bin/pnpm npmPackages: jest: 29.7.0 => 29.7.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Version
29.7.0
Steps to reproduce
''when testing an injected service (class) and calling its methods, non of its methods reported by jest coverage as covered
for a NestJs project
test:
running the coverage report I see that findAll (and all other methods) are not covered
Expected behavior
The method is covered
Actual behavior
The method is not covered
Additional context
No response
Environment
System: OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm) CPU: (8) x64 AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx Binaries: Node: 22.12.0 - /usr/local/bin/node Yarn: 1.22.22 - /usr/local/bin/yarn npm: 10.9.0 - /usr/local/bin/npm pnpm: 9.15.4 - /usr/local/share/npm-global/bin/pnpm npmPackages: jest: 29.7.0 => 29.7.0
The text was updated successfully, but these errors were encountered: