Open busticated opened 10 months ago
There was a breaking change in version 6.0 that removed the extend-expect
entry point in favor of a default entry point and some platform specific ones.
ah, thanks 🙏
i took a quick run at updating the template but ultimately hit weirdness when trying to update vitest
to v0.34.x
. testing lib queries seem broken:
TestingLibraryElementError: Unable to find an element with the text: /test new todo/.
...
TestingLibraryElementError: Unable to find role="checkbox"
...and new (old) warnings are shown:
You appear to have multiple instances of Solid. This can lead to unexpected behavior.
computations created outside a `createRoot` or `render` will never be disposed
```
> vite-template-solid@0.0.0 test
> vitest
DEV v0.34.6 /Users/me/code/bust/templates/js-vitest
stderr | unknown test
You appear to have multiple instances of Solid. This can lead to unexpected behavior.
stderr | src/todo-list.test.jsx >
here's the working patch i'm running atm:
diff --git a/js-vitest/package.json b/js-vitest/package.json
index 579774e..b268ca7 100644
--- a/js-vitest/package.json
+++ b/js-vitest/package.json
@@ -12,15 +12,15 @@
},
"license": "MIT",
"devDependencies": {
- "@solidjs/testing-library": "^0.7.1",
- "@testing-library/jest-dom": "^5.16.5",
- "jsdom": "^22.1.0",
+ "@solidjs/testing-library": "^0.8.4",
+ "@testing-library/jest-dom": "^6.1.4",
+ "jsdom": "^23.0.0",
"solid-devtools": "^0.27.3",
"vite": "^4.3.9",
"vite-plugin-solid": "^2.7.0",
- "vitest": "^0.32.2"
+ "vitest": "^0.33.0"
},
"dependencies": {
- "solid-js": "^1.7.6"
+ "solid-js": "^1.8.5"
}
}
diff --git a/js-vitest/vite.config.js b/js-vitest/vite.config.js
index 034b1ba..91654b2 100644
--- a/js-vitest/vite.config.js
+++ b/js-vitest/vite.config.js
@@ -9,9 +9,7 @@ export default defineConfig({
transformMode: {
web: [/\.jsx?$/],
},
- setupFiles: ['node_modules/@testing-library/jest-dom/extend-expect.js'],
- // otherwise, solid would be loaded twice:
- deps: { registerNodeLoader: true },
+ setupFiles: './vitest-setup.js',
// if you have few tests, try commenting one
// or both out to improve performance:
// threads: false,
diff --git a/js-vitest/vitest-setup.js b/js-vitest/vitest-setup.js
new file mode 100644
index 0000000..8339619
--- /dev/null
+++ b/js-vitest/vitest-setup.js
@@ -0,0 +1,7 @@
+import '@testing-library/jest-dom/vitest';
+import { cleanup } from '@solidjs/testing-library';
+import { afterEach } from 'vitest';
+
+
+afterEach(() => cleanup());
+
fwiw, i also tried the fixes suggested by @solidjs/testing-library
but those didn't help.
i'll poke around a bit over in https://github.com/vitest-dev/vitest to see if i can spot the problematic change 👍
hi again :wave:
on macOS
v14.1 (23B74)
withnode@18.18.2
andnpm@9.8.1
using thevite.config.js
file shown here, i'm seeing an error when i runvitest
:i believe i have the module in question installed:
looking at the files in the package, i see:
note that
extend-expect.js
is not there. seems the@testing-library/jest-dom
package moved some files around since the template was last updated.