Repository navigation
test(rules): await rule.run() in every rules test, typecheck tests in CI #1863 - #1864
Merged
Merged
Conversation
Signed-off-by: Nik Cubrilovic <[email protected]>
… in CI #1863 Every rules test now awaits rule.run() or an async helper before asserting, the remaining fixture type errors are fixed, and fold-inconclusive-1031 asserts on notEvaluated (the field evaluated became), where it compared null to null. tsconfig.test.json goes from 952 errors to 0 and runs as part of the package typecheck. Signed-off-by: Nik Cubrilovic <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1863.
Summary
rule.run(), or an async helper that does, before it asserts. Tests whose callbacks now await areasync, and every helper that callsrun()returns a Promise and is awaited by its callers.src/. Partial fixtures get typed casts,RedirectChain/SiteQuery/PageFeatureRowfixtures get the fields they were missing, andtest(name, { timeout }, fn)becomestest(name, fn, { timeout }). Non-uregex literals that tsgo rejects becomenew RegExp(...)with the same source and flags.tests/fold-inconclusive-1031.test.tswas vacuous for a different reason. It readsignal.evaluated, a field that no longer exists (it becamenotEvaluated, which holds the complement), so it comparednullwithnull. It now asserts that the folded and raw signals have equalnotEvaluatedmaps and that the key lists every page. The rule is correct: the new assertion passes, and it fails when resolution ignores the inconclusive marker.packages/rulestypecheck is nowtsgo --noEmit && tsgo --noEmit -p tsconfig.test.json, so CI'sbun run typecheckkeeps the tests at 0 errors.tsconfig.test.jsonerrors: 952 before, 0 after.Mutation checks (the 10 named files)
For each file I made a local edit to the rule that inverts its verdict, ran the file, then restored
src/withgit checkout.warn/pass. B: drop the first item, suppress the unconfirmed rowwarn/passwarn/passwarn/pass. B:skippedtoinfo, drop the first item, bare labels. C: invert orphan-pages and weak-internal-links, and empty their itemswarn/pass,skippedtopasspasstowarn,fail/warntopass,skippedtopass. B: constant message, emptydetails.kindsfindUnrenderedMarkup/isCodeLikeElementhelpers and never callrun()pass/info, and a page with no document emits a checkfindFrameworkPayloadsunscannedcondition and the pass conditionbuildCollectedPageSignaland never callrun()publicByDesignin the scannerscanContenttests. The other 24 test detection and skip logic and never callrun()inconclusivemarkernotEvaluated[key]is undefined)Eight of the ten already threw if
run()returned a Promise, so they were not actually vacuous. They are converted anyway, as the issue asks.Acceptance criteria
rule.run()or uses a helper that does. Evidence:tsgo -p tsconfig.test.jsonreports 0 errors, so no test reads.checksfrom aPromise | RuleResult.rule.run().bunx tsgo --noEmit -p packages/rules/tsconfig.test.jsonreports 0 errors and is wired into the package typecheck.Gates
bun run typecheckinpackages/rules(both configs): exit 0.bun run typecheckat the repo root: exit 0.bun run scripts/test-suites.ts --check: ok.packages/ruleshas no format or lint script.Agent skill
No change to the squirrelscan agent skill is needed (test-only change).