ZenVoich / mops

Package manager for the Motoko programming language
https://mops.one
MIT License
36 stars 3 forks source link

`mops bench` - Error with relative import paths #162

Closed tomijaga closed 10 months ago

tomijaga commented 10 months ago

Hey @ZenVoich, Great work on this feature! I tried benchmarking one of my projects but ran into an error when using a relative import path statement.

I checked to make sure the import statement was correct, but still, the canister failed to deploy

    import MemoryRegion  "../src/MemoryRegion";

However, it works well when I replace it with the file's absolute path:

    import MemoryRegion  "/Users/tomijaga/dev/icp/memory-region/src/MemoryRegion";

Error Log

Benchmark files:
• bench/MemoryRegion.bench.mo

==================================================

Starting dfx replica...
Deploying canisters...
Unexpected error. Stopping dfx replica...
file:///Users/dire.sol/.nvm/versions/node/v18.17.0/lib/node_modules/ic-mops/node_modules/execa/lib/error.js:59
        error = new Error(message);
                ^

Error: Command failed with exit code 1: /usr/local/bin/moc -c --idl canister.mo --force-gc --incremental-gc --package base ../../base@0.10.0/src --package stableheapbtreemap ../../stableheapbtreemap@1.3.0/src --packmatcheshers ../../_github/matchers#v1.3.0/src --package map ../../map@9.0.1/src --package test ../../test@1.0.1/src --package fuzz ../../fuzz@0.1.0/src --package bench ../../bench@1.0.0/src
user-bench.mo:14.1-14.43: import error [M0009], file "../src/MemoryRegion/lib.mo" does not exist
    amake erroror (file:///Users/dire.sol/.nvm/versions/node/v18.17.0/lib/node_modules/ic-mops/node_modules/execa/lib/error.js:59:11)
    ahandle promisese (file:///Users/dire.sol/.nvm/versions/node/v18.17.0/lib/node_modules/ic-mops/node_modules/execa/index.js:124:26)
   the  at process.processTicksAndRejections (n ode:internal/process/task_queues:95:5)
    at async deployBenchFile (file:///Users/dire.sol/.nvm/versions/node/v18.17.0/lib/node_modules/ic-mops/dist/commands/bench.js:156:5)
    at async file:///Users/dire.sol/.nvm/versions/node/v18.17.0/lib/node_modules/ic-mops/dist/commands/bench.js:71:13 short-messagesage: 'Command failed with exit code 1: /usr/local/bin/moc -c --idl canister.mo --force-gc --incremental-gc --package base ../../base@0.10.0/src --package stableheapbtreemap ../../stableheapbtreemap@1.3.0/src --package matchers ../../_github/matchers#v1.3.0/src --package map ../../map@9.0.1/src --package test ../../test@1.0.1/src --package fuzz ../../fuzz@0.1.0/src --package bench ../../bench@1.0.0/src',
  command: '/usr/local/bin/moc -c --idl canister.mo --force-gc --incremental-gc --package base ../../base@0.10.0/src --package stableheapbtreemap ../../stableheapbtreemap@1.3.0/src --packagmatchesrs ../../_github/matchers#v1.3.0/src --package map ../../map@9.0.1/src --package test ../../test@1.0.1/src --package fuzz ../../fuzz@0.1.0/src --package bench ../../bench@1.0.0/src',
  escapedCommand: '"/usr/local/bin/moc" -c --idl canister.mo --force-gc --incremental-gc --package base "../../base@0.10.0/src" --package stableheapbtreemap "../../stableheapbtreemap@1.3.0/src" --packmatcheshers "../../_github/matchers#v1.3.0/src" --package map "../../map@9.0.1/src" --package test "../../test@1.0.1/src" --package fuzz "../../fuzz@0.1.0/src" --package bench "../../bench@1.0.0/src"',
exit codede: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
- stderr: 'user-bench.mo:14.1-14.43: import error [M0009], file "../src/MemoryRegion/lib.mo" does not exist',
  failed: true,
timeoutut: false,
  isCanceled: false,
  killed: false
}

Node.js v18.17.0
ZenVoich commented 10 months ago

Hi @tomijaga , thanks for the bug report!

Fixed in mops 0.32.1

tomijaga commented 10 months ago

Thanks for the quick fix. 🤘