Open blcham opened 4 months ago
@shellyear do not try to solve the issue just describe some insides/intuition about the error, e.g.:
@blcham With jest it was configured, so that ".css" files were mocked https://github.com/kbss-cvut/record-manager-ui/blob/be13081c4558cecdac9adc7cfd24b18ebd57b9af/jest.config.js in tests/**/styleMock.
Vitest can process and resolve .css files only with vmThreads and vmForks pools configured %, but using those pools comes with a lot of issues. By inlining @kbss-cvut/s-forms we make sure, that Vitest (esbuild) will not try to resolve files from @kbss-cvut/s-forms using imports, but will directly inline them into the source code during compiling.
https://vitest.dev/config/#server-deps-inline Vite will process inlined modules. This could be helpful to handle packages that ship .js in ESM format (that Node can't handle). So the root problem is likely to be related to the @triply/yasgui package, and how is ships it's modules.
Also skipped tests rely on css classes (e.g Dashboard.spec.jsx), so I think including resolving .css files is necessary, if we need to include those skipped tests in the future.
When testing record-manager-ui using vitest, SForms library was causing issues. Thus we had to configure it in
vite.config.js
as follows: