A local-first note taking app
textile TESTING.md
873 B
Markdown
at main

Testing #

All tests run via Vitest: npm test / vitest run.

Vitest config note — @automerge/automerge #

Automerge ships two entry points: a Node.js entry (fullfat_node.js, loads WASM from disk) and a browser entry (fullfat_base64.js, embeds ~3.5MB of WASM as a base64 string). Vite picks the browser entry by default, which exhausts the V8 heap when parsed.

The config in vitest.config.ts fixes this with two settings:

  • server.deps.external: [/@automerge/] — tells Vite to skip transforming the package and let Node.js resolve it natively
  • forks.execArgv: ['--conditions=node'] — tells the forked worker processes to prefer the node export condition, so Node.js picks fullfat_node.js

These settings are only needed because Automerge uses WASM. Other packages that bundle browser-only polyfills for Node.js APIs may need similar treatment.