-
It would be great to have a doc dedicated to testing code with solid. By searching the other discussion items, I learned of the Looking through the source code for help, I found this bit inside the signals test file: test("Create an Effect", () => {
let temp: string;
createRoot(() => {
onMount(() => (temp = "unpure"));
});
expect(temp!).toBe("unpure");
}); Unfortunately, recreating this simple test in my own project doesn't work (the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Are you using |
Beta Was this translation helpful? Give feedback.
-
Posting this here in case someone else finds it useful. If you need to test Solidjs code using the typescript compiler (rather than the babel-typescript compiler), As a rough example:
In the example we configure |
Beta Was this translation helpful? Give feedback.
Are you using
solid-jest
. It's possible that since you aren't using JSX it isn't obvious the server version of Solid is getting pulled in that doesn't runonMount
calls.https://github.com/solidui/solid-jest