Repository navigation
NMS-20586: Remove console noise from ui tests - #9182
Merged
Merged
Conversation
Register v-onms-tooltip for every test mount in a new tests/setup.ts, as the app does. This removes about 90% of the test output. The setup file also fails a test that causes a Vue or Vue Router warning. Fix the remaining warnings: stub router-link, give the Topology page a matched route, run hooks in an effect scope, and correct store mocks and props. Remove an unused class from the About dialogs and key GraphDataTable rows by index. Tests that expect a logged error now spy on the console and assert the call. Document the rule in ui/CLAUDE.md.
- Check for Vue warnings in beforeEach and afterAll too, so warnings from module scope, beforeAll or late async work are not lost or blamed on the wrong test. - Remove console.warn spies that only checked for the absence of a Vue warning. They turned the check off. This found a missing RouterLink stub in Graph.test.ts. - Remove the no-op onms-tooltip stubs. Keep the stubs that record the tooltip value. - Restore console spies in afterEach, not at the end of each test. - Compare component instances with === instead of the internal uid. - Use an absolute setupFiles path. - Update the rules in ui/CLAUDE.md.
synqotik
marked this pull request as ready for review
November 20, 2026 04:01
synqotik
requested review from
cgorantla,
christianpape and
marshallmassengill
November 20, 2026 04:01
marshallmassengill
requested changes
Nov 20, 2026
marshallmassengill
left a comment
Contributor
There was a problem hiding this comment.
- ui/tests/setup.ts fails a test only for a Vue warning or a Vue Router warning. A test that calls console.error or console.log passes and prints. Add a check for this output, or change the rule in ui/CLAUDE.md.
- 15 console spies have no assertion: 14 for console.error and 1 for console.log (Graph.test.ts:55). Add expect(...).toHaveBeenCalled() to each spy, or remove the spy. The files are:
- snmpDataCollectionDetailStore.test.ts (8)
- minionAdminService.test.ts (2)
- applicationAdminService.test.ts (1)
- monitoringLocationAdminService.test.ts (1)
- eventConfigDetailStore.test.ts (1)
- eventConfigStore.test.ts (1)
- Graph.test.ts (1)
- EventConfigUploadFilesTab.test.ts:379 replaces console.warn for a test that uses a mounted component. This stops the Vue warning check for that test. Remove mockImplementation and keep the spy. The warning then prints, and the check stays on.
- Add muteAppWarnings() in tests/vueWarnings.ts. It mutes an expected console.warn from app code but passes Vue warnings on to the check. Use it in EventConfigUploadFilesTab and sessionExpiry tests. - Assert every console spy that mutes output. Replace the beforeEach console.error mutes in two service tests with spies in the tests that log. - ui/CLAUDE.md: tests should run silently; only Vue warnings are enforced. Document muteAppWarnings().
Contributor
Author
|
@marshallmassengill - all addressed.
|
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.
pnpm testinui/wrote 46,255 lines to stderr. Of these, 90% were[Vue warn]: Failed to resolve directive: onms-tooltip. The noise made real warnings hard to find.Changes
ui/tests/setup.ts(VitestsetupFiles). It registersv-onms-tooltipfor every mount, as the app does. Remove the per-test registrations and no-op stubs that are now not necessary. Keep the stubs that record the tooltip value for an assertion.[Vue warn]or[Vue Router warn]. It also catches warnings from module scope,beforeAll,afterAlland late async work. New warnings cannot go into the suite.console.warnspies that only checked for the absence of one Vue warning. They turned the check off for the whole test.muteAppWarnings()(ui/tests/vueWarnings.ts). It mutes an expectedconsole.warnfrom app code, but Vue warnings still print and fail the test.router-link, give the Topology page a matched route, run hooks in aneffectScope(), use declared emit names, and correct store mocks and props.AboutDialog.vue(two files): removeclass="about-dialog". Vue did not apply it, and no style uses it.GraphDataTable.vue: key rows by index. A missing timestamp (NaN) gave an invalid key.consolein that test and assert the call.afterEachrestores the spies. Two service tests mutedconsole.errorfor the whole file; now only the tests that log mute it.ui/CLAUDE.md. Tests should run silently, but we are not strictly enforcing it in every case. For now, only Vue warnings are enforced.Result
The suite writes no output to stdout or stderr. All 399 test files pass.
Testing
Note: Vitest 4.1 hides console output when an AI agent runs it. To see the output, use
pnpm test --reporter=default --silent=false.External References