False positive: S2699 - Add at least one assertion to this test case

  • What language is this for?
    JavaScript

  • Which rule?
    S2699

  • Why do you believe it’s a false-positive/false-negative?
    Similar issue, but for different imports: False positive - S2699 - Add at least one assertion to this test case - #7 by ilia

  • SonarQube - which version?
    Community Edition v10.5.1 (90531)

  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)

It happens when using assert library (from node, node:assert) and sinon.

import assert from "assert";
import sinon from "sinon";

The test has the following structure:


describe ("", () => {
	beforeEach(() => {
		
	});
	afterEach(() => {
		
	});
	describe("", () => {
		it("should exist", () => {
			assert.ok(functionName);
		});
	});
});

Hello Giancarlo,

Thank you for bringing up this issue. We have opened a ticket for it which you can follow here: [JS-187] - Jira

@gian1200 ,

I opened another ticket because the one mentioned earlier is about a different issue. You can track its progress there: [JS-342] - Jira

Kind regards,

Eric.

1 Like