You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to set up Jest for testing, replacing mocha+chai+nyc. The process was pretty straightforward:
Uninstall Mocha + Chai + nyc.
Install Jest + ts-jest.
Consolidate mocha.opts + .nycrc into jest.config.js and jest.setup.js.
Add env.jest = true to .erclintrc.js.
Update test files to use Jest matchers instead of Chai matchers/assertions.
Then there was one gotcha when using Jest with Bitbox:
Bitbox relies on Buffer instanceof Uint8Array which is expected behaviour. But this breaks with Jest (Jest breaks Buffer instanceof Uint8Array jestjs/jest#4422). The IPFS guys created a custom environment that fixes this (jest-environment-aegir). This code is outdated though, so I updated the code and added it to my own project (jest/custom-environment.js). If you're using Jest with any project that depends on Bitbox, this is a must.
And some optional extra steps I took:
I added extra reporters for cleaner test output.
To make better use of Jest's concurrency I split up some test files into multiple files.
After the call last week I decided to see if I could get Jest up and running.
The text was updated successfully, but these errors were encountered: