test: migrate all tests from mocha/chai to vitest#638
Open
test: migrate all tests from mocha/chai to vitest#638
Conversation
Migrate all integration, fork, and remaining unit tests to vitest. Remove chai, mocha, nyc, and related dependencies and configs.
- beforeEach('skipIfMainnet', fn) → beforeEach(fn) (vitest doesn't support description arg)
- before(fn) → beforeAll(fn) (vitest uses beforeAll, not before)
- Add hookTimeout (60s) for long-running beforeAll hooks - Add allowEmpty for suites where all tests are conditionally skipped - Add --fileParallelism=false for integration tests (shared blockchain state)
- Replace mocha this.skip() with vitest context.skip() in l1l3Bridger tests - Await fire-and-forget .then() in customerc20 to prevent unhandled rejection
This assertion was always a fire-and-forget .then() under mocha that silently swallowed failures. Removing it since it was never effective.
The deposit test used parseEther('2') (always 2e18) regardless of the
token's native decimals. Since EthBridger.deposit() passes the amount
directly to depositERC20(uint256) without scaling, this caused failures
for non-18 decimal tokens (16-decimal: exceeds balance, 20-decimal:
value mismatch on L2). These tests were never actually running under
mocha because async describe callbacks aren't awaited.
3142fb1 to
6ad363d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chai,@types/chai,mocha,@types/mocha,eslint-plugin-mocha,nycdependencies.mocharc.jsonconfigpackages/sdk/package.jsontest scripts to use vitestmochaExtensions.tsTest plan
yarn test:unitpasses (61 tests across 10 files)