-
-
Couldn't load subscription status.
- Fork 8
Run frontend unit tests using vitest instead of jest #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a41541f
d8330c6
ddaf587
e85ebf4
39ea128
cde9be0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { defineConfig } from 'vitest/config'; | ||
| import voltoVitestConfig from '@plone/volto/vitest.config.mjs'; | ||
| import path from 'path'; | ||
|
|
||
| export default defineConfig({ | ||
| ...voltoVitestConfig, | ||
| resolve: { | ||
| alias: { | ||
| '@plone/volto': path.resolve(__dirname, '../../core/packages/volto/src'), // Add paths accordingly | ||
| // 'promise-file-reader': require.resolve('promise-file-reader') // Add to identify dependency from package | ||
| }, | ||
| }, | ||
| }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't the test configuration be in the root folder of the monorepo, as is done with Jest? This way it is not necessary to repeat the configuration when we have more than one package in the monorepo. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we have more than one package in the monorepo? Can't we run all the tests at once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wesleybl we are just replicating how the ecosystem works. If one package has tests, it should depend on vitest, hence, you have to be able to run it in the package itself. The monorepo is not a buildout. It's a way of tie together NodeJS packages.
You can still run them all at once with pnpm, that's why the --filter option exist.
pnpm --filter mypackage1 --filter mypackage2 exec vitestThe monorepo managers (as in turborepo, etc) also does this, they orchestrate commands through different packages who are meant to act independently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sneridagh But generally, in monorepos, it's common for the root test script to run tests for all packages. Shouldn't we expect this here? If not, and someone wants to have more than one package in the monorepo, they would have to "customize" the package.json created by cookieplone. It could be something like: