diff --git a/packages/ignition-core/.mocharc.json b/packages/ignition-core/.mocharc.json deleted file mode 100644 index 0b46dad4e9c..00000000000 --- a/packages/ignition-core/.mocharc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extension": ["ts"], - "node-option": ["import=tsx/esm"], - "file": "./test/setup.ts", - "timeout": 25000, - "exclude": [ - "./test/helpers/**/*", - "./test-integrations/fixture-projects/**/*", - "./test-integrations/helpers/**/*" - ] -} diff --git a/packages/ignition-core/.nycrc b/packages/ignition-core/.nycrc deleted file mode 100644 index 4f553664208..00000000000 --- a/packages/ignition-core/.nycrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "@istanbuljs/nyc-config-typescript", - "check-coverage": true, - "statements": 75, - "branches": 65, - "functions": 70, - "lines": 75, - "all": true, - "include": ["src/**/*.ts"], - "reporter": ["html", "lcov", "text", "text-summary"], - "report-dir": "coverage" -} diff --git a/packages/ignition-core/package.json b/packages/ignition-core/package.json index 4b63af6579b..616319d5df3 100644 --- a/packages/ignition-core/package.json +++ b/packages/ignition-core/package.json @@ -46,9 +46,9 @@ "api-extractor": "api-extractor run --local --verbose", "test": "pnpm test:unit && pnpm test:integrations", "test:debug": "DEBUG='ignition:*' pnpm test", - "test:coverage": "nyc mocha --recursive \"test/**/*.ts\" \"test-integrations/**/*.ts\"", - "test:unit": "mocha --recursive \"test/**/*.ts\"", - "test:integrations": "mocha --recursive \"test-integrations/**/*.ts\"", + "test:coverage": "c8 --reporter html --reporter text --all --exclude test --exclude test-integrations --exclude \"src/**/{types,type-extensions}.ts\" --src src node --import tsx/esm --test --test-reporter=@nomicfoundation/hardhat-node-test-reporter \"test/*.ts\" \"test/!(fixture-projects|helpers)/**/*.ts\" \"test-integrations/*.ts\" \"test-integrations/!(fixture-projects|helpers)/**/*.ts\"", + "test:unit": "node --import tsx/esm --test --test-reporter=@nomicfoundation/hardhat-node-test-reporter \"test/*.ts\" \"test/!(fixture-projects|helpers)/**/*.ts\"", + "test:integrations": "node --import tsx/esm --test --test-reporter=@nomicfoundation/hardhat-node-test-reporter \"test-integrations/*.ts\" \"test-integrations/!(fixture-projects|helpers)/**/*.ts\"", "clean": "rimraf dist", "prepack": "pnpm build" }, @@ -59,22 +59,16 @@ "README.md" ], "devDependencies": { - "@istanbuljs/nyc-config-typescript": "1.0.2", "@microsoft/api-extractor": "7.60.1", + "@nomicfoundation/hardhat-node-test-reporter": "workspace:^3.1.0", "@nomicfoundation/hardhat-test-utils": "workspace:^", - "@types/chai": "^5.2.3", - "@types/chai-as-promised": "^8.0.1", "@types/lodash-es": "^4.17.12", - "@types/mocha": ">=10.0.10", "@types/ndjson": "2.0.4", "@types/node": "^22.0.0", - "chai": "^6.2.2", - "chai-as-promised": "^8.0.0", + "c8": "^12.0.0", "cross-env": "10.1.0", "eslint": "9.39.5", "hardhat": "workspace:^3.20.0", - "mocha": "^12.0.0", - "nyc": "18.0.0", "prettier": "3.9.10", "rimraf": "^6.1.3", "tsx": "^4.23.1", diff --git a/packages/ignition-core/test-integrations/helpers/hardhat-projects.ts b/packages/ignition-core/test-integrations/helpers/hardhat-projects.ts index 3099a81d81d..669c2349c08 100644 --- a/packages/ignition-core/test-integrations/helpers/hardhat-projects.ts +++ b/packages/ignition-core/test-integrations/helpers/hardhat-projects.ts @@ -1,3 +1,4 @@ +import { before, after } from "node:test"; import path from "node:path"; import { cpSync } from "node:fs"; diff --git a/packages/ignition-core/test-integrations/internal/execution/jsonrpc-client.ts b/packages/ignition-core/test-integrations/internal/execution/jsonrpc-client.ts index ccbd9981774..c78746acefe 100644 --- a/packages/ignition-core/test-integrations/internal/execution/jsonrpc-client.ts +++ b/packages/ignition-core/test-integrations/internal/execution/jsonrpc-client.ts @@ -1,6 +1,12 @@ import type { HardhatRuntimeEnvironment } from "hardhat/types/hre"; -import { assert } from "chai"; +import { HardhatError } from "@nomicfoundation/hardhat-errors"; +import { + assertRejects, + assertRejectsWithHardhatError, +} from "@nomicfoundation/hardhat-test-utils"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { Artifact } from "../../../src/index.js"; import { @@ -43,9 +49,9 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(tx); - assert.isDefined(receipt); + assert.notEqual(receipt, undefined); assert.equal(receipt!.status, TransactionReceiptStatus.SUCCESS); - assert.isDefined(receipt!.contractAddress); + assert.notEqual(receipt!.contractAddress, undefined); return { artifact, address: receipt!.contractAddress! }; } @@ -65,8 +71,8 @@ describe("JSON-RPC client", function () { const block = await client.getLatestBlock(); assert.equal(block.number, 0); - assert.isString(block.hash); - assert.typeOf(block.baseFeePerGas, "bigint"); + assert.equal(typeof block.hash, "string"); + assert.equal(typeof block.baseFeePerGas, "bigint"); }); it("Should return the second block in the correct format", async function () { @@ -75,8 +81,8 @@ describe("JSON-RPC client", function () { const block = await client.getLatestBlock(); assert.equal(block.number, 1); - assert.isString(block.hash); - assert.typeOf(block.baseFeePerGas, "bigint"); + assert.equal(typeof block.hash, "string"); + assert.equal(typeof block.baseFeePerGas, "bigint"); }); }); @@ -89,9 +95,9 @@ describe("JSON-RPC client", function () { assert("maxFeePerGas" in fees); assert("maxPriorityFeePerGas" in fees); - assert.typeOf(fees.maxFeePerGas, "bigint"); - assert.typeOf(fees.maxPriorityFeePerGas, "bigint"); - assert.isTrue(fees.maxFeePerGas > fees.maxPriorityFeePerGas); + assert.equal(typeof fees.maxFeePerGas, "bigint"); + assert.equal(typeof fees.maxPriorityFeePerGas, "bigint"); + assert.equal(fees.maxFeePerGas > fees.maxPriorityFeePerGas, true); }); it('Should throw if the "maxFeePerGas" exceeds the configured limit', async function () { @@ -99,9 +105,11 @@ describe("JSON-RPC client", function () { maxFeePerGasLimit: 1n, }); - await assert.isRejected( + await assertRejectsWithHardhatError( failClient.getNetworkFees(), - /HHE10406: The calculated max fee per gas exceeds the configured limit./, + HardhatError.ERRORS.IGNITION.EXECUTION + .MAX_FEE_PER_GAS_EXCEEDS_GAS_LIMIT, + {}, ); }); @@ -336,9 +344,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isTrue(result.success); + assert.equal(result.success, true); assert.notEqual(result.returnData, "0x"); - assert.isFalse(result.customErrorReported); + assert.equal(result.customErrorReported, false); }); it("Should return the raw result in successful non-deployment calls", async function () { @@ -369,9 +377,9 @@ describe("JSON-RPC client", function () { const abiEncodedHello = "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000"; - assert.isTrue(result.success); + assert.equal(result.success, true); assert.equal(result.returnData, abiEncodedHello); - assert.isFalse(result.customErrorReported); + assert.equal(result.customErrorReported, false); }); it("Should not throw on execution failures, but return a result", async function () { @@ -392,9 +400,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isFalse(result.success); + assert.equal(result.success, false); assert.equal(result.returnData, "0x"); - assert.isFalse(result.customErrorReported); + assert.equal(result.customErrorReported, false); }); it("Should return the returnData on execution failures", async function () { @@ -429,9 +437,9 @@ describe("JSON-RPC client", function () { const abiEncodedHello = "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006726561736f6e0000000000000000000000000000000000000000000000000000"; - assert.isFalse(result.success); + assert.equal(result.success, false); assert.equal(result.returnData, abiEncodedHello); - assert.isFalse(result.customErrorReported); + assert.equal(result.customErrorReported, false); }); it("[Geth specific] Should return an empty returnData even when geth doesn't return it", async function () { @@ -477,9 +485,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isFalse(result1.success); + assert.equal(result1.success, false); assert.equal(result1.returnData, "0x"); - assert.isFalse(result1.customErrorReported); + assert.equal(result1.customErrorReported, false); const result2 = await mockClient.call( { @@ -490,9 +498,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isFalse(result2.success); + assert.equal(result2.success, false); assert.equal(result2.returnData, "0x"); - assert.isFalse(result2.customErrorReported); + assert.equal(result2.customErrorReported, false); }); it("[Other nodes] Should return an empty returnData if the error message indicates a revert", async function () { @@ -527,9 +535,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isFalse(result1.success); + assert.equal(result1.success, false); assert.equal(result1.returnData, "0x"); - assert.isFalse(result1.customErrorReported); + assert.equal(result1.customErrorReported, false); }); it("Should rethrow an HardhatError if the error message indicates an incorrectly configured base gas fee versus the node's block gas limit", async function () { @@ -555,7 +563,7 @@ describe("JSON-RPC client", function () { params: [], }); - await assert.isRejected( + await assertRejectsWithHardhatError( mockClient.call( { data: "0x", @@ -564,7 +572,8 @@ describe("JSON-RPC client", function () { }, "latest", ), - /HHE10405\: The configured base fee exceeds the block gas limit\. Please reduce the configured base fee or increase the block gas limit\./, + HardhatError.ERRORS.IGNITION.EXECUTION.BASE_FEE_EXCEEDS_GAS_LIMIT, + {}, ); }); @@ -596,9 +605,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isFalse(result.success); + assert.equal(result.success, false); assert.notEqual(result.returnData, "0x"); - assert.isTrue(result.customErrorReported); + assert.equal(result.customErrorReported, true); }); it("Should return customErrorReported false when the server does not reports a custom error", async function () { @@ -629,9 +638,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isFalse(result.success); + assert.equal(result.success, false); assert.notEqual(result.returnData, "0x"); - assert.isFalse(result.customErrorReported); + assert.equal(result.customErrorReported, false); }); it("Should accept pending as blockTag", async function () { @@ -678,9 +687,9 @@ describe("JSON-RPC client", function () { "latest", ); - assert.isTrue(resultLatest.success); + assert.equal(resultLatest.success, true); assert.equal(resultLatest.returnData, "0x"); - assert.isFalse(resultLatest.customErrorReported); + assert.equal(resultLatest.customErrorReported, false); const resultPending = await client.call( { @@ -696,9 +705,9 @@ describe("JSON-RPC client", function () { "pending", ); - assert.isFalse(resultPending.success); + assert.equal(resultPending.success, false); assert.notEqual(resultPending.returnData, "0x"); - assert.isFalse(resultPending.customErrorReported); + assert.equal(resultPending.customErrorReported, false); }); // TODO: Should we test that eth_call validates the account balance? @@ -726,7 +735,7 @@ describe("JSON-RPC client", function () { fees, }); - assert.isString(result); + assert.equal(typeof result, "string"); }); it("Should return the tx hash in a network without automining", async function () { @@ -754,7 +763,7 @@ describe("JSON-RPC client", function () { fees, }); - assert.isString(result); + assert.equal(typeof result, "string"); }); }); @@ -937,7 +946,7 @@ describe("JSON-RPC client", function () { accounts, }); - await assert.isRejected( + await assertRejects( client.estimateGas({ to: address, from: accounts[0], @@ -1152,7 +1161,7 @@ describe("JSON-RPC client", function () { const tx = await client.getTransaction(hash); - assert.isDefined(tx); + assert.notEqual(tx, undefined); assert.equal(tx!.hash, hash); assert("maxFeePerGas" in tx!.fees); @@ -1198,7 +1207,7 @@ describe("JSON-RPC client", function () { const tx = await client.getTransaction(hash); - assert.isDefined(tx); + assert.notEqual(tx, undefined); assert.equal(tx!.hash, hash); assert("maxFeePerGas" in tx!.fees); assert("maxPriorityFeePerGas" in tx!.fees); @@ -1216,7 +1225,7 @@ describe("JSON-RPC client", function () { "0x0000000000000000000000000000000000000000000000000000000000000001", ); - assert.isUndefined(tx); + assert.equal(tx, undefined); }); it("Should return undefined if the transaction was replaced by a different one", async function () { @@ -1259,7 +1268,7 @@ describe("JSON-RPC client", function () { const tx = await client.getTransaction(firstTxHash); - assert.isUndefined(tx); + assert.equal(tx, undefined); }); it("Should return undefined if the transaction was dropped", async function () { @@ -1295,7 +1304,7 @@ describe("JSON-RPC client", function () { const tx = await client.getTransaction(txHash); - assert.isUndefined(tx); + assert.equal(tx, undefined); }); }); }); @@ -1328,11 +1337,11 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(hash); - assert.isDefined(receipt); + assert.notEqual(receipt, undefined); assert.equal(receipt!.blockHash, block.hash); assert.equal(receipt!.blockNumber, block.number); assert.equal(receipt!.status, TransactionReceiptStatus.SUCCESS); - assert.isUndefined(receipt!.contractAddress); + assert.equal(receipt!.contractAddress, undefined); assert.deepEqual(receipt!.logs, []); }); @@ -1361,11 +1370,11 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(hash); - assert.isDefined(receipt); + assert.notEqual(receipt, undefined); assert.equal(receipt!.blockHash, block.hash); assert.equal(receipt!.blockNumber, block.number); assert.equal(receipt!.status, TransactionReceiptStatus.SUCCESS); - assert.isDefined(receipt!.contractAddress); + assert.notEqual(receipt!.contractAddress, undefined); assert.deepEqual(receipt!.logs, []); }); @@ -1393,11 +1402,11 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(hash); - assert.isDefined(receipt); + assert.notEqual(receipt, undefined); assert.equal(receipt!.blockHash, block.hash); assert.equal(receipt!.blockNumber, block.number); assert.equal(receipt!.status, TransactionReceiptStatus.FAILURE); - assert.isUndefined(receipt!.contractAddress); + assert.equal(receipt!.contractAddress, undefined); assert.deepEqual(receipt!.logs, []); }); @@ -1431,14 +1440,14 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(hash); - assert.isDefined(receipt); + assert.notEqual(receipt, undefined); assert.equal(receipt!.blockHash, block.hash); assert.equal(receipt!.blockNumber, block.number); assert.equal(receipt!.status, TransactionReceiptStatus.SUCCESS); - assert.isUndefined(receipt!.contractAddress); + assert.equal(receipt!.contractAddress, undefined); - assert.isArray(receipt!.logs); - assert.lengthOf(receipt!.logs, 2); + assert.ok(Array.isArray(receipt!.logs)); + assert.equal(receipt!.logs.length, 2); const event0 = receipt!.logs[0]; const event1 = receipt!.logs[1]; @@ -1452,10 +1461,10 @@ describe("JSON-RPC client", function () { assert.notEqual(event0.data, "0x"); assert.notEqual(event1.data, "0x"); - assert.isDefined(event0.topics[0]); + assert.notEqual(event0.topics[0], undefined); assert.notEqual(event0.topics[0], "0x"); - assert.isDefined(event1.topics[0]); + assert.notEqual(event1.topics[0], undefined); assert.notEqual(event1.topics[0], "0x"); assert.notEqual(event0.topics[0], event1.topics[0]); @@ -1491,7 +1500,7 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(hash); - assert.isUndefined(receipt); + assert.equal(receipt, undefined); }); it("Should return undefined if the transaction was never sent", async function () { @@ -1501,7 +1510,7 @@ describe("JSON-RPC client", function () { "0x0000000000000000000000000000000000000000000000000000000000000001", ); - assert.isUndefined(receipt); + assert.equal(receipt, undefined); }); it("Should return undefined if the transaction was replaced by a different one", async function () { @@ -1544,7 +1553,7 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(firstTxHash); - assert.isUndefined(receipt); + assert.equal(receipt, undefined); }); it("Should return undefined if the transaction was dropped", async function () { @@ -1580,7 +1589,7 @@ describe("JSON-RPC client", function () { const receipt = await client.getTransactionReceipt(txHash); - assert.isUndefined(receipt); + assert.equal(receipt, undefined); }); }); }); @@ -1612,7 +1621,7 @@ describe("JSON-RPC client", function () { }, }); - assert.isString(result); + assert.equal(typeof result, "string"); }); }); }); diff --git a/packages/ignition-core/test-integrations/test-execution-result-fixtures.ts b/packages/ignition-core/test-integrations/test-execution-result-fixtures.ts index 150fad2c3ac..992881a50c5 100644 --- a/packages/ignition-core/test-integrations/test-execution-result-fixtures.ts +++ b/packages/ignition-core/test-integrations/test-execution-result-fixtures.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { encodeArtifactDeploymentData, @@ -57,9 +58,14 @@ describe("execution-result-fixture tests", function () { }); const receipt = await client.getTransactionReceipt(tx); - assert.isDefined(receipt, `No receipt for deployment of ${name}`); - assert.isDefined( + assert.notEqual( + receipt, + undefined, + `No receipt for deployment of ${name}`, + ); + assert.notEqual( receipt!.contractAddress, + undefined, `No receipt address from deployment of ${name}`, ); diff --git a/packages/ignition-core/test/batcher.ts b/packages/ignition-core/test/batcher.ts index 9991e3199b4..da1be7e58e6 100644 --- a/packages/ignition-core/test/batcher.ts +++ b/packages/ignition-core/test/batcher.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; import { Batcher } from "../src/internal/batcher.js"; @@ -191,7 +192,7 @@ function assertBatching( }, expectedBatches: string[][], ) { - assert.isDefined(ignitionModule); + assert.notEqual(ignitionModule, undefined); const actualBatches = Batcher.batch(ignitionModule, deploymentState); diff --git a/packages/ignition-core/test/build-module.ts b/packages/ignition-core/test/build-module.ts index a26163c9f41..635ceda6823 100644 --- a/packages/ignition-core/test/build-module.ts +++ b/packages/ignition-core/test/build-module.ts @@ -1,6 +1,10 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; -import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import { + assertThrows, + assertThrowsHardhatError, +} from "@nomicfoundation/hardhat-test-utils"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; @@ -17,12 +21,12 @@ describe("buildModule", () => { }); it("should error on module throwing an exception", async function () { - assert.throws( + assertThrows( () => buildModule("AsyncModule", () => { throw new Error("User thrown error"); }), - /User thrown error/, + (e) => /User thrown error/.test(e.message), ); }); }); diff --git a/packages/ignition-core/test/call.ts b/packages/ignition-core/test/call.ts index 29f62ad4416..7d553870903 100644 --- a/packages/ignition-core/test/call.ts +++ b/packages/ignition-core/test/call.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { Artifact } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -30,7 +31,7 @@ describe("call", () => { return { contract1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithASingleContract.id, "Module1"); @@ -64,7 +65,7 @@ describe("call", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -102,7 +103,7 @@ describe("call", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -135,7 +136,7 @@ describe("call", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const callFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example.test", @@ -157,7 +158,7 @@ describe("call", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const callFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example.test", @@ -182,7 +183,7 @@ describe("call", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const callFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example.test", @@ -204,7 +205,7 @@ describe("call", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const callFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example.test", @@ -403,8 +404,8 @@ describe("call", () => { ({ id }) => id === "Module1#second", ); - assert.isDefined(callFuture); - assert.isDefined(callFuture2); + assert.notEqual(callFuture, undefined); + assert.notEqual(callFuture2, undefined); }); it("should throw if the same function is called twice without differentiating ids", () => { @@ -746,13 +747,11 @@ m.call(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.CONTRACT_CALL, ); - await assert.isFulfilled( - validateNamedContractCall( - future as any, - setupMockArtifactResolver({ Another: fakeArtifact }), - {}, - [], - ), + await validateNamedContractCall( + future as any, + setupMockArtifactResolver({ Another: fakeArtifact }), + {}, + [], ); }); @@ -908,13 +907,11 @@ m.call(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.CONTRACT_CALL, ); - await assert.isFulfilled( - validateNamedContractCall( - future as any, - setupMockArtifactResolver({ Another: fakeArtifact }), - {}, - [], - ), + await validateNamedContractCall( + future as any, + setupMockArtifactResolver({ Another: fakeArtifact }), + {}, + [], ); }); @@ -951,13 +948,11 @@ m.call(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.CONTRACT_CALL, ); - await assert.isFulfilled( - validateNamedContractCall( - future as any, - setupMockArtifactResolver({ Another: fakeArtifact }), - {}, - [], - ), + await validateNamedContractCall( + future as any, + setupMockArtifactResolver({ Another: fakeArtifact }), + {}, + [], ); }); diff --git a/packages/ignition-core/test/contract.ts b/packages/ignition-core/test/contract.ts index 8b84abeb152..01777f9bc50 100644 --- a/packages/ignition-core/test/contract.ts +++ b/packages/ignition-core/test/contract.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { Artifact } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -30,7 +31,7 @@ describe("contract", () => { return { contract1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithASingleContract.id, "Module1"); @@ -58,7 +59,7 @@ describe("contract", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -93,7 +94,7 @@ describe("contract", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -124,7 +125,7 @@ describe("contract", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -152,7 +153,7 @@ describe("contract", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -176,7 +177,7 @@ describe("contract", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -206,7 +207,7 @@ describe("contract", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -233,7 +234,7 @@ describe("contract", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -258,7 +259,7 @@ describe("contract", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -280,7 +281,7 @@ describe("contract", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -678,13 +679,11 @@ m.contract(..., { id: "MyUniqueId"})`, const [future] = getFuturesFromModule(module); - await assert.isFulfilled( - validateNamedContractDeployment( - future as any, - setupMockArtifactResolver({ Test: fakerArtifact }), - {}, - [], - ), + await validateNamedContractDeployment( + future as any, + setupMockArtifactResolver({ Test: fakerArtifact }), + {}, + [], ); }); @@ -833,13 +832,11 @@ m.contract(..., { id: "MyUniqueId"})`, const [future] = getFuturesFromModule(module); - await assert.isFulfilled( - validateNamedContractDeployment( - future as any, - setupMockArtifactResolver({ Test: fakerArtifact }), - {}, - [], - ), + await validateNamedContractDeployment( + future as any, + setupMockArtifactResolver({ Test: fakerArtifact }), + {}, + [], ); }); @@ -870,13 +867,11 @@ m.contract(..., { id: "MyUniqueId"})`, const [future] = getFuturesFromModule(module); - await assert.isFulfilled( - validateNamedContractDeployment( - future as any, - setupMockArtifactResolver({ Test: fakerArtifact }), - {}, - [], - ), + await validateNamedContractDeployment( + future as any, + setupMockArtifactResolver({ Test: fakerArtifact }), + {}, + [], ); }); diff --git a/packages/ignition-core/test/contractAt.ts b/packages/ignition-core/test/contractAt.ts index 46c2e101b2f..88f54493ab2 100644 --- a/packages/ignition-core/test/contractAt.ts +++ b/packages/ignition-core/test/contractAt.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { FutureType } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -25,7 +26,7 @@ describe("contractAt", () => { return { contract1 }; }); - assert.isDefined(moduleWithContractFromArtifact); + assert.notEqual(moduleWithContractFromArtifact, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithContractFromArtifact.id, "Module1"); diff --git a/packages/ignition-core/test/contractAtFromArtifact.ts b/packages/ignition-core/test/contractAtFromArtifact.ts index 56df27db176..9911c53d785 100644 --- a/packages/ignition-core/test/contractAtFromArtifact.ts +++ b/packages/ignition-core/test/contractAtFromArtifact.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { FutureType } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -26,7 +27,7 @@ describe("contractAtFromArtifact", () => { return { contract1 }; }); - assert.isDefined(moduleWithContractFromArtifact); + assert.notEqual(moduleWithContractFromArtifact, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithContractFromArtifact.id, "Module1"); diff --git a/packages/ignition-core/test/contractFromArtifact.ts b/packages/ignition-core/test/contractFromArtifact.ts index 1bd4e110262..97d58a7beda 100644 --- a/packages/ignition-core/test/contractFromArtifact.ts +++ b/packages/ignition-core/test/contractFromArtifact.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { type Artifact, FutureType } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -31,7 +32,7 @@ describe("contractFromArtifact", () => { return { contract1 }; }); - assert.isDefined(moduleWithContractFromArtifact); + assert.notEqual(moduleWithContractFromArtifact, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithContractFromArtifact.id, "Module1"); @@ -105,7 +106,7 @@ describe("contractFromArtifact", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -135,7 +136,7 @@ describe("contractFromArtifact", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -159,7 +160,7 @@ describe("contractFromArtifact", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -186,7 +187,7 @@ describe("contractFromArtifact", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -210,7 +211,7 @@ describe("contractFromArtifact", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -694,13 +695,11 @@ m.contract(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.CONTRACT_DEPLOYMENT, ); - await assert.isFulfilled( - validateArtifactContractDeployment( - future as any, - setupMockArtifactResolver({ Test: fakerArtifact }), - {}, - [], - ), + await validateArtifactContractDeployment( + future as any, + setupMockArtifactResolver({ Test: fakerArtifact }), + {}, + [], ); }); @@ -760,13 +759,11 @@ m.contract(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.CONTRACT_DEPLOYMENT, ); - await assert.isFulfilled( - validateArtifactContractDeployment( - future as any, - setupMockArtifactResolver({ Test: fakerArtifact }), - {}, - [], - ), + await validateArtifactContractDeployment( + future as any, + setupMockArtifactResolver({ Test: fakerArtifact }), + {}, + [], ); }); @@ -799,13 +796,11 @@ m.contract(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.CONTRACT_DEPLOYMENT, ); - await assert.isFulfilled( - validateArtifactContractDeployment( - future as any, - setupMockArtifactResolver({ Test: fakerArtifact }), - {}, - [], - ), + await validateArtifactContractDeployment( + future as any, + setupMockArtifactResolver({ Test: fakerArtifact }), + {}, + [], ); }); diff --git a/packages/ignition-core/test/encodeFunctionCall.ts b/packages/ignition-core/test/encodeFunctionCall.ts index 61893e4411f..f00654eef9b 100644 --- a/packages/ignition-core/test/encodeFunctionCall.ts +++ b/packages/ignition-core/test/encodeFunctionCall.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { Artifact } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -30,7 +31,7 @@ describe("encodeFunctionCall", () => { return { contract1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithASingleContract.id, "Module1"); @@ -64,7 +65,7 @@ describe("encodeFunctionCall", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -104,7 +105,7 @@ describe("encodeFunctionCall", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -313,8 +314,8 @@ describe("encodeFunctionCall", () => { ({ id }) => id === "Module1#second", ); - assert.isDefined(callFuture); - assert.isDefined(callFuture2); + assert.notEqual(callFuture, undefined); + assert.notEqual(callFuture2, undefined); }); it("should throw if the same function is called twice without differentiating ids", () => { @@ -723,13 +724,11 @@ m.encodeFunctionCall(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.ENCODE_FUNCTION_CALL, ); - await assert.isFulfilled( - validateNamedEncodeFunctionCall( - future as any, - setupMockArtifactResolver({ Another: fakeArtifact }), - {}, - [], - ), + await validateNamedEncodeFunctionCall( + future as any, + setupMockArtifactResolver({ Another: fakeArtifact }), + {}, + [], ); }); @@ -766,13 +765,11 @@ m.encodeFunctionCall(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.ENCODE_FUNCTION_CALL, ); - await assert.isFulfilled( - validateNamedEncodeFunctionCall( - future as any, - setupMockArtifactResolver({ Another: fakeArtifact }), - {}, - [], - ), + await validateNamedEncodeFunctionCall( + future as any, + setupMockArtifactResolver({ Another: fakeArtifact }), + {}, + [], ); }); diff --git a/packages/ignition-core/test/execution/abi.ts b/packages/ignition-core/test/execution/abi.ts index d82a8eaa353..0fe932dc9fd 100644 --- a/packages/ignition-core/test/execution/abi.ts +++ b/packages/ignition-core/test/execution/abi.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { ethers } from "ethers"; import type { Artifact } from "../../src/types/artifact.js"; @@ -231,16 +232,19 @@ describe("abi", () => { describe("decodeArtifactFunctionCallResult", () => { function decodeResult(contractName: string, functionName: string) { - assert.isDefined( + assert.notEqual( staticCallResultFixturesArtifacts[contractName], + undefined, `No artifact for ${contractName}`, ); - assert.isDefined( + assert.notEqual( staticCallResultFixtures[contractName], + undefined, `No fixtures for ${contractName}`, ); - assert.isDefined( + assert.notEqual( staticCallResultFixtures[contractName][functionName], + undefined, `No fixtures for ${contractName}.${functionName}`, ); @@ -445,7 +449,10 @@ describe("abi", () => { const encoded = encodeArtifactDeploymentData(artifact, [], libraries); assert.notEqual(encoded, artifact.bytecode); - assert.isTrue(encoded.startsWith(linkLibraries(artifact, libraries))); + assert.equal( + encoded.startsWith(linkLibraries(artifact, libraries)), + true, + ); }); // TODO: Validate that we throw a nice error in these cases @@ -459,9 +466,17 @@ describe("abi", () => { describe("encodeArtifactFunctionCall", () => { it("Should validate function names", () => { const artifact = callEncodingFixtures.WithComplexArguments; - assert.throws(() => { - encodeArtifactFunctionCall(artifact, "nonExistent", []); - }, "Function 'nonExistent' not found in contract WithComplexArguments"); + assertThrowsHardhatError( + () => { + encodeArtifactFunctionCall(artifact, "nonExistent", []); + }, + HardhatError.ERRORS.IGNITION.VALIDATION.OVERLOAD_NOT_FOUND, + { + name: "nonExistent", + eventOrFunction: "Function", + contractName: "WithComplexArguments", + }, + ); }); it("Should encode the arguments and return them", () => { @@ -555,7 +570,7 @@ describe("abi", () => { staticCallResultFixtures.C.revertWithUnknownCustomError.returnData, ); - assert.isUndefined(decoded); + assert.equal(decoded, undefined); }); }); diff --git a/packages/ignition-core/test/execution/execution-engine.ts b/packages/ignition-core/test/execution/execution-engine.ts index e11ae324163..fd60b536f4a 100644 --- a/packages/ignition-core/test/execution/execution-engine.ts +++ b/packages/ignition-core/test/execution/execution-engine.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import path from "path"; import { ExecutionEngine } from "../../src/internal/execution/execution-engine.js"; diff --git a/packages/ignition-core/test/execution/future-processor/helpers/build-initialize-message-for.ts b/packages/ignition-core/test/execution/future-processor/helpers/build-initialize-message-for.ts index e9182dbfec6..a09e3309e13 100644 --- a/packages/ignition-core/test/execution/future-processor/helpers/build-initialize-message-for.ts +++ b/packages/ignition-core/test/execution/future-processor/helpers/build-initialize-message-for.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentLoader } from "../../../../src/internal/deployment-loader/types.js"; import { buildInitializeMessageFor } from "../../../../src/internal/execution/future-processor/helpers/build-initialize-message-for.js"; diff --git a/packages/ignition-core/test/execution/future-processor/helpers/network-interaction-execution.ts b/packages/ignition-core/test/execution/future-processor/helpers/network-interaction-execution.ts index 79aea5d723d..7b2194ada94 100644 --- a/packages/ignition-core/test/execution/future-processor/helpers/network-interaction-execution.ts +++ b/packages/ignition-core/test/execution/future-processor/helpers/network-interaction-execution.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import { monitorOnchainInteraction } from "../../../../src/internal/execution/future-processor/handlers/monitor-onchain-interaction.js"; import { decodeSimulationResult } from "../../../../src/internal/execution/future-processor/helpers/decode-simulation-result.js"; @@ -198,8 +199,8 @@ describe("Network interactions", () => { assert.equal(callParams.to, staticCall.to); assert.equal(callParams.data, staticCall.data); assert.equal(callParams.value, staticCall.value); - assert.isUndefined(callParams.fees); - assert.isUndefined(callParams.nonce); + assert.equal(callParams.fees, undefined); + assert.equal(callParams.nonce, undefined); assert.equal(blockTag, "latest"); return expectedResult; @@ -292,7 +293,7 @@ describe("Network interactions", () => { return assert.fail("No message returned from monitoring"); } - assert.isDefined(message); + assert.notEqual(message, undefined); assert.equal(message.type, JournalMessageType.TRANSACTION_CONFIRM); assert.equal(message.futureId, deploymentExecutionState.id); }); diff --git a/packages/ignition-core/test/execution/future-processor/named-contract-at-deploy.ts b/packages/ignition-core/test/execution/future-processor/named-contract-at-deploy.ts index 8e1bd75b0b5..a7ed3e828d4 100644 --- a/packages/ignition-core/test/execution/future-processor/named-contract-at-deploy.ts +++ b/packages/ignition-core/test/execution/future-processor/named-contract-at-deploy.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { NamedArtifactContractAtFuture } from "../../../src/index.js"; import { deploymentStateReducer } from "../../../src/internal/execution/reducers/deployment-state-reducer.js"; diff --git a/packages/ignition-core/test/execution/future-processor/named-contract-deploy.ts b/packages/ignition-core/test/execution/future-processor/named-contract-deploy.ts index da8553c1d59..ea37273a81c 100644 --- a/packages/ignition-core/test/execution/future-processor/named-contract-deploy.ts +++ b/packages/ignition-core/test/execution/future-processor/named-contract-deploy.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { NamedArtifactContractDeploymentFuture } from "../../../src/index.js"; import type { TransactionParams } from "../../../src/internal/execution/jsonrpc-client.js"; diff --git a/packages/ignition-core/test/execution/libraries.ts b/packages/ignition-core/test/execution/libraries.ts index ae492a3ec5a..214bc13a06c 100644 --- a/packages/ignition-core/test/execution/libraries.ts +++ b/packages/ignition-core/test/execution/libraries.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { linkLibraries, @@ -36,9 +37,9 @@ describe("Libraries handling", () => { ).map((e) => e.message); assert(error !== undefined); - assert.include(error, `The name "Lib" is ambiguous`); - assert.include(error, `contracts/C.sol:Lib`); - assert.include(error, `contracts/Libs.sol:Lib`); + assert.ok(error.includes(`The name "Lib" is ambiguous`)); + assert.ok(error.includes(`contracts/C.sol:Lib`)); + assert.ok(error.includes(`contracts/Libs.sol:Lib`)); }); it("Should throw if a library is missing", () => { @@ -48,8 +49,8 @@ describe("Libraries handling", () => { ).map((e) => e.message); assert(error !== undefined); - assert.include(error, `The following libraries are missing:`); - assert.include(error, `contracts/C.sol:Lib`); + assert.ok(error.includes(`The following libraries are missing:`)); + assert.ok(error.includes(`contracts/C.sol:Lib`)); }); it("Should throw if a name is used twice, as FQN and bare name", () => { @@ -104,8 +105,8 @@ describe("Libraries handling", () => { ); // We don't really validate if they were linked correctly here - assert.include(linkedBytecode, mockAddress.slice(2)); - assert.include(linkedBytecode, mockAddress2.slice(2)); + assert.ok(linkedBytecode.includes(mockAddress.slice(2))); + assert.ok(linkedBytecode.includes(mockAddress2.slice(2))); }); it("Should link by bare name", () => { @@ -116,7 +117,7 @@ describe("Libraries handling", () => { }, ); - assert.include(linkedBytecode, mockAddress.slice(2)); + assert.ok(linkedBytecode.includes(mockAddress.slice(2))); const firstRef = deploymentFixturesArtifacts.WithLibrary.linkReferences[ diff --git a/packages/ignition-core/test/execution/nonce-management/get-nonce-sync-messages.ts b/packages/ignition-core/test/execution/nonce-management/get-nonce-sync-messages.ts index 4fd4530a06a..b09c8f92fb0 100644 --- a/packages/ignition-core/test/execution/nonce-management/get-nonce-sync-messages.ts +++ b/packages/ignition-core/test/execution/nonce-management/get-nonce-sync-messages.ts @@ -3,7 +3,8 @@ import { HardhatError, } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import { FutureType, diff --git a/packages/ignition-core/test/execution/nonce-management/json-rpc-nonce-manager.ts b/packages/ignition-core/test/execution/nonce-management/json-rpc-nonce-manager.ts index 241a8154075..c19c2a8713d 100644 --- a/packages/ignition-core/test/execution/nonce-management/json-rpc-nonce-manager.ts +++ b/packages/ignition-core/test/execution/nonce-management/json-rpc-nonce-manager.ts @@ -2,7 +2,8 @@ import type { JsonRpcClient } from "../../../src/internal/execution/jsonrpc-clie import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { JsonRpcNonceManager } from "../../../src/internal/execution/nonce-management/json-rpc-nonce-manager.js"; diff --git a/packages/ignition-core/test/execution/reducers/running-a-call.ts b/packages/ignition-core/test/execution/reducers/running-a-call.ts index e97ce769291..2209b8bfd00 100644 --- a/packages/ignition-core/test/execution/reducers/running-a-call.ts +++ b/packages/ignition-core/test/execution/reducers/running-a-call.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { EvmExecutionResultTypes } from "../../../src/internal/execution/types/evm-execution.js"; @@ -225,10 +226,10 @@ describe("DeploymentStateReducer", () => { rest, requestNetworkInteractionMessage.networkInteraction, ); - assert.isArray(transactions); - assert.lengthOf(transactions, 0); - assert.isFalse(shouldBeResent); - assert.isUndefined(nonce); + assert.ok(Array.isArray(transactions)); + assert.equal(transactions.length, 0); + assert.equal(shouldBeResent, false); + assert.equal(nonce, undefined); }); }); diff --git a/packages/ignition-core/test/execution/reducers/running-a-named-contract-deploy.ts b/packages/ignition-core/test/execution/reducers/running-a-named-contract-deploy.ts index fdb254014c2..a4e074e5986 100644 --- a/packages/ignition-core/test/execution/reducers/running-a-named-contract-deploy.ts +++ b/packages/ignition-core/test/execution/reducers/running-a-named-contract-deploy.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { EvmExecutionResultTypes } from "../../../src/internal/execution/types/evm-execution.js"; @@ -231,10 +232,10 @@ describe("DeploymentStateReducer", () => { rest, requestNetworkInteractionMessage.networkInteraction, ); - assert.isArray(transactions); - assert.lengthOf(transactions, 0); - assert.isFalse(shouldBeResent); - assert.isUndefined(nonce); + assert.ok(Array.isArray(transactions)); + assert.equal(transactions.length, 0); + assert.equal(shouldBeResent, false); + assert.equal(nonce, undefined); }); }); diff --git a/packages/ignition-core/test/execution/reducers/running-a-named-library-deploy.ts b/packages/ignition-core/test/execution/reducers/running-a-named-library-deploy.ts index 5d20aae6d5d..d685e3d7532 100644 --- a/packages/ignition-core/test/execution/reducers/running-a-named-library-deploy.ts +++ b/packages/ignition-core/test/execution/reducers/running-a-named-library-deploy.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/execution/reducers/running-a-read-event-arg.ts b/packages/ignition-core/test/execution/reducers/running-a-read-event-arg.ts index 0859006b317..8f6aaddf121 100644 --- a/packages/ignition-core/test/execution/reducers/running-a-read-event-arg.ts +++ b/packages/ignition-core/test/execution/reducers/running-a-read-event-arg.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { diff --git a/packages/ignition-core/test/execution/reducers/running-a-static-call.ts b/packages/ignition-core/test/execution/reducers/running-a-static-call.ts index a94e0aaf12e..e65688d8800 100644 --- a/packages/ignition-core/test/execution/reducers/running-a-static-call.ts +++ b/packages/ignition-core/test/execution/reducers/running-a-static-call.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { EvmExecutionResultTypes } from "../../../src/internal/execution/types/evm-execution.js"; diff --git a/packages/ignition-core/test/execution/reducers/running-contract-at.ts b/packages/ignition-core/test/execution/reducers/running-contract-at.ts index 5f31b56b027..4a02ef119f0 100644 --- a/packages/ignition-core/test/execution/reducers/running-contract-at.ts +++ b/packages/ignition-core/test/execution/reducers/running-contract-at.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { diff --git a/packages/ignition-core/test/execution/reducers/running-send-data.ts b/packages/ignition-core/test/execution/reducers/running-send-data.ts index c465148bf24..c10c578c94f 100644 --- a/packages/ignition-core/test/execution/reducers/running-send-data.ts +++ b/packages/ignition-core/test/execution/reducers/running-send-data.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; import { EvmExecutionResultTypes } from "../../../src/internal/execution/types/evm-execution.js"; @@ -213,10 +214,10 @@ describe("DeploymentStateReducer", () => { rest, requestNetworkInteractionMessage.networkInteraction, ); - assert.isArray(transactions); - assert.lengthOf(transactions, 0); - assert.isFalse(shouldBeResent); - assert.isUndefined(nonce); + assert.ok(Array.isArray(transactions)); + assert.equal(transactions.length, 0); + assert.equal(shouldBeResent, false); + assert.equal(nonce, undefined); }); }); diff --git a/packages/ignition-core/test/execution/reducers/start-a-new-run.ts b/packages/ignition-core/test/execution/reducers/start-a-new-run.ts index d74cef9aef3..64c6e9d919d 100644 --- a/packages/ignition-core/test/execution/reducers/start-a-new-run.ts +++ b/packages/ignition-core/test/execution/reducers/start-a-new-run.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import { deploymentStateReducer } from "../../../src/internal/execution/reducers/deployment-state-reducer.js"; import type { DeploymentState } from "../../../src/internal/execution/types/deployment-state.js"; diff --git a/packages/ignition-core/test/execution/utils/convert-evm-tuple-to-solidity-param.ts b/packages/ignition-core/test/execution/utils/convert-evm-tuple-to-solidity-param.ts index 83bc18df4ae..161e07fcaab 100644 --- a/packages/ignition-core/test/execution/utils/convert-evm-tuple-to-solidity-param.ts +++ b/packages/ignition-core/test/execution/utils/convert-evm-tuple-to-solidity-param.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { EvmTuple } from "../../../src/internal/execution/types/evm-execution.js"; import { convertEvmTupleToSolidityParam } from "../../../src/internal/execution/utils/convert-evm-tuple-to-solidity-param.js"; diff --git a/packages/ignition-core/test/execution/views/find-result-for-future-by-id.ts b/packages/ignition-core/test/execution/views/find-result-for-future-by-id.ts index 7c454d31da8..b6c0ed31fae 100644 --- a/packages/ignition-core/test/execution/views/find-result-for-future-by-id.ts +++ b/packages/ignition-core/test/execution/views/find-result-for-future-by-id.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; import { ExecutionSateType } from "../../../src/internal/execution/types/execution-state.js"; diff --git a/packages/ignition-core/test/getAccount.ts b/packages/ignition-core/test/getAccount.ts index cdb111692b3..2de51f45cc0 100644 --- a/packages/ignition-core/test/getAccount.ts +++ b/packages/ignition-core/test/getAccount.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; import { AccountRuntimeValueImplementation } from "../src/internal/module.js"; diff --git a/packages/ignition-core/test/getParameter.ts b/packages/ignition-core/test/getParameter.ts index 8189c13994e..a71c5f8e6c9 100644 --- a/packages/ignition-core/test/getParameter.ts +++ b/packages/ignition-core/test/getParameter.ts @@ -1,7 +1,11 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; -import { ModuleParameterRuntimeValueImplementation } from "../src/internal/module.js"; +import { + AccountRuntimeValueImplementation, + ModuleParameterRuntimeValueImplementation, +} from "../src/internal/module.js"; import type { SolidityParameterType } from "../src/types/module.js"; import { assertInstanceOf } from "./helpers.js"; @@ -121,10 +125,10 @@ describe("getParameter", () => { const param = mod.results.contract.constructorArgs[0]; assertInstanceOf(param, ModuleParameterRuntimeValueImplementation); assert.equal(param.name, "p"); - assert.deepEqual(param.defaultValue, { - accountIndex: 1, - type: "ACCOUNT", - }); + assert.deepEqual( + param.defaultValue, + new AccountRuntimeValueImplementation(1), + ); }); }); }); diff --git a/packages/ignition-core/test/helpers.ts b/packages/ignition-core/test/helpers.ts index b891b3d5596..134712d337d 100644 --- a/packages/ignition-core/test/helpers.ts +++ b/packages/ignition-core/test/helpers.ts @@ -1,4 +1,4 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; import type { Artifact, ArtifactResolver } from "../src/index.js"; import { DeploymentLoader } from "../src/internal/deployment-loader/types.js"; @@ -16,17 +16,14 @@ export function assertValidationError( errors: string[], expectedError: string, ): void { - assert.includeMembers( - errors.map((e) => e.split(/^\w+\d+: /)[1]), - [expectedError], - ); + assert.ok(errors.map((e) => e.split(/^\w+\d+: /)[1]).includes(expectedError)); } export function assertInstanceOf( obj: unknown, klass: new (...args: any[]) => ObjectT, ): asserts obj is ObjectT { - assert.instanceOf(obj, klass, `Not a valid instance of ${klass.name}`); + assert.ok(obj instanceof klass, `Not a valid instance of ${klass.name}`); } export const fakeArtifact: Artifact = { diff --git a/packages/ignition-core/test/ignition-module-serializer.ts b/packages/ignition-core/test/ignition-module-serializer.ts index 6d76df3b3f8..2d5a7b7ea5e 100644 --- a/packages/ignition-core/test/ignition-module-serializer.ts +++ b/packages/ignition-core/test/ignition-module-serializer.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; import { diff --git a/packages/ignition-core/test/library.ts b/packages/ignition-core/test/library.ts index 54b3773c6ec..fb422818495 100644 --- a/packages/ignition-core/test/library.ts +++ b/packages/ignition-core/test/library.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; import { @@ -25,7 +26,7 @@ describe("library", () => { return { library1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); // Sets ids based on module id and library name assert.equal(moduleWithASingleContract.id, "Module1"); @@ -58,7 +59,7 @@ describe("library", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -89,7 +90,7 @@ describe("library", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -119,7 +120,7 @@ describe("library", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -143,7 +144,7 @@ describe("library", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", diff --git a/packages/ignition-core/test/libraryFromArtifact.ts b/packages/ignition-core/test/libraryFromArtifact.ts index 29b6d5318d1..d894d872021 100644 --- a/packages/ignition-core/test/libraryFromArtifact.ts +++ b/packages/ignition-core/test/libraryFromArtifact.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; import { @@ -25,7 +26,7 @@ describe("libraryFromArtifact", () => { return { library1 }; }); - assert.isDefined(moduleWithContractFromArtifact); + assert.notEqual(moduleWithContractFromArtifact, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithContractFromArtifact.id, "Module1"); @@ -76,7 +77,7 @@ describe("libraryFromArtifact", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -106,7 +107,7 @@ describe("libraryFromArtifact", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", @@ -130,7 +131,7 @@ describe("libraryFromArtifact", () => { return { another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const anotherFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Another", diff --git a/packages/ignition-core/test/list-transactions.ts b/packages/ignition-core/test/list-transactions.ts index 2eca1b83b6c..cf3128462d1 100644 --- a/packages/ignition-core/test/list-transactions.ts +++ b/packages/ignition-core/test/list-transactions.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import path from "path"; import { diff --git a/packages/ignition-core/test/listDeployments.ts b/packages/ignition-core/test/listDeployments.ts index 22115598ccd..1ef493c575b 100644 --- a/packages/ignition-core/test/listDeployments.ts +++ b/packages/ignition-core/test/listDeployments.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import path from "node:path"; import { listDeployments } from "../src/index.js"; diff --git a/packages/ignition-core/test/readEventArgument.ts b/packages/ignition-core/test/readEventArgument.ts index f4bc8b50d8f..d7a255c5f03 100644 --- a/packages/ignition-core/test/readEventArgument.ts +++ b/packages/ignition-core/test/readEventArgument.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { type Artifact, @@ -166,8 +167,8 @@ describe("Read event argument", () => { assert.equal(mod.id, "Module1"); const futuresIds = Array.from(mod.futures).map((f) => f.id); - assert.include(futuresIds, "Module1#Main.EventName.arg1.0"); - assert.include(futuresIds, "Module1#Emitter.EventName2.arg2.1"); + assert.ok(futuresIds.includes("Module1#Main.EventName.arg1.0")); + assert.ok(futuresIds.includes("Module1#Emitter.EventName2.arg2.1")); }); it("should be able to read the same argument twice by passing a explicit id", () => { @@ -190,8 +191,8 @@ describe("Read event argument", () => { moduleWithSameReadEventArgumentTwice.futures, ).map((f) => f.id); - assert.include(futuresIds, "Module1#Example.EventName.arg1.0"); - assert.include(futuresIds, "Module1#second"); + assert.ok(futuresIds.includes("Module1#Example.EventName.arg1.0")); + assert.ok(futuresIds.includes("Module1#second")); }); it("should throw if the same read event argument is done twice without differentiating ids", () => { diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractAt.ts b/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractAt.ts index 6fe1088f62f..7994f80a73c 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractAt.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractAt.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractDeployment.ts b/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractDeployment.ts index a795209f0db..552c6a01cf1 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractDeployment.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileArtifactContractDeployment.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileArtifactLibraryDeployment.ts b/packages/ignition-core/test/reconciliation/futures/reconcileArtifactLibraryDeployment.ts index a12fbe081c5..758ff367b88 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileArtifactLibraryDeployment.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileArtifactLibraryDeployment.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractAt.ts b/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractAt.ts index 40bdff28fae..2c6eb8a497b 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractAt.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractAt.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractCall.ts b/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractCall.ts index 869857a4ade..1ba85b5e044 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractCall.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractCall.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractDeployment.ts b/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractDeployment.ts index 559c8631f28..8717c50aee1 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractDeployment.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileNamedContractDeployment.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileNamedEncodeFunctionCall.ts b/packages/ignition-core/test/reconciliation/futures/reconcileNamedEncodeFunctionCall.ts index 6e2f8480b09..fbb3e243c4d 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileNamedEncodeFunctionCall.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileNamedEncodeFunctionCall.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileNamedLibraryDeployment.ts b/packages/ignition-core/test/reconciliation/futures/reconcileNamedLibraryDeployment.ts index 6bbaac860ee..f3a73cbf711 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileNamedLibraryDeployment.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileNamedLibraryDeployment.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileNamedStaticCall.ts b/packages/ignition-core/test/reconciliation/futures/reconcileNamedStaticCall.ts index b4f61762477..503b321fafc 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileNamedStaticCall.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileNamedStaticCall.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileReadEventArgument.ts b/packages/ignition-core/test/reconciliation/futures/reconcileReadEventArgument.ts index 0a68f10adbd..6438b850c6c 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileReadEventArgument.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileReadEventArgument.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { ExecutionResultType } from "../../../src/internal/execution/types/execution-result.js"; diff --git a/packages/ignition-core/test/reconciliation/futures/reconcileSendData.ts b/packages/ignition-core/test/reconciliation/futures/reconcileSendData.ts index 32335800558..8f3be4feb33 100644 --- a/packages/ignition-core/test/reconciliation/futures/reconcileSendData.ts +++ b/packages/ignition-core/test/reconciliation/futures/reconcileSendData.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../../src/build-module.js"; import { diff --git a/packages/ignition-core/test/reconciliation/helpers.ts b/packages/ignition-core/test/reconciliation/helpers.ts index 39649dd657b..8a96be89781 100644 --- a/packages/ignition-core/test/reconciliation/helpers.ts +++ b/packages/ignition-core/test/reconciliation/helpers.ts @@ -1,4 +1,4 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; import type { Artifact, diff --git a/packages/ignition-core/test/reconciliation/reconciler.ts b/packages/ignition-core/test/reconciliation/reconciler.ts index 4abf8fc187e..9be86001824 100644 --- a/packages/ignition-core/test/reconciliation/reconciler.ts +++ b/packages/ignition-core/test/reconciliation/reconciler.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../src/build-module.js"; import { diff --git a/packages/ignition-core/test/send.ts b/packages/ignition-core/test/send.ts index e6f4b88c603..3dfc7d253dd 100644 --- a/packages/ignition-core/test/send.ts +++ b/packages/ignition-core/test/send.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../src/build-module.js"; import { @@ -30,7 +31,7 @@ describe("send", () => { return {}; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); // 1 contract future & 1 call future assert.equal(moduleWithASingleContract.futures.size, 1); @@ -61,7 +62,7 @@ describe("send", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -94,7 +95,7 @@ describe("send", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -120,7 +121,7 @@ describe("send", () => { return {}; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const sendFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#test_send", @@ -140,7 +141,7 @@ describe("send", () => { return {}; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const sendFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#test_send", @@ -163,7 +164,7 @@ describe("send", () => { return {}; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const sendFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#test_send", @@ -183,7 +184,7 @@ describe("send", () => { return {}; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const sendFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#test_send", @@ -204,7 +205,7 @@ describe("send", () => { return {}; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const sendFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#test_send", @@ -255,7 +256,7 @@ describe("send", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#encodeFunctionCall(Module1#Example.test)", @@ -298,8 +299,8 @@ describe("send", () => { ({ id }) => id === "Module1#second", ); - assert.isDefined(sendFuture); - assert.isDefined(sendFuture2); + assert.notEqual(sendFuture, undefined); + assert.notEqual(sendFuture2, undefined); }); it("should throw if the same function is called twice without differentiating ids", () => { diff --git a/packages/ignition-core/test/setup.ts b/packages/ignition-core/test/setup.ts deleted file mode 100644 index 7b2c94ba8ca..00000000000 --- a/packages/ignition-core/test/setup.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { use } from "chai"; -import chaiAsPromised from "chai-as-promised"; - -use(chaiAsPromised); diff --git a/packages/ignition-core/test/staticCall.ts b/packages/ignition-core/test/staticCall.ts index ec577b85735..a9e65586677 100644 --- a/packages/ignition-core/test/staticCall.ts +++ b/packages/ignition-core/test/staticCall.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { Artifact } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -31,7 +32,7 @@ describe("static call", () => { return { contract1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); // Sets ids based on module id and contract name assert.equal(moduleWithASingleContract.id, "Module1"); @@ -65,7 +66,7 @@ describe("static call", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -103,7 +104,7 @@ describe("static call", () => { return { example, another }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const exampleFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example", @@ -138,7 +139,7 @@ describe("static call", () => { return { contract1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); const staticCallFuture = [...moduleWithASingleContract.futures].find( ({ id }) => id === "Module1#Contract1.test", @@ -166,7 +167,7 @@ describe("static call", () => { return { contract1 }; }); - assert.isDefined(moduleWithASingleContract); + assert.notEqual(moduleWithASingleContract, undefined); const staticCallFuture = [...moduleWithASingleContract.futures].find( ({ id }) => id === "Module1#Contract1.test", @@ -197,7 +198,7 @@ describe("static call", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const callFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example.test", @@ -219,7 +220,7 @@ describe("static call", () => { return { example }; }); - assert.isDefined(moduleWithDependentContracts); + assert.notEqual(moduleWithDependentContracts, undefined); const callFuture = [...moduleWithDependentContracts.futures].find( ({ id }) => id === "Module1#Example.test", @@ -418,12 +419,12 @@ describe("static call", () => { ({ id }) => id === "Module1#second", ); - assert.isDefined(callFuture); - assert.isDefined(callFuture2); + assert.notEqual(callFuture, undefined); + assert.notEqual(callFuture2, undefined); }); it("should throw if the same function is statically called twice without differentiating ids", () => { - assert.throws( + assertThrowsHardhatError( () => buildModule("Module1", (m) => { const sameContract1 = m.contract("SameContract"); @@ -432,14 +433,17 @@ describe("static call", () => { return { sameContract1 }; }), - `The autogenerated future id ("Module1#SameContract.test") is already used. Please provide a unique id, as shown below: + HardhatError.ERRORS.IGNITION.VALIDATION.INVALID_MODULE, + { + message: `The autogenerated future id ("Module1#SameContract.test") is already used. Please provide a unique id, as shown below: m.staticCall(..., { id: "MyUniqueId"})`, + }, ); }); it("should throw if a static call tries to pass the same id twice", () => { - assert.throws( + assertThrowsHardhatError( () => buildModule("Module1", (m) => { const sameContract1 = m.contract("SameContract"); @@ -447,7 +451,11 @@ m.staticCall(..., { id: "MyUniqueId"})`, m.staticCall(sameContract1, "test", [], 0, { id: "first" }); return { sameContract1 }; }), - 'The future id "first" is already used, please provide a different one.', + HardhatError.ERRORS.IGNITION.VALIDATION.INVALID_MODULE, + { + message: + 'The future id "first" is already used, please provide a different one.', + }, ); }); }); @@ -986,13 +994,11 @@ m.staticCall(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.STATIC_CALL, ); - await assert.isFulfilled( - validateNamedStaticCall( - future as any, - setupMockArtifactResolver({ Another: fakerArtifact }), - {}, - [], - ), + await validateNamedStaticCall( + future as any, + setupMockArtifactResolver({ Another: fakerArtifact }), + {}, + [], ); }); @@ -1029,13 +1035,11 @@ m.staticCall(..., { id: "MyUniqueId"})`, (v) => v.type === FutureType.STATIC_CALL, ); - await assert.isFulfilled( - validateNamedStaticCall( - future as any, - setupMockArtifactResolver({ Another: fakeArtifact }), - {}, - [], - ), + await validateNamedStaticCall( + future as any, + setupMockArtifactResolver({ Another: fakeArtifact }), + {}, + [], ); }); diff --git a/packages/ignition-core/test/status.ts b/packages/ignition-core/test/status.ts index 02d7a786a2e..1acbb80c6af 100644 --- a/packages/ignition-core/test/status.ts +++ b/packages/ignition-core/test/status.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import path from "path"; import { status } from "../src/index.js"; diff --git a/packages/ignition-core/test/track-transaction.ts b/packages/ignition-core/test/track-transaction.ts index 8ced8c191db..e680d3d3d0c 100644 --- a/packages/ignition-core/test/track-transaction.ts +++ b/packages/ignition-core/test/track-transaction.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import path from "path"; import { diff --git a/packages/ignition-core/test/types/deployment-loader.ts b/packages/ignition-core/test/types/deployment-loader.ts index ea8bfa7246d..060c7b9611a 100644 --- a/packages/ignition-core/test/types/deployment-loader.ts +++ b/packages/ignition-core/test/types/deployment-loader.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { EphemeralDeploymentLoader } from "../../src/internal/deployment-loader/ephemeral-deployment-loader.js"; import { FileDeploymentLoader } from "../../src/internal/deployment-loader/file-deployment-loader.js"; @@ -16,7 +17,7 @@ describe("DeploymentLoaderImpls", function () { Omit > = new FileDeploymentLoader("./example"); - assert.isDefined(_implementation); + assert.notEqual(_implementation, undefined); }); }); @@ -27,7 +28,7 @@ describe("DeploymentLoaderImpls", function () { EphemeralDeploymentLoader > = new EphemeralDeploymentLoader(setupMockArtifactResolver()); - assert.isDefined(_implementation); + assert.notEqual(_implementation, undefined); }); }); }); diff --git a/packages/ignition-core/test/useModule.ts b/packages/ignition-core/test/useModule.ts index a39048e5af9..81198bf50fc 100644 --- a/packages/ignition-core/test/useModule.ts +++ b/packages/ignition-core/test/useModule.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { type Artifact, DeploymentResultType } from "../src/index.js"; import { buildModule } from "../src/build-module.js"; @@ -126,17 +127,15 @@ describe("useModule", () => { }, }; - await assert.isFulfilled( - validate( - moduleWithSubmodule, - setupMockArtifactResolver({ - Contract1: fakerArtifact, - Contract2: fakerArtifact, - Contract3: fakerArtifact, - }), - moduleParams, - [], - ), + await validate( + moduleWithSubmodule, + setupMockArtifactResolver({ + Contract1: fakerArtifact, + Contract2: fakerArtifact, + Contract3: fakerArtifact, + }), + moduleParams, + [], ); }); diff --git a/packages/ignition-core/test/utils/adjacency-list.ts b/packages/ignition-core/test/utils/adjacency-list.ts index 1ea7b9a1be6..418e4662dee 100644 --- a/packages/ignition-core/test/utils/adjacency-list.ts +++ b/packages/ignition-core/test/utils/adjacency-list.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { AdjacencyList } from "../../src/internal/utils/adjacency-list.js"; diff --git a/packages/ignition-core/test/utils/check-automined-network.ts b/packages/ignition-core/test/utils/check-automined-network.ts index 5e48d13757c..9c9fc6dc869 100644 --- a/packages/ignition-core/test/utils/check-automined-network.ts +++ b/packages/ignition-core/test/utils/check-automined-network.ts @@ -1,30 +1,35 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { checkAutominedNetwork } from "../../src/internal/utils/check-automined-network.js"; import type { EIP1193Provider } from "../../src/types/provider.js"; describe("check-automin-network", () => { it("should confirm a Hardhat network that has automining enabled", async () => - assert.isTrue( + assert.equal( await checkAutominedNetwork(setupMockProvider("hardhat", true)), + true, "Hardhat network should have automining enabled", )); it("should indicate a Hardhat network that has automining disabled", async () => - assert.isFalse( + assert.equal( await checkAutominedNetwork(setupMockProvider("hardhat", false)), + false, "Hardhat network should _not_ have automining enabled", )); it("should confirm a ganache network", async () => - assert.isTrue( + assert.equal( await checkAutominedNetwork(setupMockProvider("ganache")), + true, "Ganache networks should have automining enabled", )); it("should indicate not an automining network for other networks", async () => - assert.isFalse( + assert.equal( await checkAutominedNetwork(setupMockProvider("other")), + false, "Other network should _not_ have automining enabled", )); }); diff --git a/packages/ignition-core/test/utils/future-id-builders.ts b/packages/ignition-core/test/utils/future-id-builders.ts index b94256778cc..0b0329ce30b 100644 --- a/packages/ignition-core/test/utils/future-id-builders.ts +++ b/packages/ignition-core/test/utils/future-id-builders.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { toCallFutureId, diff --git a/packages/ignition-core/test/utils/replace-within-arg.ts b/packages/ignition-core/test/utils/replace-within-arg.ts index 3bf9bcaa4df..ca8d282eaa7 100644 --- a/packages/ignition-core/test/utils/replace-within-arg.ts +++ b/packages/ignition-core/test/utils/replace-within-arg.ts @@ -1,4 +1,5 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it, beforeEach } from "node:test"; import { type ArgumentType, diff --git a/packages/ignition-core/test/validations/id-rules.ts b/packages/ignition-core/test/validations/id-rules.ts index bdaffc71ea2..fdfda4dd9b8 100644 --- a/packages/ignition-core/test/validations/id-rules.ts +++ b/packages/ignition-core/test/validations/id-rules.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertThrowsHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { buildModule } from "../../src/build-module.js"; import { fakeArtifact } from "../helpers.js"; diff --git a/packages/ignition-core/test/validations/identifier-validators.ts b/packages/ignition-core/test/validations/identifier-validators.ts index ed86dc27c9e..8d21f340601 100644 --- a/packages/ignition-core/test/validations/identifier-validators.ts +++ b/packages/ignition-core/test/validations/identifier-validators.ts @@ -1,31 +1,35 @@ -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { isValidFunctionOrEventName } from "../../src/internal/utils/identifier-validators.js"; describe("isValidFunctionOrEventName", () => { it("should return true for valid solidity function names", () => { - assert.isTrue(isValidFunctionOrEventName("a")); - assert.isTrue(isValidFunctionOrEventName("aa")); - assert.isTrue(isValidFunctionOrEventName("a1")); - assert.isTrue(isValidFunctionOrEventName("myFunction")); - assert.isTrue(isValidFunctionOrEventName("myFunction()")); - assert.isTrue(isValidFunctionOrEventName("myFunction123()")); - assert.isTrue(isValidFunctionOrEventName("myFunction(uint256)")); - assert.isTrue(isValidFunctionOrEventName("myFunction(uint256)")); - assert.isTrue(isValidFunctionOrEventName("myFunction(uint256,bool)")); - assert.isTrue(isValidFunctionOrEventName("myFunction(uint256[])")); - assert.isTrue(isValidFunctionOrEventName("myFunction(uint256[],bool)")); + assert.equal(isValidFunctionOrEventName("a"), true); + assert.equal(isValidFunctionOrEventName("aa"), true); + assert.equal(isValidFunctionOrEventName("a1"), true); + assert.equal(isValidFunctionOrEventName("myFunction"), true); + assert.equal(isValidFunctionOrEventName("myFunction()"), true); + assert.equal(isValidFunctionOrEventName("myFunction123()"), true); + assert.equal(isValidFunctionOrEventName("myFunction(uint256)"), true); + assert.equal(isValidFunctionOrEventName("myFunction(uint256)"), true); + assert.equal(isValidFunctionOrEventName("myFunction(uint256,bool)"), true); + assert.equal(isValidFunctionOrEventName("myFunction(uint256[])"), true); + assert.equal( + isValidFunctionOrEventName("myFunction(uint256[],bool)"), + true, + ); }); it("should return false for invalid solidity function names", () => { - assert.isFalse(isValidFunctionOrEventName("1")); - assert.isFalse(isValidFunctionOrEventName("11")); - assert.isFalse(isValidFunctionOrEventName("123myFunction")); - assert.isFalse(isValidFunctionOrEventName("myFunction(")); - assert.isFalse(isValidFunctionOrEventName("myFunction(uint)256")); - assert.isFalse(isValidFunctionOrEventName("myFunction(uint256")); - assert.isFalse(isValidFunctionOrEventName("myFunctionuint256)")); - assert.isFalse(isValidFunctionOrEventName("(uint256)")); - assert.isFalse(isValidFunctionOrEventName("123(uint256)")); + assert.equal(isValidFunctionOrEventName("1"), false); + assert.equal(isValidFunctionOrEventName("11"), false); + assert.equal(isValidFunctionOrEventName("123myFunction"), false); + assert.equal(isValidFunctionOrEventName("myFunction("), false); + assert.equal(isValidFunctionOrEventName("myFunction(uint)256"), false); + assert.equal(isValidFunctionOrEventName("myFunction(uint256"), false); + assert.equal(isValidFunctionOrEventName("myFunctionuint256)"), false); + assert.equal(isValidFunctionOrEventName("(uint256)"), false); + assert.equal(isValidFunctionOrEventName("123(uint256)"), false); }); }); diff --git a/packages/ignition-core/test/verify.ts b/packages/ignition-core/test/verify.ts index b2951b13cb7..93edc8d2ae9 100644 --- a/packages/ignition-core/test/verify.ts +++ b/packages/ignition-core/test/verify.ts @@ -3,7 +3,8 @@ import { fileURLToPath } from "node:url"; import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { type VerifyResult, getVerificationInformation } from "../src/index.js"; @@ -98,9 +99,8 @@ describe("verify", () => { for await (const info of getVerificationInformation(deploymentDir)) { // Note: the library in this test is called UUUUU assert(typeof info !== "string", "Expected a VerifyInfo, got a string"); - assert.notInclude( - info.contract, - "contracts/Lib.sol:contracts/Lib.sol:", + assert.ok( + !info.contract.includes("contracts/Lib.sol:contracts/Lib.sol:"), "Source name should not be duplicated in the contract FQN", ); if (info.contract.endsWith(":UUUUU")) { @@ -108,7 +108,7 @@ describe("verify", () => { sawLibrary = true; } } - assert.isTrue(sawLibrary, "Expected to find the UUUUU library entry"); + assert.equal(sawLibrary, true, "Expected to find the UUUUU library entry"); }); it("should yield a verify result for contract with libraries", async () => { @@ -129,6 +129,6 @@ describe("verify", () => { } } - assert.isTrue(success); + assert.equal(success, true); }); }); diff --git a/packages/ignition-core/test/wipe.ts b/packages/ignition-core/test/wipe.ts index 6b2f4205c6a..452de06d81e 100644 --- a/packages/ignition-core/test/wipe.ts +++ b/packages/ignition-core/test/wipe.ts @@ -1,6 +1,7 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors"; import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; -import { assert } from "chai"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import type { ArtifactResolver } from "../src/index.js"; import { EphemeralDeploymentLoader } from "../src/internal/deployment-loader/ephemeral-deployment-loader.js"; @@ -74,13 +75,13 @@ describe("wipe", () => { deploymentLoader, ); - assert.isDefined(deploymentState.executionStates[contract1Id]); + assert.notEqual(deploymentState.executionStates[contract1Id], undefined); const wiper = new Wiper(deploymentLoader); deploymentState = await wiper.wipe(contract1Id); - assert.isUndefined(deploymentState.executionStates[contract1Id]); + assert.equal(deploymentState.executionStates[contract1Id], undefined); }); it("should error if the deployment hasn't been initialized", async () => { @@ -137,8 +138,8 @@ describe("wipe", () => { deploymentLoader, ); - assert.isDefined(deploymentState.executionStates[contract1Id]); - assert.isDefined(deploymentState.executionStates[contract2Id]); + assert.notEqual(deploymentState.executionStates[contract1Id], undefined); + assert.notEqual(deploymentState.executionStates[contract2Id], undefined); const wiper = new Wiper(deploymentLoader); diff --git a/packages/ignition-core/tsconfig.json b/packages/ignition-core/tsconfig.json index 90648acf218..bf6eaa7aa37 100644 --- a/packages/ignition-core/tsconfig.json +++ b/packages/ignition-core/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../config/tsconfig.base.json", "compilerOptions": { - "types": ["node", "mocha"] + "types": ["node"] }, "references": [ { "path": "../hardhat" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5d538fa59ad..614369c0345 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1923,39 +1923,27 @@ importers: specifier: 2.0.0 version: 2.0.0 devDependencies: - '@istanbuljs/nyc-config-typescript': - specifier: 1.0.2 - version: 1.0.2(nyc@18.0.0(supports-color@8.1.1)) '@microsoft/api-extractor': specifier: 7.60.1 version: 7.60.1(@types/node@22.20.5) + '@nomicfoundation/hardhat-node-test-reporter': + specifier: workspace:^3.1.0 + version: link:../hardhat-node-test-reporter '@nomicfoundation/hardhat-test-utils': specifier: workspace:^ version: link:../hardhat-test-utils - '@types/chai': - specifier: ^5.2.3 - version: 5.2.3 - '@types/chai-as-promised': - specifier: ^8.0.1 - version: 8.0.2 '@types/lodash-es': specifier: ^4.17.12 version: 4.17.12 - '@types/mocha': - specifier: '>=10.0.10' - version: 10.0.10 '@types/ndjson': specifier: 2.0.4 version: 2.0.4 '@types/node': specifier: ^22.0.0 version: 22.20.5 - chai: - specifier: ^6.2.2 - version: 6.3.0 - chai-as-promised: - specifier: ^8.0.0 - version: 8.0.2(chai@6.3.0) + c8: + specifier: ^12.0.0 + version: 12.0.0 cross-env: specifier: 10.1.0 version: 10.1.0 @@ -1965,12 +1953,6 @@ importers: hardhat: specifier: workspace:^3.20.0 version: link:../hardhat - mocha: - specifier: ^12.0.0 - version: 12.0.3 - nyc: - specifier: 18.0.0 - version: 18.0.0(supports-color@8.1.1) prettier: specifier: 3.9.10 version: 3.9.10 diff --git a/scripts/test-file.ts b/scripts/test-file.ts index 9209df9b46a..16cd37e1aa8 100644 --- a/scripts/test-file.ts +++ b/scripts/test-file.ts @@ -35,7 +35,6 @@ EXAMPLES // Remove entries here once a package migrates to node --test. const UNSUPPORTED_TEST_RUNNERS = new Set([ "@nomicfoundation/hardhat-ignition", - "@nomicfoundation/ignition-core", "@nomicfoundation/example-project", ]);