An assertion runs in the body of a suite or at the top of a test file, outside any test
What it finds
The body of a describe runs while tests are collected, before any of them. An assertion there is not part of a test: its failure aborts collection or is reported against no test, and it checks state that the hooks have not set up yet.
Reported are expect(...) calls whose nearest enclosing function is the callback of a suite.
From the rule's source, assertion_outside_test.rs.
describe("config", () => { const config = load(); expect(config).toBeDefined();tx0 reports: this assertion runs while tests are collected it("has a port", () => { expect(config.port).toBe(80); });});declare function load(): { port: number }; Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:assertion-outside-test" = "off"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:assertion-outside-test] reason="..."tx0 explain tx0/ts:assertion-outside-test shows the same in the terminal. Found a false positive? Report it.