Replies: 3 comments 3 replies
-
|
Addition to the confusion: From where are paths resolved? Is it from the package directory where there is a I have the feeling I am in a package, but it is driven from repo root (even when that particular package isn't part of root projects) 🤔😵 |
Beta Was this translation helpful? Give feedback.
-
They are all isolated processes. vscode specifically manually disables the UI so it's never annoyingly opened when you open vscode.
It is unfortunate, but vscode doesn't allow anything except text in test items. |
Beta Was this translation helpful? Give feedback.
-
|
@sheremet-va For teams using build systems (Lage, Nx, Turborepo, etc), tests are often expected to be run from the packages themselves, not the workspace. To confirm, are both of these structures now supported by the VS Code extension? And a combination of both is not supported? If so, it might be worth updating the examples and README to show the different configurations, and explain when you might use each? I'd be happy to pick up that task too! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Heyo,
I'm a happy vitest user, but also I'm confused by how to properly set this up on a heterogeneous monorepo.
Given
Goal
I also think, vitest might not provide yet everything I need for that (that's ok, incremental adoption is fine).
What I learned
Some configs options are only available globally, eg. coverage
In a package, that has both sorts of tests, I'm doing this at the moment:
that is ok, to run the tests from within that package, but that file seems to be ignored from root config (even if directly pointed at it, I guess due to project-ception, since this is invalid).
Using this from the global root config works though:
packages/both/vitest.config.{node,browser}.tsPointing to browser tests like above, the execution fails from repo root. It works from within the package
VScode extension fails the same way as the CLI, when browser and node tests are mixed (seems like a UI to the CLI here, would make totally sense)
VScode extension lists the tests based on the folder structure... unless you give them a
name(as what seems needed for the hybrid packages). The listing then looks weird (I guess you could give all projects a name then).Vitest UI is giving the better visuals and gives vibrant color badges
Vitest UI run from root also fails on the browser tests (same as CLI and vscode above)
Guidance
There is docs for sure to explain individual fields or explain the syntax for configuring the projects, that's great. The problem I'm running into is some sort of reverse engineering how these configs work, when applied.
What I'm looking for is some guidance how to configure these sort of projects, in form of examples or best practices.
What is also sometimes find confusing is, what process is doing what. Eg. you can start vitest in your terminal ... but also in VScode? Do they share the same process? Can I start the same in vscode but open the vitest UI in the browser? I regularly find myself in the wrong spot 🙈
Hope some docs can bring relief here. Wanna bring it up for discussion at first. Maybe my goals are contrary to the design for vitest?
Later issues can be derieved.
Beta Was this translation helpful? Give feedback.
All reactions