Skip to content

Instantly share code, notes, and snippets.

@glihm
Created April 20, 2023 02:43
Show Gist options
  • Save glihm/dbdcda0c0c33ae03f24a3ad697967a1c to your computer and use it in GitHub Desktop.
Save glihm/dbdcda0c0c33ae03f24a3ad697967a1c to your computer and use it in GitHub Desktop.
Madara test errors

I have this error after doing:

  1. cd tests
  2. npm install
  3. npm run test-seq

> ts-tests@1.0.0 test-seq
> mocha -r ts-node/register 'tests/**/test-*.ts'


/home/.../madara/tests/util/setup-dev-tests.ts:96
                            ?.phase?.asApplyExtrinsic?.toNumber()
                             ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Module.m._compile (/home/.../madara/tests/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Object.require.extensions.<computed> [as .ts] (/home/.../madara/tests/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/.../madara/tests/tests/test-rpc/test-starknet-rpc.ts:5:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Module.m._compile (/home/.../madara/tests/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Object.require.extensions.<computed> [as .ts] (/home/.../madara/tests/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.exports.requireOrImport (/home/.../madara/tests/node_modules/mocha/lib/nodejs/esm-utils.js:53:16)
    ```
@dubzn
Copy link

dubzn commented Apr 20, 2023

Hey Glihm, I had the same problem and apparently it's because of the node version (I had version 12.x), I installed nvm and then node14.x and it worked correctly
image

@glihm
Copy link
Author

glihm commented Apr 21, 2023

Thank you @dubzn! I’ll try it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment