A test runs no code at all, so it passes without checking anything
What it finds
A test without an assertion only checks that the code under test does not throw. That is sometimes the intent, but more often the assertion was forgotten or lives in a callback that never runs.
Reported are tests whose body calls and constructs nothing, awaits nothing and throws nothing, unless the callback takes parameters, which may be a test context or done.
From the rule's source, test_checks_nothing.rs.
it("loads the config", () => {tx0 reports: this test calls nothing, so it checks nothing const config = { port: 80 };});it("parses", () => { expect(parse("1")).toBe(1);});declare function parse(s: string): number; Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:test-checks-nothing" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:test-checks-nothing] reason="..."tx0 explain tx0/ts:test-checks-nothing shows the same in the terminal. Found a false positive? Report it.