You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Actor}from"@dfinity/agent";import{Principal}from"@dfinity/principal";import{TestContext}from"lightic";constcontext=newTestContext();
let actor: Actor;describe("Canister",()=>{beforeAll(async()=>{// @ts-ignoreconstcanister=awaitcontext.deploy('./.dfx/local/canisters/backend/backend.wasm');console.log(canister)constcaller=Principal.anonymous();// @ts-ignoreactor=Actor.createActor(canister.getIdlBuilder(),{// @ts-ignoreagent: context.getAgent(caller),canisterId: canister.get_id()})});it("is true",()=>{console.log(actor);expect(true).toBe(true);});});
Run it simply with:
npx jest
But I got this error:
FAIL tests/integration/canister.test.ts
Canister
✕ is true (1 ms)
● Canister › is true
TypeError: WebAssembly.Module.customSections(): Argument 0 must be a WebAssembly.Module
at WasmCanister.get_candid (node_modules/lightic/src/wasm_canister.ts:270:42)
at async WasmCanister.install_module_candid (node_modules/lightic/src/wasm_canister.ts:116:20)
at async ReplicaContext.install_canister (node_modules/lightic/src/replica_context.ts:198:5)
at async TestContext.deploy (node_modules/lightic/src/test_context.ts:49:20)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.083 s
The ./.dfx/local/canisters/backend/backend.wasm file exists.
(Note that I also had to use @ts-ignore, which I think is due to different versions of the @dfinity/* packages)
Context:
node: v16.14.1
lightic: 0.3.1
jest: 29.6.1
@dfinity/*: 0.15.1
dfx: 0.14.1
The text was updated successfully, but these errors were encountered:
ilbertt
changed the title
Can't run Jest test
Can't start test in Jest
Jul 24, 2023
I'm trying to use LightIC with Jest.
I wrote this simple test:
Run it simply with:
But I got this error:
The
./.dfx/local/canisters/backend/backend.wasm
file exists.(Note that I also had to use
@ts-ignore
, which I think is due to different versions of the @dfinity/* packages)Context:
The text was updated successfully, but these errors were encountered: