Hello,
Has anyone faced a similar issue?
Concurrent vitest
tests via describe.concurrent
are flagged by SonarCloud for missing assertions.
The tests have assertions, though the expect
handler is passed through the local test context, which is required for concurrent tests.
This is explained in Test API Reference | Vitest.
describe.concurrent('createProduct', () => {
it('should return 201 on success', async ({ expect }) => {
await productController.createProduct(payload, okResponseFnMock, validationErrorResponseFnMock, internalErrorResponseFnMock);
const responseData: SuccessResponseInterface = {
message: ResponseResponseMessagesEnum.RESOURCE_CREATED,
details: plainToInstance(MasterProduct, payload)
};
expect(okResponseFnMock).toHaveBeenCalledWith(201, responseData);
});
});
If I run tests without this concurrency, the reports are fine.
Thanks,
Valentin