S2699: include Jasmine expectAsync in assertion detection

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.

Code: S2699: include Jasmine expectAsync in assertion detection by otjrocks · Pull Request #7879 · SonarSource/SonarJS · GitHub

Hey @otjrocks, welcome to the Community! I can see that @victor.diez was more responsive than me and already merged your PR (or rather, a copy of it, to enable CI on it). Thanks a lot, not only for reporting the issue, but also for contributing a fix! And thanks to Victor too.