Closed r9mp closed 2 years ago
Can you provide a reproduction repo/link?
Hi,
I solved my problem trying to reproduce.
The problem was in the imports:
import { CommonFormBase } from '~/components/common/form/types';
should be import { CommonFormBase } from './types';
The ~ alias was not recognized.
If you want to recognize it, you have to update vitest config, adding:
import path from "path";
export default defineConfig({
resolve: {
alias: {
"~": path.resolve(__dirname, "."),
},
},
});
I still have one trouble, which is when calling the setup function of the @nuxt/test-utils-edge dependency. The error message is: "Sourcemap is likely to be incorrect: a plugin (vite-plugin-vue-type-imports) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help".
You can find a repo to reproduce it here: https://github.com/r9mp/vitest-nuxt
The problem only occurs on the file test/nuxt.spec.ts and when the setup function is called.
As it is another problem, I can recreate an issue if you prefer ; or if you think that it's more a problem from @nuxt/test-utils-edge, I can also create an issue there.
R
I still have one trouble, which is when calling the setup function of the @nuxt/test-utils-edge dependency. The error message is: "Sourcemap is likely to be incorrect: a plugin (vite-plugin-vue-type-imports) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help".
Yes, it's related to the plugin. It doesn't generate sourcemaps ATM. You can create a separate issue.
Hi everyone!
I have been using your plugin on a Nuxt 3 app to share interfaces through components for few months now... Thanks for the great work :)
I'm currently trying to add some tests to the app with vitest, but I get the classical error: "type argument passed to defineProps() must be a literal type, or a reference to an interface or literal type.". As if vite-plugin-vue-type-imports was not applied.
Here is my component:
And I added VueTypeImports as this in my
vitest.config.ts
file (as the doc shows it for a classical Vite / Vue app):The full stack of the error is the following:
Did I imported it in a wrong way?