Commit df090e0
committed
refactor(test): migrate e2e suites from mocha to vitest (7 packages)
Migrates e2e test suites in tron-sdk, starknet-sdk, cosmos-sdk,
rebalancer, aleo-sdk, svm-sdk, radix-sdk from mocha/chai to vitest.
Drops mocha-steps from the catalog entirely (zero consumers remain).
## Packages migrated
- tron-sdk: 1 integration test (TronWallet)
- starknet-sdk: 7 e2e tests + shell runner (env-var test selection
preserved)
- cosmos-sdk: 4 e2e tests + global setup (testcontainers-driven
cosmos localnet)
- rebalancer: 9 e2e tests + harness helpers (TestHelpers.ts,
ForkIndexer.test.ts). Unit config unchanged — separate
vitest.e2e.config.ts
- aleo-sdk: 7 e2e tests + global setup + warp-artifact-test-suite
helper
- svm-sdk: 10 e2e tests + global setup. Narrowed unit
vitest.config.ts include to exclude e2e files for defense in depth
- radix-sdk: 5 e2e tests + global setup
## Patterns applied
- Created vitest.e2e.config.ts per package with `globalSetup`,
`fileParallelism: false`, 300s timeouts
- Mocha `before()`/`after()` lifecycle hooks that started/stopped
containers → vitest `globalSetup` default-exported setup function
returning a teardown. Runs once before all e2e worker processes.
- `describe('X', function () { this.timeout(N); ... })` → arrow
functions; timeout sourced from config
- `.to.be.rejectedWith(msg)` → `.rejects.toThrow(msg)` where present
- Removed all `chai.use(chaiAsPromised)` + corresponding imports
- Dropped mocha/`@types/mocha`/mocha-steps/ts-node from affected
packages' devDeps
- Removed now-orphan chai/chai-as-promised/`@types/chai`/`@types/chai-as-promised`
from tron-sdk, svm-sdk, radix-sdk (no remaining imports)
## mocha-steps shim
2 files used mocha-steps' `step(name, fn)` (aleo-sdk's
6_hook_artifacts and svm-sdk's cross-collateral-token). `step()`
registers a test but skips remaining siblings on failure. Inlined
a 7-line shim per describe block that preserves this semantic via
a local `__stepFailed` flag + `ctx.skip()`. In aleo-sdk's case each
of 3 sibling describes gets its own shim so a failure in one group
doesn't skip later groups.
## Global setup + worker process boundary
Vitest's `globalSetup` runs in a separate process from test
workers, so module-level state doesn't flow through. In radix-sdk
the setup previously exported `DEPLOYED_TEST_CHAIN_METADATA` as a
module-level const populated by `before()`. Replaced with
`getDeployedTestChainMetadata()` that reads addresses back from
env vars (`RADIX_E2E_PACKAGE_ADDRESS`, `RADIX_E2E_XRD_ADDRESS`)
which the setup writes before tests run. Other packages that only
needed container lifecycle (not setup-produced state) did not
need this indirection.
## Catalog cleanup
- `mocha-steps` — removed. No remaining consumers after the e2e
migration.
- `mocha`, `@types/mocha`, `chai`, `chai-as-promised`,
`@types/chai`, `@types/chai-as-promised` — retained. Still used
by: cli e2e (not migrated here — 101 files with bash-orchestrated
anvil); hardhat tests in sdk/relayer/infra/helloworld (hardhat
embeds mocha, can't be swapped).
- `sinon`, `@types/sinon` — retained. Still used by hybrid hardhat
packages.
## Verified
- `pnpm build` — 29/29 turbo tasks pass
- Unit tests unaffected: rebalancer (367), sdk (532), svm-sdk (55),
radix-sdk (5), plus all other packages
- E2e tests themselves require containers (Docker / anvil / aleo node
/ etc.) to run — only the migration's structural correctness was
verified locally; actual e2e execution happens in CI environments
that provide those dependencies1 parent b58b88d commit df090e0
84 files changed
Lines changed: 623 additions & 908 deletions
File tree
- typescript
- aleo-sdk
- scripts
- src/tests
- cosmos-sdk
- src/tests
- radix-sdk
- src/tests
- rebalancer
- src/e2e
- harness
- starknet-sdk
- scripts
- src/tests
- svm-sdk
- scripts
- src/tests
- tron-sdk
- src/ethers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 54 | | |
62 | 55 | | |
63 | 56 | | |
64 | | - | |
65 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
66 | 60 | | |
67 | 61 | | |
68 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 24 | + | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
| |||
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
41 | | - | |
| 36 | + | |
42 | 37 | | |
43 | 38 | | |
44 | 39 | | |
| |||
169 | 164 | | |
170 | 165 | | |
171 | 166 | | |
172 | | - | |
| 167 | + | |
173 | 168 | | |
174 | 169 | | |
175 | 170 | | |
| |||
0 commit comments