Getting false positives for "Add at least one assertion to this test case." with open-wc

We have a javascript project using open-wc for unit testing (specifically @open-wc/testing) and sonarcloud is reporting the “Add at least one asserting to this test case” many times despite all tests having an expect.

Example:

    it('renders with default values', async () => {
Add at least one assertion to this test case.
        const el = await fixture(html`<input-textarea></input-textarea>`);
        expect(el.name).to.equal('input');
        expect(el.placeholder).to.equal('');
        expect(el.label).to.equal('');
        expect(el.helper).to.equal('');
        expect(el.max).to.equal(undefined);
        expect(el.keyboard).to.be.true;
        expect(el.keyboardActive).to.be.false;
    });

As you can see there are many assertions. I did read in other threads using the sinon package has caused similar issues in the past. Whats the best way to go about this?

Hey there.

Thanks for the report. I believe this is a false-positive we’re already aware of: Fix FP S2699 (`Tests should include assertions`): global `expect()` aren't detected · Issue #4459 · SonarSource/SonarJS · GitHub

You can mark these issues as false-positives for now, or disable the rule in your Quality Profile if it’s entirely useless as a result of the bug.

Understood, thank you!