Skip to content

Commit c3d8fdb

Browse files
committed
Switch @ethdebug/pointers to vitest
1 parent d6a9ba2 commit c3d8fdb

9 files changed

Lines changed: 34 additions & 69 deletions

File tree

packages/pointers/jest.config.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/pointers/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@
99
"run-example": "node ./dist/bin/run-example.js",
1010
"prepare": "tsc",
1111
"watch": "yarn prepare --watch",
12-
"test": "node --experimental-vm-modules $(yarn bin jest)"
12+
"test": "vitest"
1313
},
1414
"devDependencies": {
1515
"@ethdebug/format": "^0.1.0-0",
16-
"@jest/globals": "^29.7.0",
1716
"chalk": "^5.3.0",
1817
"cli-highlight": "^2.1.11",
1918
"ganache": "7.9.x",
20-
"jest": "^29.7.0",
2119
"solc": "^0.8.26",
22-
"ts-jest": "^29.1.1",
2320
"ts-node": "^10.9.2",
24-
"typescript": "^5.3.3"
21+
"typescript": "^5.3.3",
22+
"vitest": "^3.0.5"
2523
},
2624
"dependencies": {
2725
"ethereum-cryptography": "^2.1.3"

packages/pointers/src/data.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, describe, it } from "@jest/globals";
1+
import { expect, describe, it } from "vitest";
22

33
import { Data } from "./data.js";
44

packages/pointers/src/dereference/index.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, expect, describe, it, beforeEach } from "@jest/globals";
1+
import { vitest, expect, describe, it, beforeEach } from "vitest";
22
import { Pointer } from "@ethdebug/format";
33
import { Machine } from "../machine.js";
44
import { Data } from "../data.js";
@@ -11,25 +11,25 @@ describe("dereference", () => {
1111
state = {
1212
stack: {
1313
length: Promise.resolve(10n),
14-
peek: jest.fn(async () => Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))),
14+
peek: vitest.fn(async () => Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))),
1515
},
1616
memory: {
17-
read: jest.fn(async () => Data.fromBytes(new Uint8Array([0x55, 0x66, 0x77, 0x88]))),
17+
read: vitest.fn(async () => Data.fromBytes(new Uint8Array([0x55, 0x66, 0x77, 0x88]))),
1818
},
1919
storage: {
20-
read: jest.fn(async () => Data.fromBytes(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]))),
20+
read: vitest.fn(async () => Data.fromBytes(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]))),
2121
},
2222
calldata: {
23-
read: jest.fn(async () => Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))),
23+
read: vitest.fn(async () => Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))),
2424
},
2525
returndata: {
26-
read: jest.fn(async () => Data.fromBytes(new Uint8Array([0x55, 0x66, 0x77, 0x88]))),
26+
read: vitest.fn(async () => Data.fromBytes(new Uint8Array([0x55, 0x66, 0x77, 0x88]))),
2727
},
2828
transient: {
29-
read: jest.fn(async () => Data.fromBytes(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]))),
29+
read: vitest.fn(async () => Data.fromBytes(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]))),
3030
},
3131
code: {
32-
read: jest.fn(async () => Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))),
32+
read: vitest.fn(async () => Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))),
3333
},
3434
} as unknown as Machine.State;
3535
});

packages/pointers/src/evaluate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, describe, it, beforeEach } from "@jest/globals";
1+
import { expect, describe, it, beforeEach } from "vitest";
22

33
import { keccak256 } from "ethereum-cryptography/keccak";
44
import { toHex } from "ethereum-cryptography/utils";

packages/pointers/src/integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, expect, describe, it, beforeEach } from "@jest/globals";
1+
import { expect, describe, it, beforeEach } from "vitest";
22

33
import { observeTrace } from "../test/index.js";
44
import { observeTraceTests } from "./test-cases.js";
@@ -11,10 +11,10 @@ describe("dereference (integration)", () => {
1111
describe(`example pointer: ${name}`, () => {
1212
it("resolves to values containing the expected sequence", async () => {
1313
const observedValues =
14-
await observeTrace(options as Parameters<typeof observeTrace>[0]);
14+
await observeTrace(options as any);
1515

1616
expect(observedValues)
17-
.toEqual(expect.arrayContaining(expectedValues));
17+
.toEqual(expect.arrayContaining(expectedValues as any));
1818
});
1919
});
2020
}

packages/pointers/src/read.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, expect, describe, it, beforeEach } from "@jest/globals";
1+
import { vitest, expect, describe, it, beforeEach } from "vitest";
22

