S
SolidJS15mo ago
Mirardes

Issue wih testing (Solid-jest)

Hello, I'm currently working on a Solid Start library. I'm currently using tsdx to package my app and jest to test my application. Currently, I have an error when I execute tests !
GitHub
GitHub - jaredpalmer/tsdx: Zero-config CLI for TypeScript package d...
Zero-config CLI for TypeScript package development - GitHub - jaredpalmer/tsdx: Zero-config CLI for TypeScript package development
8 Replies
Mirardes
MirardesOP15mo ago
Errors log :
Mirardes
MirardesOP15mo ago
GitHub
GitHub - qlaffont/solidstart-protected-auth
Contribute to qlaffont/solidstart-protected-auth development by creating an account on GitHub.
lxsmnsyc
lxsmnsyc15mo ago
Hi, I would recommend tsup as a library scaffolding tool against tsdx for two reasons: - tsdx is already an abandoned tool - tsdx doesn't understand Solid https://github.com/solidjs-community/tsup-preset-solid
GitHub
GitHub - solidjs-community/tsup-preset-solid: Preset for building y...
Preset for building your SolidJS packages with tsup. - GitHub - solidjs-community/tsup-preset-solid: Preset for building your SolidJS packages with tsup.
lxsmnsyc
lxsmnsyc15mo ago
for testing, I would recommend using Vitest but I'm not enforcing you to do so
Mirardes
MirardesOP15mo ago
thanks i will try to use tsup ^^ Okay migration to tsup is working but you are speaking about vitest but i see on official documentation is only supported to uwu or jest @lxsmnsyc 🤖
lxsmnsyc
lxsmnsyc15mo ago
that's if we are talking about solid-jest. Otherwise, you can normally use the vite plugin, although it might be a bit of work for you hence why I'm not enforcing it 🙂 You can also reach out to #testing
Mirardes
MirardesOP15mo ago
Understand ! For your information about vitest, i have try it without success :
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

FAIL test/solidstart-protected-auth.test.tsx [ test/solidstart-protected-auth.test.tsx ]
ReferenceError: $ROUTE_LAYOUTS is not defined
❯ node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/solid-start/root/routeLayouts.tsx:2:20
1| // @ts-expect-error
2| var routeLayouts = $ROUTE_LAYOUTS;
| ^
3|
4| var layouts = routeLayouts as {
❯ node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/solid-start/root/assets.tsx:1:31
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

FAIL test/solidstart-protected-auth.test.tsx [ test/solidstart-protected-auth.test.tsx ]
ReferenceError: $ROUTE_LAYOUTS is not defined
❯ node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/solid-start/root/routeLayouts.tsx:2:20
1| // @ts-expect-error
2| var routeLayouts = $ROUTE_LAYOUTS;
| ^
3|
4| var layouts = routeLayouts as {
❯ node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/solid-start/root/assets.tsx:1:31
Alex Lohr
Alex Lohr15mo ago
It seems that the file system routing does not work in this setup. You will have to do this in the setup yourself, as jest is not directly supported by solid-start.
Want results from more Discord servers?
Add your server