diff --git a/contract-ts/ava.config.cjs b/contract-ts/ava.config.cjs deleted file mode 100644 index b170147..0000000 --- a/contract-ts/ava.config.cjs +++ /dev/null @@ -1,15 +0,0 @@ -require('util').inspect.defaultOptions.depth = 5; // Increase AVA's printing depth - -module.exports = { - timeout: '10000', - files: ['sandbox-ts/*.ava.ts'], - failWithoutAssertions: false, - extensions: { - js: true, - ts: 'module' - }, - require: ['ts-node/register', 'near-workspaces'], - "nodeArguments": [ - "--import=tsimp" - ] -}; \ No newline at end of file diff --git a/contract-ts/package.json b/contract-ts/package.json index 52fe7cc..5e719d8 100644 --- a/contract-ts/package.json +++ b/contract-ts/package.json @@ -8,16 +8,14 @@ "test": "$npm_execpath build && ava -- ./build/counter.wasm" }, "dependencies": { - "near-cli": "^4.0.8", "near-sdk-js": "1.0.0" }, "devDependencies": { - "@ava/typescript": "^4.1.0", - "ava": "^6.1.2", + "ava": "^6.1.3", "near-workspaces": "^3.5.0", - "ts-morph": "^21.0.1", - "ts-node": "^10.9.2", - "tsimp": "^2.0.11", - "typescript": "^5.3.3" + "typescript": "^5.4.5" + }, + "ava": { + "files": ["sandbox-test/*.ava.js"] } -} +} \ No newline at end of file diff --git a/contract-ts/sandbox-ts/main.ava.ts b/contract-ts/sandbox-test/main.ava.js similarity index 82% rename from contract-ts/sandbox-ts/main.ava.ts rename to contract-ts/sandbox-test/main.ava.js index 16dc33d..cb84d1d 100644 --- a/contract-ts/sandbox-ts/main.ava.ts +++ b/contract-ts/sandbox-test/main.ava.js @@ -1,11 +1,12 @@ -import { Worker, NEAR, NearAccount } from "near-workspaces"; -import anyTest, { TestFn } from "ava"; +import anyTest from 'ava'; +import { Worker, NEAR } from 'near-workspaces'; import { setDefaultResultOrder } from 'dns'; setDefaultResultOrder('ipv4first'); // temp fix for node >v17 -const test = anyTest as TestFn<{ - worker: Worker; - accounts: Record; -}>; +/** + * @typedef {import('near-workspaces').NearAccount} NearAccount + * @type {import('ava').TestFn<{worker: Worker, accounts: Record}>} + */ +const test = anyTest; test.beforeEach(async (t) => { // Init the worker and start a Sandbox server @@ -36,7 +37,7 @@ test.afterEach.always(async (t) => { test("can be incremented", async (t) => { const { alice, contract } = t.context.accounts; - const startCounter: number = await contract.view("get_num", {}); + const startCounter = await contract.view("get_num", {}); await alice.call(contract, "increment", {}); const endCounter = await contract.view("get_num", {}); t.is(endCounter, startCounter + 1); @@ -45,7 +46,7 @@ test("can be incremented", async (t) => { test("can be decremented", async (t) => { const { alice, contract } = t.context.accounts; await alice.call(contract, "increment", {}); - const startCounter: number = await contract.view("get_num", {}); + const startCounter = await contract.view("get_num", {}); await alice.call(contract, "decrement", {}); const endCounter = await contract.view("get_num", {}); t.is(endCounter, startCounter - 1); diff --git a/contract-ts/tsconfig.json b/contract-ts/tsconfig.json index d2562eb..c3d38e6 100644 --- a/contract-ts/tsconfig.json +++ b/contract-ts/tsconfig.json @@ -6,7 +6,6 @@ "noImplicitAny": false, }, "files": [ - "sandbox-ts/main.ava.ts", "src/contract.ts" ], "exclude": [