vite-ssr icon indicating copy to clipboard operation
vite-ssr copied to clipboard

Add unit tests

Open m4rvr opened this issue 2 years ago • 3 comments

This PR adds some basic unit test setup with jest + esbuild-jest. Currently, only a few utils are tested. Also, the test script/command needs to be run manually.

m4rvr avatar Aug 04 '21 19:08 m4rvr

@MarvinRudolph Thanks! As mentioned on Twitter DMs, we are going to use uvu instead of Jest. The other PR was already merged so we should adapt this PR to the new structure.

@m3hari How should we handle unit tests like the ones in this PR? Also in test/specs or somewhere else? 🤔

frandiox avatar Aug 16 '21 18:08 frandiox

Apologies for the late reply, I think unit tests are better placed next to the file to be tested. uvu should find it with minor changes on the test command. Here is the docs for uvu test file matching

m3hari avatar Aug 23 '21 14:08 m3hari

@m3hari Thanks!

@MarvinRudolph Do you want to transform this to use uvu? For example, if you want to test utils/html.ts then the spec can be located next to it, in utils/html.unit.ts or utils/html.spec.ts.

frandiox avatar Aug 23 '21 15:08 frandiox