core icon indicating copy to clipboard operation
core copied to clipboard

Use vitest or similar for tests

Open anbraten opened this issue 5 months ago • 2 comments

While trying to add a test for #252 I've found it pretty difficult to work with the current (a bit custom) test setup. Especially using different environments (node vs browser) and testing by importing typescript files could simplify the setup IMO. Would you be interested in migrating to something like it?

anbraten avatar Aug 08 '25 14:08 anbraten

https://www.npmjs.com/package/web-worker seems to be an option to test web-workers as common envs like jsdom and happy-dom do not support web-workers yet. However its kinda testing the mock as web-worker is just using the node worker underneath again.

anbraten avatar Aug 08 '25 15:08 anbraten

Hey @anbraten, thanks for suggesting this.

They current testing setup is based on the somewhat specific needs of ZenFS (e.g. testing multiple configurations with the same suites). Additionally, the built-in node:test runner is used to avoid the need for more dependencies.

While I do want to run tests in browsers, I don't think vitest would be the best fit— in a different project I had to fight with the configuration for hours to fix it bundling things it shouldn't have.

Ideally, there would be a way to (easily) add testing in browsers to the existing testing framework.

james-pre avatar Aug 08 '25 15:08 james-pre