While possible to build and run unit tests, it is tedious and error-prone. It would be good to have a command like componentize-go test run --build to make it simpler. An example of the guts of this can be found in opentelemetry-wasi:
GOOS=wasip1 GOARCH=wasm go test -ldflags=-checklinkname=0 -c -o test.wasm ./example \
&& wasmtime run test.wasm