33
import type { Pointer } from "@ethdebug/format";
44

@@ -14,43 +14,43 @@ describe("read", () => {
1414
const state: Machine.State = {
1515
stack: {
1616
length: 50n,
17-
peek: jest.fn(
17+
peek: vitest.fn(
1818
async ({ depth, slice }) =>
1919
Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))
2020
),
2121
},
2222
memory: {
23-
read: jest.fn(
23+
read: vitest.fn(
2424
async ({ slice }) =>
2525
Data.fromBytes(new Uint8Array([0x55, 0x66, 0x77, 0x88]))
2626
),
2727
},
2828
storage: {
29-
read: jest.fn(
29+
read: vitest.fn(
3030
async ({ slot, slice }) =>
3131
Data.fromBytes(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]))
3232
),
3333
},
3434
calldata: {
35-
read: jest.fn(
35+
read: vitest.fn(
3636
async ({ slice }) =>
3737
Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))
3838
),
3939
},
4040
returndata: {
41-
read: jest.fn(
41+
read: vitest.fn(
4242
async ({ slice }) =>
4343
Data.fromBytes(new Uint8Array([0x55, 0x66, 0x77, 0x88]))
4444
),
4545
},
4646
transient: {
47-
read: jest.fn(
47+
read: vitest.fn(
4848
async ({ slot, slice }) =>
4949
Data.fromBytes(new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]))
5050
),
5151
},
5252
code: {
53-
read: jest.fn(
53+
read: vitest.fn(
5454
async ({ slice }) =>
5555
Data.fromBytes(new Uint8Array([0x11, 0x22, 0x33, 0x44]))
5656
),

packages/pointers/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineProject } from "vitest/config";
2+
3+
export default defineProject({
4+
test: {
5+
}
6+
});

yarn.lock

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5466,7 +5466,7 @@ browserslist@^4.23.0:
54665466
node-releases "^2.0.14"
54675467
update-browserslist-db "^1.0.16"
54685468

5469-
bs-logger@0.x, bs-logger@^0.2.6:
5469+
bs-logger@^0.2.6:
54705470
version "0.2.6"
54715471
resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz"
54725472
integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==
@@ -9765,7 +9765,7 @@ lodash.ismatch@^4.4.0:
97659765
resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz"
97669766
integrity sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==
97679767

9768-
lodash.memoize@4.x, lodash.memoize@^4.1.2:
9768+
lodash.memoize@^4.1.2:
97699769
version "4.1.2"
97709770
resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz"
97719771
integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==
@@ -9863,7 +9863,7 @@ make-dir@^2.1.0:
98639863
pify "^4.0.1"
98649864
semver "^5.6.0"
98659865

9866-
make-error@1.x, make-error@^1.1.1, make-error@^1.3.6:
9866+
make-error@^1.1.1, make-error@^1.3.6:
98679867
version "1.3.6"
98689868
resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz"
98699869
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
@@ -14053,20 +14053,6 @@ trough@^2.0.0:
1405314053
resolved "https://registry.npmjs.org/trough/-/trough-2.1.0.tgz"
1405414054
integrity sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==
1405514055

14056-
ts-jest@^29.1.1:
14057-
version "29.1.1"
14058-
resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz"
14059-
integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==
14060-
dependencies:
14061-
bs-logger "0.x"
14062-
fast-json-stable-stringify "2.x"
14063-
jest-util "^29.0.0"
14064-
json5 "^2.2.3"
14065-
lodash.memoize "4.x"
14066-
make-error "1.x"
14067-
semver "^7.5.3"
14068-
yargs-parser "^21.0.1"
14069-
1407014056
ts-jest@^29.2.5:
1407114057
version "29.2.5"
1407214058
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.2.5.tgz#591a3c108e1f5ebd013d3152142cb5472b399d63"
@@ -14984,7 +14970,7 @@ yaml@^2.3.4:
1498414970
resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz"
1498514971
integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==
1498614972

14987-
yargs-parser@21.1.1, yargs-parser@^21.0.1, yargs-parser@^21.1.1:
14973+
yargs-parser@21.1.1, yargs-parser@^21.1.1:
1498814974
version "21.1.1"
1498914975
resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz"
1499014976
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==

0 commit comments

Comments
 (0)