Repository navigation
build: fail frontend-base package tests on unexpected console output - #2219
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## frontend-base #2219 +/- ##
=================================================
- Coverage 100.00% 96.16% -3.84%
=================================================
Files 6 374 +368
Lines 9 6028 +6019
Branches 0 1486 +1486
=================================================
+ Hits 9 5797 +5788
- Misses 0 222 +222
- Partials 0 9 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
brian-smith-tcril
force-pushed
the
bsmith/test-console-noise
branch
from
October 22, 2026 08:26
8d56fdc to
7c35d8c
Compare
4 tasks done
brian-smith-tcril
added a commit
to brian-smith-tcril/bairf
that referenced
this pull request
Oct 22, 2026
… scaffold-frontend-base) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 tasks
brian-smith-tcril
marked this pull request as ready for review
October 22, 2026 09:34
This was referenced Oct 22, 2026
brian-smith-tcril
force-pushed
the
bsmith/test-console-noise
branch
from
October 29, 2026 16:59
7c35d8c to
e4c0999
Compare
Base automatically changed from
bsmith/scaffold-frontend-base
to
frontend-base
November 10, 2026 16:18
brian-smith-tcril
force-pushed
the
bsmith/test-console-noise
branch
2 times, most recently
from
November 10, 2026 17:22
aa3d4dd to
8db7a03
Compare
The validate workflow runs on pushes to master and on every pull request, so a commit landing on frontend-base gets only the package workflow's coverage upload. Codecov's project status compares a PR head's total coverage with its base commit's report: once #2217 merged, this PR's base was the merge commit, whose report held the package's nine lines at 100%, and the head's whole-repo 96.16% read as a 3.84 point drop. Pushes to frontend-base now run validate too, so each merge into the branch uploads the root suite and the comparison is whole repo against whole repo. The push that carries this change is the first. Part of #2218. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…utput jest-fail-on-console in the setup file: a test that prints to console.error or console.warn fails with the printed message. react-router 6's two future flag warnings are silenced, since the runtime router is the shell's and opting in is frontend-base's call (openedx/frontend-base#325). Part of #2218. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
brian-smith-tcril
force-pushed
the
bsmith/test-console-noise
branch
from
November 10, 2026 17:39
8db7a03 to
dc05229
Compare
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.
Summary
The frontend-base package's test suite now fails any test that prints an unexpected
console.warnorconsole.error, so every later port lands with a silent suite and the noisemaster's suite has accumulated (2,101 console blocks in one run) does not move across with the tests. The two react-router 6 future flag warnings, which belong to the shell's router (openedx/frontend-base#325), are silenced by name. No user-facing change; test tooling only.Part of #1905. Resolves #2218. Stacked above #2217.
What changed
frontend-base/package.json, lockfile:jest-fail-on-consoleas a dev dependency.frontend-base/src/setupTest.js:failOnConsolewith asilenceMessagelist, one regex per silenced message grouped under the URL of the issue that owns it; its only group is the two react-router flags.testjob showed the failure; it is squashed out of the branch. The PR lands as a rebase merge, two commits (decision 6)..github/workflows/validate.yml:frontend-basejoinsmasterin the push branches, the bottom commit, added 2026-11-10 (decision 5).Testing
In
frontend-base/:npm testwith the throwaway fails that one test with "Expected test not to call console.warn()" and passes the other two, the two router warnings no longer printing; without it, 2 tests pass at 100% lines with no console block; lint and build green. CI: run 1 red on the throwaway, run 2 green, recorded below.Decisions
What was decided while building this layer; the mechanism and the inventory of
master's noise are in #2218.Full decision log
Decisions — fail frontend-base package tests on unexpected console output (#2218)
Decisions made while implementing. The mechanism, the inventory of
master's noise and the commit shape are in #2218's plan and are notrepeated.
Silence, not allow.
jest-fail-on-consoleoffersallowMessage(the test passes, the message still prints) and
silenceMessage(thetest passes, nothing prints). The two react-router messages go through
silenceMessage: the point of the layer is a silent suite, and amessage that prints on every run is noise whether or not it fails.
The silenced list names the two flags, not the warning family. A
first cut matched the
⚠️ React Router Future Flag Warningprefix,which would also have swallowed a warning for any of the other six v7
flags react-router 6.30 knows, none of which
React Router v6 deprecation/future flag warnings frontend-base#325 covers. Each entry
is one regex anchored on the prefix and the flag name in backticks, so
a warning for another flag fails the test that triggers it.
Shape of the list: inline under
silenceMessage, grouped by issueURL, no prose comment. Written for the day it holds ten entries from
several issues: a URL line above the patterns it owns, patterns as
plain regex literals, the matcher a one-line
some. Inline rather thana file-level constant because nothing else reads the list and the
failOnConsolecall is then the one block a reader opens for consolehandling; the per-call allocation of the array is not measurable.
Code comments cite the issue by full URL, since GitHub's
owner/repo#Nshorthand only renders in GitHub markdown. A sentence explaining the
list was dropped: the option name and the shape already say it.
No muting convention in the setup file. The issue's draft had the
"mock the console method in the test" rule written as a comment beside
the hook; it restates what the library's failure message tells the
developer at the moment it matters, so the rule lives in Fail frontend-base package tests on unexpected console output #2218 and the
acceptance box for it was dropped. The jest config does not restore
mocks automatically, so a test that mocks a console method restores it
at its end.
Manual testing
Manual testing — fail frontend-base package tests on unexpected console output (#2218)
Test tooling only; nothing renders differently. The evidence is two CI
runs on #2219, in the fail-then-pass shape.
The validate workflow runs on pushes to
frontend-base. Added2026-11-10 as the bottom commit of this PR, Brian's call, after feat: scaffold the frontend-base package #2217
merged and this PR's
codecov/projectstatus went red: "96.16%(-3.84%) compared to 2764e40".
validate.ymlran on pushes tomasterand on every pull request;frontend-base.ymlruns on pushesto
frontend-basethat touchfrontend-base/. So the merge commit'sCodecov report held one upload, the
frontend-baseflag (6 files, 9lines, 100%), while this PR's head held that plus the unflagged root
suite (374 files, 6028 lines, 96.16%), and the project status
(
target: auto,threshold: 0%incodecov.yml) read a whole-reponumber against a package-only one. feat: add the frontend-base route tree with stub pages, roles and provides #2221 and refactor: port the dates tab to frontend-base #2234 compare against
the PR below each and pass; every PR into
frontend-basewould showthis once the PR below it merged. With the branch in the push list,
every merge into it uploads the root suite. GitHub reads the workflow
file from the pushed commit, so the merge of this PR is the first such
push and
master's file is untouched; the list rides intomasterat the swap. Considered and not taken: a project status scoped with
flags: [frontend-base](Codecov docs, "Commit status", heading"flags": "the combined coverage from those flags will be reported"),
which adds a passing package-only status but leaves the whole-repo
one red, or with
default: falsedrops it formasterPRs too; nostatus key selects a PR's target branch.
Two commits, landed by rebase merge. Decided 2026-11-10 with
entry 5, Brian's call. The validate trigger and the console hook are
separate facts for
frontend-base's history, so the PR lands as arebase merge rather than the squash a layer usually gets. The
throwaway test and its removal, the branch's first two commits, are
squashed into the hook commit beforehand, so neither the failing test
nor its removal lands; the PR's first CI run, red on the throwaway,
stays the evidence that the hook fails a test. The hook commit's
package tree is unchanged by the squash.
Verify
09afe9ba, commit 1 with the throwaway test.The
frontend-baseworkflow'stestjob fails:FAIL src/console-noise.test.tswith "Expected test not to callconsole.warn()" and the printed
unexpected;src/app.test.tsandsrc/Main.test.tsxpass; the job log contains no React Routerfuture flag warning, so the two silenced messages are gone from the
output as well as from the failures.
codecov/projectis red onthis run, "96.15% (-0.01%) compared to f8a64c1": the test step
failed before the coverage step, so the commit has only the legacy
upload and the combined number lost the package's lines; the legacy
testsjob, commitlint, version-check and the CLA are green.8d56fdc5, commit 2 removes the throwaway:src/app.test.tsandsrc/Main.test.tsxpass, 2 of 2; zero consoleblocks in the
teststep's log; all eight checks green, withcodecov/projectback at "96.16% (+0.00%) compared to f8a64c1".The only extra output in the job is a Browserslist notice that the
package's
caniuse-litedata is six months old (twice in the Teststep, once in Build (CI)); that is the package lockfile's pin, not
a console call, and not something the hook sees. After the
caniuse-litebump in feat: scaffold the frontend-base package #2217's first commit, the rerun on7c35d8c2is green with no Browserslist notice in the job (feat: scaffold the frontend-base package #2217's rerun on
f5b78764likewise).Left to the automated suite
console.warnorconsole.errorin a test fails that test.🤖 Generated with Claude Code