Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Crash on computed using the object syntax in mountSuspended #1341

@Thomaash

Description

@Thomaash

Environment

  • Operating System: Linux
  • Node Version: v22.17.0
  • Nuxt Version: 3.17.5
  • CLI Version: 3.25.1
  • Nitro Version: 2.11.12
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-mjrv4wo3?file=test%2Fapp.nuxt.spec.ts

Describe the bug

When mounting a component with a computed property defined as { computed: { foo: { get: () => "bar" } } }, mountSuspended crashes with TypeError: computed[key].call is not a function.

Additional context

No response

Logs

~/projects/yqnipbpbmn.github 27s
❯ npm t

> test
> vitest run

(node:151) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 DEPRECATED  The `test.workspace` option is deprecated and will be removed in the next major. To hide this warning, rename `test.workspace` option to `test.projects`.

 RUN  v3.2.4 /home/projects/yqnipbpbmn.github

stderr | test/app.nuxt.spec.ts > should not crash on object computed
[Vue warn]: Unhandled error during execution of render function 
  at <MountSuspendedComponent > 
  at <MountSuspendedHelper> 
  at <Anonymous ref="VTU_COMPONENT" > 
  at <VTUROOT>

 ❯  nuxt  test/app.nuxt.spec.ts (1 test | 1 failed) 5030ms
   × should not crash on object computed 5029ms
     → 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".

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL   nuxt  test/app.nuxt.spec.ts > should not crash on object computed
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".
 ❯ null.<anonymous> test/app.nuxt.spec.ts:6:1
      4| import Component from '../components/MyComponent.vue';
      5| 
      6| it('should not crash on object computed', async () => {
       | ^
      7|   const component = await mountSuspended(Component);
      8|   expect(console.error).not.toHaveBeenCalled();

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ 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.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: computed[key].call is not a function
 ❯ setup/clonedComponent.render< file:/home/projects/yqnipbpbmn.github/node_modules/@nuxt/test-utils/dist/runtime-utils/index.mjs#cjs:187:62
 ❯ renderComponentRoot file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:6500:16
 ❯ componentUpdateFn file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:5291:46
 ❯ run file:/home/projects/yqnipbpbmn.github/node_modules/@vue/reactivity/dist/reactivity.cjs.js#cjs:241:19
 ❯ setupRenderEffect file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:5426:5
 ❯ mountComponent file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:5200:24
 ❯ processComponent file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:5153:23
 ❯ patch file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:4680:27
 ❯ componentUpdateFn file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:5298:16
 ❯ run file:/home/projects/yqnipbpbmn.github/node_modules/@vue/reactivity/dist/reactivity.cjs.js#cjs:241:19
 ❯ setupRenderEffect file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:5426:5
 ❯ registerDep/< file:/home/projects/yqnipbpbmn.github/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js#cjs:7199:26

This error originated in "test/app.nuxt.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
The latest test that might've caused the error is "should not crash on object computed". It might mean one of the following:
- 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 (1)
      Tests  1 failed (1)
     Errors  1 error
   Start at  09:23:23
   Duration  13.66s (transform 983ms, setup 1.16s, collect 808ms, tests 5.03s, environment 1.82s, prepare 1.85s)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions