sonarjs/no-incomplete-assertions
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-incomplete-assertions": "error",
},
},
];const assert = require('chai').assert;
const expect = require('chai').expect;
describe("incomplete assertions", function() {
const value = 42;
it("uses chai 'assert'", function() {
assert.fail; // Noncompliant
});
it("uses chai 'expect'", function() {
expect(1 == 1); // Noncompliant
expect(value.toString).to.throw; // Noncompliant
});
});const assert = require('chai').assert;
const expect = require('chai').expect;
describe("incomplete assertions", function() {
const value = 42;
it("uses chai 'assert'", function() {
assert.fail();
});
it("uses chai 'expect'", function() {
expect(1).to.equal(1);
expect(value.toString).throw(TypeError);
});
});Examples from the ESLint documentation.
sonarjs/no-incomplete-assertions
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-incomplete-assertions": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Assertions comparing incompatible types should not be made
Inline snapshots should not contain interpolations
Regular expressions should be syntactically valid