Closed bhvngt closed 2 years ago
I believe that this issue is the same as https://github.com/wallabyjs/public/issues/3049.
It appears that you are attempt to run vitest
from your project root with Wallaby and there is no vite
configuration within your project root so the default configuration is being used.
Right now, vitest
does not support running as a mono-repo and so Wallaby also does not support running vitest from a mono-repo project root.
After fixing your dependencies in lib/foo
, we were able to start Wallaby on this directory and the aliases worked for us.
@smcenlly Thanks for your reply.
I believe that this issue is the same as https://github.com/wallabyjs/public/issues/3049.
I agree.
It appears that you are attempt to run
vitest
from your project root with Wallaby and there is novite
configuration within your project root so the default configuration is being used.
It was the other way round. In command-line mode, I was running vitest from my module directory libs/foo
which worked fine. When I ran it from project root on the command line, my tests failed with the same error. I believe, wallaby too runs from project root.
Right now,
vitest
does not support running as a mono-repo and so Wallaby also does not support running vitest from a mono-repo project root.
As per the vitest thread, currently, they recommend pnpm's recursion (-r) flag for monorepo. Is something similar can be used with wallaby? Alternatively, I currently organise my projects as intellij modules. Is it possible to run wallabyjs instance per module?
After fixing your dependencies in
lib/foo
, we were able to start Wallaby on this directory and the aliases worked for us.
I could make it work at the root level by adding my monorepo workspace projects at root level package.json
and configuring vitest.config.js
at the root level. However, it felt little hackish. So not sure if I would like to take a similar approach in a real project.
With Wallaby's Automatic Configuration, you can specify the root path
to run your tests from in your Run Configuration. This would allow you to run the tests in lib/foo
the same as when you use the CLI.
When you use pnpm's recursive flag, it runs multiple commands at the same time (e.g. npm run test
for each project).
Unfortunately Wallaby needs to run all of your project tests as a single unit of work so that it can correctly provide code coverage, etc. This is why we need vitest
to support mono-repos natively to run in a mono-repo root.
If you make the root level work by adding and configuring vitest in your mono-repo root, then Wallaby should definitely work for you. If you choose not to take this approach then you will be limited to being able to run a single package at a time.
Thanks @smcenlly. That was very helpful and does make sense. I will tinker with my root folder configuration to see if I can make that workable.
@smcenlly quick question, if I migrate to jest, can wallaby run simultaneously on a monorepo managed with pnpm?
@kaminskypavel Jest has the projects
setting, that allows to run all monorepo tests regardless of the used package manager.
Issue description or question
I am trying to setup wallabyjs with a new project that is using pnpm workspace and vitest.
I am trying to self-reference my project using vite aliases. While running
vitest
fromcli
, it picks up aliases. However, wallabyjs is not able to resolve them.I had to either add my project module
"@libs/foo": "workspace:*"
as dependency within "./libs/foo/package.json" or add it at root levelpackage.json
Here's the repo where you can reproduce this issue.
Wallaby diagnostics report