Skip to content

quasar ext add @quasar/testing-unit-vitest fails to recognize imports from @quasar/app-vite v2's '#q-app/wrappers' #394

@air-dex

Description

@air-dex

Reproduction

  1. Sources migration

I've got a @quasar/app-vite v1's project that I have migrated to @quasar/app-vite v2 (v2.0.9). I followed Quasar Framework's migration guide: https://quasar.dev/quasar-cli-vite/upgrade-guide

I have followed the part with quasar/wrappers, especially fot boot files:

We have deprecated all the imports coming from quasar/wrappers. You can still use them, but we highly recommend switching to the new #q-app/wrappers, as shown below:

Hence my import { boot } from 'quasar/wrappers' have become import { defineBoot } from '#q-app/wrappers'

  1. Tests migration

This project uses Vitest 2 for its unit testing. I have migrating tests using @quasar/testing-unit-vitest.

I have followed the evolutions you mention there: https://testing.quasar.dev/packages/unit-vitest/

I have encountered the #393 issue, that I have solved with the workaround I mentionned in it.

Expectations

Tests involving components should pass

Reality

Corresponding tests failed with the following error message: TypeError: defineBoot is not a function

Notes

  1. Sorry for the lack of details but I cannot give you more of them.

  2. Here is a workaround for it that works:

Replacing all the imports from '#q-app/wrappers' by imports from '@quasar/app-vite/wrappers'.

Example with boot files:

import { defineBoot } from '#q-app/wrappers' // KO
import { defineBoot } from '@quasar/app-vite/wrappers' // OK

Recommended Quasar's '#q-app/wrappers' should work, shouldn't they?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions