Skip to content

chore(test): silence Vue warnings in the unit test suite - #7110

Merged
eddieferrer merged 2 commits into
mainfrom
chore/unit-test-warning-cleanup
Jul 28, 2026
Merged

chore(test): silence Vue warnings in the unit test suite#7110
eddieferrer merged 2 commits into
mainfrom
chore/unit-test-warning-cleanup

Conversation

@eddieferrer

Copy link
Copy Markdown
Contributor

What

Cuts [Vue warn] output from npm run unit from 75 to 3, with no change
to what the suite covers: 299 files / 4412 tests pass before and after, none
added, skipped, or removed.

The noise made it hard to spot a real failure in CI output, and two of the
warnings turned out to be masking actual spec bugs (see below).

Why the shared config is split two ways

test/unit/setup.js gets the defaults that can't collide — the kvTrackEvent
directive and an apollo provide, via VTU config.global. Specs' own global
blocks merge on top and still win.

test/unit/specUtils.js gets routerLinkStub and mockRouterObject as
opt-in helpers. These deliberately are not global: registering RouterLink
or providing vue-router's routerKey suite-wide collides with the three specs
that build a real router (BasketItem, ThanksPageSingleVersion,
RouteListing), where <router-link> is expected to render an anchor with
role="link". My first attempt did make them global and broke
BasketItem's getByRole('link').

routerLinkStub renders a literal <router-link to="..."> element, matching
the DOM Vue emitted while the component was unresolved. That's intentional:
specs query router-link[to="..."] (TeamMessageCard) and getAttribute('to')
(TeamCard). The goal is to silence the resolve warning, not to change rendered
output — so this PR changes no assertions.

Two spec bugs the warnings were hiding

  • BadgeMilestone.spec.js spread globalOptions at the top level of its
    render options, where VTU ignores directives/provide/mocks entirely.
    Its mocks were inert across all 8 tests. Now global: globalOptions.

  • useMyKivaHome.spec.js called the composable bare in 2 of 11 tests, so
    its onMounted had no instance to attach to. Both now wrap it in a
    TestComponent like the other nine.

    The reactive computed properties test asserts pre-fetch defaults, which
    depends on the mount hook not having completed. Its assertions stay
    synchronous after render(): onMounted fires, but its apollo query
    resolves on a later microtask, so the values are still the defaults. The flip
    to /mykiva after resolution is covered by two sibling tests, which confirms
    that assertion isn't trivially true.

Two import-order constraints, documented in the files

Both cost a debugging cycle, so they're comments where the next person will hit
them:

  • setup.js must not import from #src. Importing KvAuth0 pulled in
    syncDate before syncDate.spec.js could vi.mock('timesync'), breaking all
    10 of its tests.
  • specUtils.js must not import routerKey from vue-router. Several specs
    vi.mock('vue-router') without re-exporting it, and the import broke their
    collection. The one spec that needs the key imports it directly.

The 3 remaining warnings

All intentional or out of scope:

Warning Status
injection "apollo" not found Intentional — test named "should not query when apollo is not provided"; uses raw createApp, so config.global never applies
Invalid prop: custom validator "state" Intentional — FeaturedGoalCard deliberately passes state="something-unsupported"
Invalid prop: type check "to" Pre-existing bug in RouteListing.vue:56, tackled separately

Testing

  • npm run unit — 299 files / 4412 tests pass, exit 0
  • npm run lint — exit 0 (the 7 remaining warnings are pre-existing GraphQL
    schema warnings in untouched files)
  • No product code changed; test/ only

Cuts [Vue warn] output in `npm run unit` from 75 to 5 with no change to
test counts (299 files / 4412 tests still pass).

- setup.js: register the kvTrackEvent directive and an apollo provide as
  VTU config.global defaults, so specs get the basics without opting in.
- specUtils.js: add routerLinkStub and mockRouterObject as opt-in helpers.
  These can't be global: registering RouterLink or providing routerKey
  suite-wide collides with the specs that build a real router, where
  <router-link> is expected to render an anchor with role="link".
- routerLinkStub renders a literal <router-link to="..."> element, matching
  the DOM Vue emitted while the component was unresolved, so specs that
  query `router-link[to="..."]` or getAttribute('to') keep working. The goal
  is to silence the resolve warning, not to change rendered output.
- BadgeMilestone.spec.js spread globalOptions at the top level of its render
  options, where VTU ignores directives/provide/mocks; its mocks were inert.

Two import-order constraints are documented in the files: setup.js must not
import from #src (importing KvAuth0 pulled in syncDate and broke
syncDate.spec.js, which mocks timesync), and specUtils.js must not import
routerKey from vue-router (it breaks collection of specs that mock
vue-router without re-exporting it).
Two of the eleven tests called useMyKivaHome() bare, outside any component,
so the composable's onMounted hook had no instance to attach to and Vue
warned. Wrap both in a TestComponent, matching the other nine tests.

The 'reactive computed properties' test asserts pre-fetch defaults, which
depends on the mount hook not having completed. Its assertions stay
synchronous after render(): onMounted now fires, but its apollo query
resolves on a later microtask, so the values are still the defaults. The
flip to /mykiva after resolution is covered separately.

Vue warnings in `npm run unit` drop from 5 to 3.
@eddieferrer
eddieferrer merged commit aab489a into main Jul 28, 2026
6 checks passed
kiva-robot added a commit that referenced this pull request Jul 29, 2026
## [3.81.0-rc.1](v3.80.0...v3.81.0-rc.1) (2026-07-29)

### 🎉 New Features

* [MP-3057] - goal in review slide 4 ([#7089](#7089)) ([4db4ab2](4db4ab2))
* create slides 5 to 7 to goal in review modal ([636bf35](636bf35))
* meta event cleanup ([#7108](#7108)) ([8bf4c15](8bf4c15))
* **sitemap:** resolve and link redirect targets in the route listing ([#7111](#7111)) ([d28b2e6](d28b2e6))

### 🐛 Bugfixes

* align comment section visibility with legacy showSocialInfo rules ([83d7da3](83d7da3))
* beta page minor tweaks ([#7117](#7117)) ([cc7bf6a](cc7bf6a))
* **borrower-profile:** show comments only to privileged users ([94d21c0](94d21c0))
* conflicts ([8d5ef8a](8d5ef8a))
* **esiHead:** read the basket cookie instead of creating a basket ([2442ed2](2442ed2))
* font size in collective impact section ([939f93c](939f93c))
* hide borrower profile comments on anonymized loans for all users ([ad908b7](ad908b7))
* in-progress goal copy in form slide ([672ad7d](672ad7d))
* lint issue ([0478e38](0478e38))
* require lending to the loan for fundraising comment eligibility ([9ed01b2](9ed01b2))
* resolve issues with date picker on transaction beta ([#7112](#7112)) ([1effc61](1effc61))
* solve design comments ([1585b60](1585b60))
* unrelevant comment ([39595d1](39595d1))

### 🪚 Refactors

* **borrower-profile:** drop canAddComment gating from LoanComments ([d4efb82](d4efb82))

### 🔍 Tests

* **esiHead:** cover the basket-gated shop query ([114bcc1](114bcc1))

### 🧹 Chores

* **deps-dev:** bump @babel/core from 7.24.5 to 7.29.7 ([#7094](#7094)) ([ab4e380](ab4e380))
* **deps-dev:** bump postcss from 8.5.10 to 8.5.12 ([#7091](#7091)) ([476cde0](476cde0))
* **deps-dev:** bump postcss from 8.5.12 to 8.5.18 ([#7101](#7101)) ([0375b47](0375b47))
* **deps:** bump @grpc/grpc-js from 1.9.13 to 1.14.4 ([#6979](#6979)) ([c18472a](c18472a))
* **deps:** bump auth0-js from 9.19.2 to 10.0.0 ([#6886](#6886)) ([20fc0d0](20fc0d0))
* **deps:** bump axios from 1.13.5 to 1.18.1 ([#7073](#7073)) ([e2cc6d1](e2cc6d1))
* **deps:** bump body-parser from 1.20.4 to 1.20.6 ([#7077](#7077)) ([5b1e248](5b1e248))
* **deps:** bump immutable from 5.1.5 to 5.1.9 ([#7083](#7083)) ([9b9fab6](9b9fab6))
* **deps:** bump json-schema and jsprim ([#7099](#7099)) ([8e77dd8](8e77dd8))
* **deps:** bump piscina from 4.7.0 to 4.9.3 ([#7009](#7009)) ([875d847](875d847))
* **deps:** bump serialize-javascript from 7.0.4 to 7.0.7 ([#7096](#7096)) ([7004bf6](7004bf6))
* **deps:** bump svgo from 3.3.3 to 3.3.4 ([#7084](#7084)) ([05f7bd9](05f7bd9))
* **deps:** bump the minor-patch-other group across 1 directory with 30 updates ([#7100](#7100)) ([a348e75](a348e75))
* **deps:** bump uuid from 8.3.2 to 14.0.0 ([#6861](#6861)) ([e8b3ea1](e8b3ea1))
* **deps:** bump vue3-touch-events from 4.1.8 to 5.0.15 ([#6740](#6740)) ([63a35b9](63a35b9))
* **deps:** bump web-vitals from 3.5.2 to 6.0.0 ([#6941](#6941)) ([31f3af6](31f3af6))
* review and approve deps with install scripts in ui repo ([84fb538](84fb538))
* **test:** silence Vue warnings in the unit test suite ([#7110](#7110)) ([aab489a](aab489a))
* upgrade Node from 20 to 24 ([#7107](#7107)) ([5a26c89](5a26c89))
@kiva-robot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 3.81.0-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

kiva-robot added a commit that referenced this pull request Jul 30, 2026
## [3.81.0](v3.80.0...v3.81.0) (2026-07-30)

### 🎉 New Features

* [MP-3057] - goal in review slide 4 ([#7089](#7089)) ([4db4ab2](4db4ab2))
* create slides 5 to 7 to goal in review modal ([636bf35](636bf35))
* meta event cleanup ([#7108](#7108)) ([8bf4c15](8bf4c15))
* **sitemap:** resolve and link redirect targets in the route listing ([#7111](#7111)) ([d28b2e6](d28b2e6))

### 🐛 Bugfixes

* align comment section visibility with legacy showSocialInfo rules ([83d7da3](83d7da3))
* beta page minor tweaks ([#7117](#7117)) ([cc7bf6a](cc7bf6a))
* **borrower-profile:** show comments only to privileged users ([94d21c0](94d21c0))
* conflicts ([8d5ef8a](8d5ef8a))
* **esiHead:** read the basket cookie instead of creating a basket ([2442ed2](2442ed2))
* font size in collective impact section ([939f93c](939f93c))
* hide borrower profile comments on anonymized loans for all users ([ad908b7](ad908b7))
* in-progress goal copy in form slide ([672ad7d](672ad7d))
* lint issue ([0478e38](0478e38))
* require lending to the loan for fundraising comment eligibility ([9ed01b2](9ed01b2))
* resolve issues with date picker on transaction beta ([#7112](#7112)) ([1effc61](1effc61))
* solve design comments ([1585b60](1585b60))
* unrelevant comment ([39595d1](39595d1))
* update kv-components and kv-shop with latest versions to support header experiment ([d7e631a](d7e631a))

### 🪚 Refactors

* **borrower-profile:** drop canAddComment gating from LoanComments ([d4efb82](d4efb82))

### 🔍 Tests

* **esiHead:** cover the basket-gated shop query ([114bcc1](114bcc1))

### 🧹 Chores

* **deps-dev:** bump @babel/core from 7.24.5 to 7.29.7 ([#7094](#7094)) ([ab4e380](ab4e380))
* **deps-dev:** bump postcss from 8.5.10 to 8.5.12 ([#7091](#7091)) ([476cde0](476cde0))
* **deps-dev:** bump postcss from 8.5.12 to 8.5.18 ([#7101](#7101)) ([0375b47](0375b47))
* **deps:** bump @grpc/grpc-js from 1.9.13 to 1.14.4 ([#6979](#6979)) ([c18472a](c18472a))
* **deps:** bump auth0-js from 9.19.2 to 10.0.0 ([#6886](#6886)) ([20fc0d0](20fc0d0))
* **deps:** bump axios from 1.13.5 to 1.18.1 ([#7073](#7073)) ([e2cc6d1](e2cc6d1))
* **deps:** bump body-parser from 1.20.4 to 1.20.6 ([#7077](#7077)) ([5b1e248](5b1e248))
* **deps:** bump immutable from 5.1.5 to 5.1.9 ([#7083](#7083)) ([9b9fab6](9b9fab6))
* **deps:** bump json-schema and jsprim ([#7099](#7099)) ([8e77dd8](8e77dd8))
* **deps:** bump piscina from 4.7.0 to 4.9.3 ([#7009](#7009)) ([875d847](875d847))
* **deps:** bump serialize-javascript from 7.0.4 to 7.0.7 ([#7096](#7096)) ([7004bf6](7004bf6))
* **deps:** bump svgo from 3.3.3 to 3.3.4 ([#7084](#7084)) ([05f7bd9](05f7bd9))
* **deps:** bump the minor-patch-other group across 1 directory with 30 updates ([#7100](#7100)) ([a348e75](a348e75))
* **deps:** bump uuid from 8.3.2 to 14.0.0 ([#6861](#6861)) ([e8b3ea1](e8b3ea1))
* **deps:** bump vue3-touch-events from 4.1.8 to 5.0.15 ([#6740](#6740)) ([63a35b9](63a35b9))
* **deps:** bump web-vitals from 3.5.2 to 6.0.0 ([#6941](#6941)) ([31f3af6](31f3af6))
* **release:** 3.81.0-rc.1 [skip ci] ([0163e6b](0163e6b)), closes [#7089](#7089) [#7108](#7108) [#7111](#7111) [#7117](#7117) [#7112](#7112) [#7094](#7094) [#7091](#7091) [#7101](#7101) [#6979](#6979) [#6886](#6886) [#7073](#7073) [#7077](#7077) [#7083](#7083) [#7099](#7099) [#7009](#7009) [#7096](#7096) [#7084](#7084) [#7100](#7100) [#6861](#6861) [#6740](#6740) [#6941](#6941) [#7110](#7110) [#7107](#7107)
* **release:** 3.81.0-rc.2 [skip ci] ([be0c580](be0c580))
* review and approve deps with install scripts in ui repo ([84fb538](84fb538))
* **test:** silence Vue warnings in the unit test suite ([#7110](#7110)) ([aab489a](aab489a))
* upgrade Node from 20 to 24 ([#7107](#7107)) ([5a26c89](5a26c89))
@kiva-robot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 3.81.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants