A lightweight utility for testing Vue 3 composables outside of a full component context. v0.2.0 enables developers to invoke composables with `renderComposable`, inspect reactive state via the `result` object, and handle lifecycle hooks like `onUnmounted` by manually unmounting the underlying component. Supports Vue plugins (e.g., Pinia) and provider/inject patterns via a custom wrapper. Ships TypeScript types. Alternative to mounting a full SFC or using `@vue/test-utils` composable test helpers, with a simpler API focused on composable logic.
npm install vue-composable-testingNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to test a simple composable (useCounter) with renderComposable, assert reactive state, and trigger unmount lifecycle.
Access reactive state via `.value` on refs/properties returned by the composable, e.g. `result.count.value`.
Call the `unmount` function returned from `renderComposable` at the end of a test to trigger cleanup lifecycle hooks.
Always return `() => slots.default?.()` from the wrapper component's setup function.
Add `import { ref } from 'vue'` at the top of your composable module.Use ESModule import: `import { renderComposable } from 'vue-composable-testing'`.Ensure the `provide` call in the wrapper happens before `slots.default?.()` and that the composable is invoked inside the `renderComposable` callback.
No dependency data recorded yet.