Fix errors during test script
Although all tests seem to pass, there are several warnings during the test run.
Here's the GitHub Actions log from pnpm test:ci command:
fix: Add basic user-agent to all mastodon-bound requests (#2277) · elk-zone/elk@302da09
$ pnpm run test:ci
> @elk-zone/[email protected] test:ci /Users/shuuji3/dev/elk
> nr test:unit:ci
> @elk-zone/[email protected] test:unit:ci /Users/shuuji3/dev/elk
> stale-dep && vitest run
[nuxt] Expected `@nuxt/kit` to be at least `3.14.1592` but got `3.14.159`. This might lead to unexpected behavior. Check your package.json or refresh your lockfile.
RUN v2.1.5 /Users/shuuji3/dev/elk
stdout | tests/nuxt/html-parse.test.ts
<Suspense> is an experimental feature and its API will likely change.
stdout | tests/nuxt/html-to-text.test.ts
<Suspense> is an experimental feature and its API will likely change.
stdout | tests/nuxt/content-rich.test.ts
<Suspense> is an experimental feature and its API will likely change.
stderr | tests/nuxt/content-rich.test.ts > content-rich > hashtag adds bdi
[Vue warn]: Failed to resolve component: VMenu
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <TagHoverWrapper tagName="turkey" class="inline-block" >
at <App>
stderr | tests/nuxt/content-rich.test.ts > content-rich > hashtag doesn't add 2 bdi
[Vue warn]: Failed to resolve component: VMenu
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <TagHoverWrapper tagName="turkey" class="inline-block" >
at <App>
stderr | tests/nuxt/content-rich.test.ts > content-rich > root p includes dir="auto" attr when mixed content
[Vue warn]: Failed to resolve component: VMenu
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <TagHoverWrapper tagName="turkey" class="inline-block" >
at <App>
[Vue warn]: Failed to resolve component: VMenu
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <TagHoverWrapper tagName="%D8%A7%D9%84%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9" class="inline-block" >
at <App>
[Vue warn]: Failed to resolve component: VMenu
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <TagHoverWrapper tagName="turkey" class="inline-block" >
at <App>
[Vue warn]: Failed to resolve component: VMenu
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <TagHoverWrapper tagName="%D8%A7%D9%84%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9" class="inline-block" >
at <App>
✓ tests/unit/language.test.ts (1)
✓ tests/unit/permalinks.test.ts (6)
✓ tests/unit/reorder-timeline.test.ts (2)
✓ tests/nuxt/content-rich.test.ts (25)
✓ tests/nuxt/html-parse.test.ts (8)
✓ tests/nuxt/html-to-text.test.ts (3)
Test Files 6 passed (6)
Tests 45 passed (45)
Start at 19:32:47
Duration 5.23s (transform 3.74s, setup 7.41s, collect 3.47s, tests 212ms, environment 2.04s, prepare 2.24s)
I can fix the [Vue warn]: Failed to resolve component: VMenu by using the component that I suspect this is using implicitly:
https://floating-vue.starpad.dev/guide/component#hover-menu
The component is exported as Menu from floating-vue, but is supposed to be registered as VMenu when defining the Nuxt plugin. Dunno why that's not picked up by Vitest or by intellisense though.
A possible fix is implicitly importing the component before using it:
import { Menu as VMenu } from 'floating-vue'
This fixes the warnings, but then it changes the test snapshots by actually calling the component's logic instead of treating it as a custom HTML tag.