S2699 expects "Add at least one assertion to this test case."

  • which versions are you using SonarQube Server : 10.4

  • how is SonarQube deployed: hosted on azure VM

  • what are you trying to achieve: remove false positives

  • what have you tried so far to achieve this - we use the Sinon package for various tests, and Sonaqube does not recognise the assertions that come with Sinon as valid assertions.
    Unfortunately, the rule may not detect sinon.assert.* methods as real assertions because it’s only looking for things like expect() , assert.* , We’re asking for alternatives solutions to
    adding an exception for Sinon assertion methods in our Typescript profile.

  • Example of code:

it('should redirect to the organisation details page with url param eu if ' +
  'selected and there are no validation errors', () => {
  request.payload = {
    location: 'eu'
  }

  route.handler(request, h)

  sinon.assert.calledOnce(h.redirect)
  sinon.assert.calledWith(h.redirect, '/protected/bcp-admin/new/eu/organisation-details')
})

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

This looks like a case of JS-627. I’ll makes sure to link this thread to that ticket.

:warning: Your version is past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

10.4 → 2025.1.1-> 2025.2 (last step optional)

You may find these resources helpful: