Sonar Not Detecting Sequential Tests in Vitest
- ALM used: Azure DevOps
- CI system used: Azure DevOps
- Languages of the repository: TypeScript
- Tools used: Vitest
- Errors:
"Add some tests to this file or delete it"
in ‘New Issues’ section in SonarCloud Summary
Description
When I set up my tests to be sequential in Vitest and nested in ‘describe’ methods, Sonar does not register it to be a valid test.
Sonar does not register tests: Sequential Tests
describe('Here are my tests', () => {
describe('myFunc', () => {
test.sequential('I am testing for a success response', async () => {
// test body
})
})
})
However, if I remove the ‘sequential’ property and therefore make my tests run in parallel, Sonar will register the tests as valid.
Sonar registers tests: Parallel Tests
describe('Here are my tests', () => {
describe('myFunc', () => {
test('I am testing for a success response', async () => {
// test body
})
})
})
Is this a bug in Sonar? Both scenarios run successfully on my end, but when Sonar analyzes these different test set ups, it does not register the first scenario with sequential tests as a valid test.
Thank you,
Kenney