Skip to content

Commit

Permalink
style: lint and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed May 30, 2023
1 parent 4b2e824 commit cd4dbf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/vitest-environment-nuxt/runtime/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ export async function mountSuspended<
// Proxy top-level setup/render context so test wrapper resolves child component
const clonedComponent = {
...component,
render: render ? (_ctx: any, ...args: any[]) => render(renderContext, ...args) : undefined,
setup: setup ? (props: Record<string, any>, ctx: Record<string, any>) => setup(props, setupContext) : undefined
render: render
? (_ctx: any, ...args: any[]) =>
render(renderContext, ...args)
: undefined,
setup: setup
? (props: Record<string, any>) =>
setup(props, setupContext)
: undefined,
}

return () => h(clonedComponent, { ...props, ...attrs }, slots)
return () =>
h(clonedComponent, { ...props, ...attrs }, slots)
},
}),
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/nuxt-vitest/tests/nuxt/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { mountSuspended, registerEndpoint } from 'vitest-environment-nuxt/utils'
import App from '~/app.vue'
import FetchComponent from '~/components/FetchComponent.vue'
import OptionsComponent from '~/components/OptionsComponent.vue'
import { WrapperTests } from '#components'
import WrapperTests from '~/components/WrapperTests.vue'

describe('client-side nuxt features', () => {
it('can use core nuxt composables within test file', () => {
Expand Down

0 comments on commit cd4dbf9

Please sign in to comment.