Importing Management Canister Fails Mops Tests

Hello fellow Motoko devs,

I’m running into an issue when I try to test code that imports the IC management canister:

Test files: 4
==================================================
✓ test/Handler.test.mo 
✖ test/Jwk.test.mo
 ✖ 
 FAIL src/auth/Types.mo:4:1: import error [M0008], cannot import canister urls without --actor-idl param
   ...
   3    | import CertTree "mo:ic-certification/CertTree";
-> 4    | import IC "ic:aaaaa-aa";
   5    | 
   ...
--------------------------------------------------
✓ test/Rpc.test.mo 
✓ test/Args.test.mo 
==================================================
Tests failed
Done in 0.24s, passed 3 files, failed 1 files

When deploying using dfx and working in vs code everything works fine, it’s just the test runner that has issues.

Try using ic package

import {ic} "mo:ic";

instead of import IC "ic:aaaaa-aa";

1 Like

Thanks @ZenVoich that did the trick!

1 Like