Skip to content

Commit

Permalink
test(bundler): fix determinism
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Oct 15, 2024
1 parent 43489ff commit d2fa194
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/bundler-sdk/test/populateBundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ describe("populateBundle", () => {
async ({ client, config }) => {
const { id } = usdc_wstEth;
const collateralAssets = parseEther("100");
const loanShares = parseUnits("50000", 12);
const loanShares = parseUnits("5000", 12);
const loanAssets = (await fetchMarket(id, client)).toBorrowAssets(
loanShares,
);
Expand Down Expand Up @@ -3628,7 +3628,7 @@ describe("populateBundle", () => {
async ({ client, config }) => {
const { id } = usdc_wstEth;
const collateralAssets = parseEther("100");
const loanShares = parseUnits("50000", 12);
const loanShares = parseUnits("5000", 12);
const loanAssets = (await fetchMarket(id, client)).toBorrowAssets(
loanShares,
);
Expand Down
6 changes: 3 additions & 3 deletions packages/test-viem/src/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { homedir } from "node:os";
import { join } from "node:path";
import "colors";
import { writeFile } from "node:fs/promises";
import { red, yellow } from "colors";
import { grey, red, yellow } from "colors";
import {
type Address,
type BlockTag,
Expand Down Expand Up @@ -149,9 +149,9 @@ export const formatCallTrace = (trace: RpcCallTrace, level = 1): string => {
.map((subtrace) => formatCallTrace(subtrace, level + 1))
.join("\n");

const error = trace.revertReason ?? trace.output;
const returnValue = trace.revertReason ?? trace.output;

return `${level === 1 ? `${getIndentLevel(level, true)}FROM ${trace.from.grey}\n`.cyan : ""}${getIndentLevel(level, true)}${trace.type.yellow} ${trace.from === trace.to ? ("self").grey : `(${trace.to.white})`}.${formatCallSignature(trace, level)}${error ? ` -> ${error}`.red : ""}
return `${level === 1 ? `${getIndentLevel(level, true)}FROM ${trace.from.grey}\n`.cyan : ""}${getIndentLevel(level, true)}${trace.type.yellow} ${trace.from === trace.to ? ("self").grey : `(${trace.to.white})`}.${formatCallSignature(trace, level)}${returnValue ? (trace.error ? red : grey)(` -> ${returnValue}`) : ""}
${rest}`;
};

Expand Down
3 changes: 1 addition & 2 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ export default defineWorkspace([
test: {
name: "bundler-sdk",
include: ["packages/bundler-sdk/**/*.test.ts"],
exclude: ["packages/bundler-sdk/test/services/**/*.test.ts"],
environment: "happy-dom",
testTimeout: 60_000,
testTimeout: 30_000,
},
},
{
Expand Down

0 comments on commit d2fa194

Please sign in to comment.