Closed inouetakuya closed 1 month ago
debug: Comment out supporting options api in renderSuspended
-> Test fails.
$ pnpm prepack && pnpm test:examples
βWARNβ Unsupported engine: wanted: {"node":">=18.20.4"} (current: {"node":"v18.19.0","pnpm":"9.11.0"})
> @nuxt/test-utils@3.14.2 prepack /Users/inouetakuya/src/github.com/inouetakuya/test-utils
> unbuild
βΉ Building test-utils 10:01:58
βΉ Cleaning dist directory: ./dist 10:01:58
61ββ .nuxt/test/jy8ffo/output/server/chunks/_/error-500.mjs (4.77 kB) (2.02 kB gzip)
β ββ .nuxt/test/jy8ffo/output/server/chunks/routes/renderer.mjs.map (960 B) (402 B gzip)
β ββ .nuxt/test/jy8ffo/output/server/chunks/runtime.mjs (166 kB) (40.5 kB gzip)
β ββ .nuxt/test/jy8ffo/output/server/chunks/runtime.mjs.map (6.18 kB) (1.04 kB gzip)
β ββ .nuxt/test/jy8ffo/output/server/chunks/virtual/_virtual_spa-template.mjs (94 B) (100 B gzip)
β ββ .nuxt/test/jy8ffo/output/server/chunks/virtual/_virtual_spa-template.mjs.map (112 B) (111 B gzip)
β ββ .nuxt/test/jy8ffo/output/server/index.mjs (291 B) (193 B gzip)
β ββ .nuxt/test/jy8ffo/output/server/package.json (600 B) (299 B gzip)
Listening on http://127.0.0.1:50352
β [nitro] β You can preview this build using node .nuxt/test/jy8ffo/output/server/index.mjs
β Ξ£ Total size: 1.69 MB (410 kB gzip)
β > example-app-vitest-full@ test:happy-dom /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full
β > VITEST_DOM_ENV=happy-dom pnpm test:unit --run
β > example-app-vitest-full@ test:unit /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full
β > vitest "--run"
β From custom module!
β RUN v2.1.2 /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full
β stdout | tests/nuxt/mock-vue-router.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/mount-suspended.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/mock-component-1.spec.ts
β <Suspense> is an experimental feature and its API will likely change.kuya/test-utils/examples/app-playwright/.nuxt/test/5jkthk/analyze/.β¦
β stdout | tests/nuxt/routing.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/server.spec.ts:1 βΊ test
[Desktop Chrome] βΊ basic.test.ts:17:1 βΊ testing
β stdout | tests/nuxt/mock-indexeddb.spec.tst
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/auto-import.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/auto-import-mock.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/render-suspended.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β β tests/nuxt/auto-import.spec.ts (3 tests) 9msuetakuya/src/github.com/inouetakuya/test-utils
β β tests/nuxt/mock-component-1.spec.ts (1 test) 24msr test --filter example-app-cucumber
β β tests/nuxt/mock-indexeddb.spec.ts (1 test) 28ms
β β tests/nuxt/auto-import-mock.spec.ts (2 tests) 8ms
β β tests/nuxt/mock-vue-router.spec.ts (1 test) 7ms
β β tests/nuxt/routing.spec.ts (3 tests) 130ms
β β tests/nuxt/server.spec.ts (4 tests) 83msxperimental-vm-modules node_modules/jest/bin/jest.js
β stderr | tests/nuxt/render-suspended.spec.ts > renderSuspended > should render asyncData and other options api properties within nuxt suβ¦
β [Vue warn]: Unhandled error during execution of render function
β at <OptionsApiPage > c.test.ts:17:1 βΊ testing
β at <RenderHelper> asic.test.ts:3:1 βΊ test
β at <Anonymous ref="VTU_COMPONENT" > βΊ testing
β at <VTUROOT>s transformed.
β β tests/nuxt/mount-suspended.spec.ts (25 tests | 1 skipped) 172ms
β stdout | tests/nuxt/mock-component-3.spec.ts-dom && pnpm test:jsdom && pnpm test:dev && pnpm test:types
β <Suspense> is an experimental feature and its API will likely change.ub.com/inouetakuya/test-utils/examples/app-vitest-full
β stdout | tests/nuxt/injected-value-component.spec.ts
β <Suspense> is an experimental feature and its API will likely change.m/inouetakuya/test-utils/examples/app-vitest-full
β β tests/nuxt/mock-component-3.spec.ts (1 test) 18ms
β β tests/nuxt/injected-value-component.spec.ts (1 test) 20ms
β stdout | tests/nuxt/mount-component.spec.tscom/inouetakuya/test-utils/examples/app-vitest-full
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/mock-nuxt-composable-1.spec.ts
β <Suspense> is an experimental feature and its API will likely change./examples/app-vitest
β β tests/nuxt/mount-component.spec.ts (1 test) 11ms
β stdout | tests/nuxt/mock-component-2.spec.tss API will likely change.
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/mock-component-expose-setup-state.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/mock-nuxt-composable-3.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β β tests/nuxt/mock-nuxt-composable-1.spec.ts (1 test) 8ms
β β tests/nuxt/mock-component-expose-setup-state.spec.ts (1 test) 9ms
β β tests/nuxt/mock-component-2.spec.ts (1 test) 38ms
β β tests/nuxt/mock-nuxt-composable-3.spec.ts (2 tests) 9ms
β stdout | tests/nuxt/config.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β β tests/nuxt/config.spec.ts (1 test) 3ms
β β tests/unit/index.spec.ts (1 test) 1ms
β β pages/index.vue (1 test) 1ms
β β― tests/nuxt/render-suspended.spec.ts (12 tests | 1 failed) 5106ms
β Γ renderSuspended > should render asyncData and other options api properties within nuxt suspense
β β Test timed out in 5000ms.
β If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
β stdout | tests/nuxt/plugins.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β stdout | tests/nuxt/mock-nuxt-composable-2.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β β tests/nuxt/plugins.spec.ts (1 test) 12ms
β β tests/nuxt/mock-nuxt-composable-2.spec.ts (1 test) 11ms
β β―β―β―β―β―β―β― Failed Tests 1 β―β―β―β―β―β―β―
β FAIL tests/nuxt/render-suspended.spec.ts > renderSuspended > should render asyncData and other options api properties within nuxt suspβ¦
β Error: Test timed out in 5000ms.
β If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
β β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―[1/1]β―
β β―β―β―β― Unhandled Rejection β―β―β―β―β―
β TypeError: _ctx.greetingInMethods is not a function
β β― Proxy._sfc_render pages/other/options-api.vue:22:10
β β―β―β―β―β―β― Unhandled Errors β―β―β―β―β―β―
β Vitest caught 1 unhandled error during the test run.
β This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
β 20| </li>
β 21| <li data-testid="greetingInMethods">
β 22| {{ greetingInMethods() }}
β | ^
β 23| </li>
β 24| <li data-testid="returnData1">
β β― Proxy.clonedComponent.render ../../dist/runtime-utils/index.mjs:264:39
β β― renderComponentRoot ../../node_modules/.pnpm/@vue+runtime-core@3.5.6/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6365:16
β β― ReactiveEffect.componentUpdateFn [as fn] ../../node_modules/.pnpm/@vue+runtime-core@3.5.6/node_modules/@vue/runtime-core/dist/runtimeβ¦
β β― ReactiveEffect.run ../../node_modules/.pnpm/@vue+reactivity@3.5.6/node_modules/@vue/reactivity/dist/reactivity.cjs.js:226:19
β β― setupRenderEffect ../../node_modules/.pnpm/@vue+runtime-core@3.5.6/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:5322:5
β β― ../../node_modules/.pnpm/@vue+runtime-core@3.5.6/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7064:9
β This error originated in "tests/nuxt/render-suspended.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, bβ¦
β The latest test that might've caused the error is "should render asyncData and other options api properties within nuxt suspense". It miβ¦
β - The error was thrown, while Vitest was running this test.
β - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
β β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―β―
β Test Files 1 failed | 20 passed (21)
β Tests 1 failed | 63 passed | 1 todo (65)
β Errors 1 error
β Start at 10:02:06
β Duration 9.67s (transform 2.75s, setup 44.53s, collect 4.03s, tests 5.70s, environment 7.50s, prepare 8.42s)
β βELIFECYCLEβ Command failed with exit code 1.
β βELIFECYCLEβ Command failed with exit code 1.
ββ Failed in 13.3s at /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full
examples/app-vitest test$ vitest run
β RUN v2.1.2 /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest
β stdout | test/app.nuxt.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β β test/app.nuxt.spec.ts (1 test) 8ms
ββ Running...
/Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full:
βERR_PNPM_RECURSIVE_RUN_FIRST_FAILβ example-app-vitest-full@ test: `pnpm test:happy-dom && pnpm test:jsdom && pnpm test:dev && pnpm test:types`
Exit status 1
examples/content test$ vitest run
ββ Running...
βELIFECYCLEβ Command failed with exit code 1.
Revert "debug: Comment out supporting options api in renderSuspended"
-> Test succeeds π
$ pnpm prepack && pnpm test:examples
βWARNβ Unsupported engine: wanted: {"node":">=18.20.4"} (current: {"node":"v18.19.0","pnpm":"9.11.0"})
> @nuxt/test-utils@3.14.2 prepack /Users/inouetakuya/src/github.com/inouetakuya/test-utils
> unbuild
βΉ Building test-utils 10:04:02
βΉ Cleaning dist directory: ./dist 10:04:02
β Build succeeded for test-utils 10:04:07
[3 lines collapsed]
[10 lines collapsed]pendencies because vite config has changed
β [nitro] β Nuxt Nitro server built in 1773 ms
β βΉ Vite client warmed up in 1ms
β [nuxi] βΉ Dev server event: type="nuxt:internal:dev:ready" port=51194
β βΉ Vite server warmed up in 676ms
β PASS test/dev.e2e.spec.ts (23.224 s)
β Test Suites: 3 passed, 3 total
β Tests: 6 passed, 6 total
ββ Done in 25s 2 passed, 2 total
β Time: 23.555 s
β Ran all test suites.
examples/app-playwright test$ playwright test
[165 lines collapsed]
β ββ .nuxt/test/ns92by/output/server/package.json (600 B) (299 B gzip)
[Desktop Chrome] βΊ basic.test.ts:3:1 βΊ test
[Desktop Chrome] βΊ basic.test.ts:17:1 βΊ testing
2 passed (14.8s)
β To open last HTML report run:
β pnpm exec playwright show-report
ββ Done in 15.2s
examples/app-vitest test$ vitest run
[5 lines collapsed]
β Listening on http://127.0.0.1:51205
β β test/server.e2e.spec.ts (1 test) 13536ms
β β test/browser.e2e.spec.ts (1 test) 14582ms
β Listening on http://127.0.0.1:51217
β β test/generate.e2e.spec.ts (1 test) 15428ms
β β test/dev.e2e.spec.ts (1 test) 18003ms
β Test Files 5 passed (5)form 2.03s, setup 41.96s, collect 4.27s, tests 932ms, environment 7.49s, prepare 8.74s)
β Tests 5 passed (5)@ test:jsdom /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full
β Start at 10:04:11
β Duration 19.37s (transform 778ms, setup 2.01s, collect 2.15s, tests 61.56s, environment 272ms, prepare 982ms)-full
ββ Done in 22.7s
examples/app-vitest-full test$ pnpm test:happy-dom && pnpm test:jsdom && pnpm test:dev && pnpm test:types
[65 lines collapsed]
β Test Files 21 passed (21)
[441 lines collapsed]sed | 1 todo (65)
β [nuxt] Your project has pages but the <NuxtPage /> component has not been used. You might be using the <RouterView /> component instead,β¦
β β tests/nuxt/plugins.spec.ts (1 test) 5ms
β Test Files 20 passed (20)
β Tests 63 passed | 1 todo (64)
β Start at 10:04:40
β Duration 6.60s (transform 1.22s, setup 33.35s, collect 1.39s, tests 499ms, environment 4.06s, prepare 6.40s)
β > example-app-vitest-full@ test:types /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-vitest-full
β > nuxi prepare && vue-tsc --noEmit
β From custom module!
β β Types generated in .nuxt
ββ Done in 43.7sUsers/inouetakuya/src/github.com/inouetakuya/test-utils/examples/content
β stdout | tests/index.spec.ts
β <Suspense> is an experimental feature and its API will likely change./examples/app-vitest
β β tests/index.spec.ts (1 test) 24ms
β Test Files 1 passed (1)ntal feature and its API will likely change.
β Tests 1 passed (1) (1 test) 8ms
β Start at 10:04:29
β Duration 2.98s (transform 1.21s, setup 1.54s, collect 343ms, tests 24ms, environment 140ms, prepare 420ms)
ββ Done in 8.7s
examples/i18n test$ vitest runnpm test:unit --run
ββ Running...
examples/module test$ vitest run
β RUN v2.1.2 /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/i18n
β stdout | test/index.spec.ts
β <Suspense> is an experimental feature and its API will likely change.
β β test/index.spec.ts (1 test) 14ms
β Test Files 1 passed (1)
β Tests 1 passed (1)
β Start at 10:04:34
β Duration 1.17s (transform 442ms, setup 440ms, collect 84ms, tests 14ms, environment 129ms, prepare 317ms)
ββ Done in 4.7s
examples/module test$ vitest run
[2 lines collapsed]
β Plugin injected by my-module!
β Listening on http://127.0.0.1:51279
β Plugin injected by my-module!
β Listening on http://127.0.0.1:51285
β Plugin injected by my-module!
β β test/basic.test.ts (2 tests) 6250ms
β Test Files 1 passed (1)
β Tests 2 passed (2)
β Start at 10:04:32
β Duration 6.73s (transform 70ms, setup 0ms, collect 266ms, tests 6.25s, environment 0ms, prepare 51ms)
ββ Done in 7.1s
. | βWARNβ Unsupported engine: wanted: {"node":">=18.20.4"} (current: {"node":"v18.19.0","pnpm":"9.11.0"})
> example-app-cucumber@ test /Users/inouetakuya/src/github.com/inouetakuya/test-utils/examples/app-cucumber
> NODE_OPTIONS='--loader ts-node/esm' NODE_ENV=test cucumber-js
(node:6830) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6861) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
Listening on http://127.0.0.1:51371
1 scenario (1 passed)
1 step (1 passed)
0m06.571s (executing steps: 0m00.676s)
@danielroe
Thank you for your review!
https://github.com/nuxt/test-utils/pull/963#pullrequestreview-2346367843
do we need to apply the same fixes to renderSuspended?
Yes, we need.
I added test for renderSuspended.
@danielroe
I actually use this library for work. So I'd like to ask, when do you think the version that merges this pull request will be released? π π π
released! β
Thank you so much!! π
π Linked issue
fixes #961
β Type of change
π Description
As described in #961, mountSuspended did not support the Options API data, computed, and methods, so we have fixed this to support them.