MaveriX89
Vite 5.2.x / Vitest 1.5.x: How to Resolve Multiple Instances of Solid
I am nearing my wits end trying to resolve these error messages I receive when trying to run my SolidJS tests with
@solidjs/testing-library
and vitest
I do not know what else to try and need assistance if anyone can help. I have the following vite.config.ts
In my package.json
these are the dependencies I have:
6 replies
How to handle necessary async/await work inside of a createEffect?
I'm building a SolidJS hook library and I have some asynchronous work that needs to happen which is occurring in a
createEffect
. I'm currently trying to write integration tests against my hook library and running into problems because I'm currently not awaiting the Promise result which is conflicting with other things occurirng in test. The way I work around it for testing purposes is literally doing an await sleep(1000)
in test to wait for that asynchronous work to finish.
Is there a better way to write my createEffect
in such a way where I do not have to do a sleep
in test?
8 replies
Getting ReferenceError: React is not defined with Vitest + Solid Testing Library
I honestly have no idea how I am receiving this error but I am despite testing using
@solidjs/testing-library
. Moreover, I am using Vitest
by itself (not Vite
) and my vitest.config.ts
is as follows:
The test that is causing the error to appear is a custom Solid hook test where I am attempting to pass a wrapper
to my renderHook
invocation.
Anybody seen that before?26 replies
Creating custom SolidJS hook that can be used in a global scope
Need some help understanding how to build a custom SolidJS hook that can be used both locally inside a component and outside in the global scope (like
createSignal
can).
Below is. a small snippet of a custom hook I am writing:
The question I have is around the floating createMemo
that I use in the implementation. When I use the createDatabase
hook globally, I get greeted with the console warning:
computations created outside a 'createRoot' or 'render' will never be disposed
I'm not familiar with how to properly address that warning and hoping the community can offer some guidance here.17 replies
Need clarity on eslint(solid/reactivity) warning use-case
I need help understanding how to deal with this ESLint warning when I am building a custom SolidJS hook library that doesn't have any visual components.
There is a portion of my custom hook code that gets called out by this warning and I don't know how I should properly resolve it (or if it is safe to ignore it).
The code snippet where I receive the warning is the following:
What is the proper way to address the warning in this case? Or is this something I can safely ignore perhaps?
5 replies