Skip to content

Commit

Permalink
chore(e2e): replace viem/anvil with prool (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Oct 15, 2024
1 parent fe98442 commit d5bddce
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 8 deletions.
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"@latticexyz/utils": "link:../../../packages/utils",
"@latticexyz/world": "link:../../../packages/world",
"@latticexyz/world-modules": "link:../../../packages/world-modules",
"@viem/anvil": "^0.0.6",
"abitype": "1.0.6",
"chalk": "^5.2.0",
"dotenv": "^16.0.3",
"drizzle-orm": "^0.28.5",
"execa": "^7.1.1",
"happy-dom": "^12.10.3",
"postgres": "3.3.5",
"prool": "^0.0.16",
"typescript": "5.4.2",
"viem": "2.21.19",
"vite": "^4.2.1",
Expand Down
25 changes: 21 additions & 4 deletions e2e/packages/sync-test/setup/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { startProxy } from "@viem/anvil";
import { createServer } from "prool";
import { anvil } from "prool/instances";

if (typeof Promise.withResolvers === "undefined") {
Promise.withResolvers = function () {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { promise, resolve, reject };
};
}

export default async function () {
if (process.env.SKIP_GLOBAL_SETUP) {
Expand All @@ -23,11 +35,16 @@ export default async function () {
// We still need to remember to reset the anvil instance between test files. This is generally
// handled in `setup.ts` but may require additional resetting (e.g. via `afterAll`), in case of
// any custom per-test adjustments that persist beyond `anvil_reset`.
return await startProxy({
options: {

const server = createServer({
host: "127.0.0.1",
port: 8545,
instance: anvil({
blockTime: 1,
blockBaseFeePerGas: 0,
gasLimit: 20_000_000,
},
}),
});

return await server.start();
}
Loading

0 comments on commit d5bddce

Please sign in to comment.