Switching to vitest with an existing Vue 3 project - trying to iron out issues with existing test suites #1519
lewishowles
started this conversation in
General
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I will try jsdom again in there, hopefully that will solve that one. Hmm I thought it might need the output changing. I'll have to have a play in the library to see how I can change its output and, if so, if that affects any other projects. The library also uses rollup to build but it just kind of takes the wheel and outputs a mishmash of files. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to switch an existing project to vitest, and it looks really cool, and so much faster than Jest.
Hopefully the issues I'm having are just incorrect config, or lack of knowledge.
I've moved the project over to Vite, which seemed relatively painless, and it's up and running - and as far as I can see there are no problems there. The issue I'm having is when it comes to unit testing. Having been flat unable to get Jest running at all with Vite, despite it running fine previously, I'd given up and wanted to try vitest.
I'm having a few teething troubles in getting any existing suite to run.
import { deepCopy } from '@libraries/ui-helpers/object';
The error I'm getting is
Directory import '/path/to/node_modules/@libraries/ui-helpers/object' is not supported resolving ES modules imported from /path/to/node_modules/@libraries/ui-testing/unit.js
I can't really change how those libraries are generated, and they're imported in all sorts of places and projects, so that seems out of the question.
That helper library is Typescript, where this project isn't really using Typescript (though I think Vue 3 is set up for it by default anyway), so I'm not sure if that could have anything to do with it. The path it's trying to import from does have an
index.d.ts
file.window
is undefined - some of our helpers use window, and whilewindow
seems to be available inside test files, it doesn't seem to be available in external files used in the project.My
vite.config.js
is pretty simple:though I've also tried
environment: 'jsdom'
with jsdom installed.Beta Was this translation helpful? Give feedback.
All reactions