Lint rule B7 judges a test by its file name, so the build renames tests to please it #278
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
Lint rule B7 ("the test file imports the module under test") guesses the module from the test file's name. In run 133 the build wrote
test/pixel-font.test.js, importing../helloworld.js, and B7 flagged it. The agent renamed the file twice (helloworld-font, thenhelloworld.digits), still flagged, then folded the tests intotest/helloworld.test.js. That cost 2 turns, and the tests now live in a file chosen to please the lint. B7 doesn't block a step, but the apply brief says to fix whatban-checkreports.Fix
B7 accepts a test that imports any of the repository's own source modules (a relative import of a non-test file), not just one named like the test. Or the brief names the blocking rules (B1, B2, B6) and calls the rest advice.
Done when
A test named for its feature that imports the real module passes
ban-checkwith no B7 finding.Not done yet: B7 doesn't see a dynamic import. The fix in PR #284 (B7 asks for some of the project's own code) is live, and run 136's apply acted on no B7 finding. But its
agent.write-spec-testsspent minutes on one: "B7 wants a static relative import; myawait import()isn't seen. I'll move the DOM stub into a helper module imported statically."_IMPORT_REmatchesimport(...)only at the start of a line, soconst app = await import('../app.js')counts as no import. The agent's restructure would still be flagged under the new rule, since its only seen import would be a helper.Fix: read
import('…')anywhere on a line (andawait import). Done when a test whose only import of the code isconst app = await import('../app.js')has no B7 finding.Closing in favour of #294: B7 is removed rather than fixed. It misfired in runs 133, 134 and 136 and only ever advised.