What language is this for?:
TypeScript
Which rule?:
S2699
Why do you believe it’s a false-positive/false-negative?:
False-negative. The S2699 rule does not appear to recognize Jasmine’s expectAsync assertions as assertions. As a result, valid Jasmine tests using expectAsync may be incorrectly reported as having no assertions.
Are you using:
-
SonarQube Cloud?: Yes
-
SonarQube Server / Community Build - which version?: N/A
-
SonarQube for IDE - which IDE/version?: N/A
- in connected mode with SonarQube Server / Community Build or SonarQube Cloud?: N/A
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots):
describe('example', () => {
it('should handle a rejected promise', async () => {
await expectAsync(Promise.reject(new Error('test error')))
.toBeRejectedWithError('test error');
});
});
The above test contains a Jasmine expectAsync assertion, but S2699 reports that the test contains no assertions. expectAsync should be recognized as an assertion in the same way that Jasmine’s synchronous expect is recognized.