21 ms·
I love Node's built-in testing and how it integrates with VSCode's test runner. But I still miss Jest matchers. The Vitest team ported Jest matchers for their o
by serguzest 1y ago
I love Node's built-in testing and how it integrates with VSCode's test runner. But I still miss Jest matchers. The Vitest team ported Jest matchers for their own use. I wish there were a similar compatibility between Jest matchers and Node testing as well.
- tkzed49 1y agoassertions in node test feel very "technically correct but kind of ugly" compared to jest, but I'll use it anyway
- serguzest 1y agoyes but consider this Jest code, replicating such in node testing is painful. testing code should be DSL-like, should be very easy to read. expect(bar).toEqual( expect.objectContaining({ symbol: `BTC`, interval: `hour`, timestamp: expect.any(Number), o: expect.any(Number), h: expect.any(Number), l: expect.any(Number), c: expect.any(Number), v: expect.any(Number) }) );
- vinnymac 1y agoCurrently for very small projects I use the built in NodeJS test tooling. But for larger and more complex projects, I tend to use Vitest these days. At 40MBs down, and most of the dependency weight falling to Vite (33MBs and something I likely already have installed directly), it's not too heavy of a dependency.
- serguzest 1y agoIt is based on vite and a bundler has no place in my backend. Vite is based on roll-up, roll-up uses some other things such as swc. I want to use typescript projects and npm workspaces which vite doesn't seem to care about.