Had a really strange issue where my

Had a really strange issue where my tests could no longer run due to AssertionError: Expected Vitest to start running before importing modules
No description
14 Replies
MrBBot
MrBBot•9mo ago
This usally means you've got multiple versions of Vitest installed? Could you try run npm why vitest?
Jacob
JacobOP•9mo ago
Looking through the diffs, I found out that this @types/[email protected] thing got removed in my lockfile. Adding it back fixed it
No description
MrBBot
MrBBot•9mo ago
Ah yeah, we had the exact same problem in the workers-sdk monorepo.
Jacob
JacobOP•9mo ago
I have the exact same monorepo setup (pnpm + turborepo), so maybe that's why
Jacob
JacobOP•9mo ago
I ran pnpm -r update [email protected] and it removed this:
No description
Jacob
JacobOP•9mo ago
and left this one:
No description
Jacob
JacobOP•9mo ago
I guess the duplicate vitest entry started breaking things (no idea how that got there)
Jacob
JacobOP•9mo ago
All good now though! :party_blob:
No description
Jacob
JacobOP•9mo ago
LOVING the new vitest runtime @MrBBot :MeowHeartCloudflare: I have around 30 Workers in this monorepo that I'm adding tests to
MrBBot
MrBBot•9mo ago
Wohoo! 🎉
Jacob
JacobOP•9mo ago
(and you had perfect timing cause I'm building several new Workers internally that I started last week that I can use this for!)
Jacob
JacobOP•9mo ago
Progress!
No description
Jacob
JacobOP•9mo ago
One thing I noticed as I add vitest to more projects in my monorepo is that the first test takes a while to start
No description
Jacob
JacobOP•9mo ago
so I had to add --testTimeout=15000 to make sure it doesn't fail due to taking >5000ms for the first test to run (which is fine, just putting this here in case someone else runs into the same issue)
Want results from more Discord servers?
Add your server