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?