Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use import statement outside a module #24

Closed
ImmuneGit opened this issue Nov 22, 2019 · 2 comments
Closed

Cannot use import statement outside a module #24

ImmuneGit opened this issue Nov 22, 2019 · 2 comments

Comments

@ImmuneGit
Copy link

git clone https://github.com/enjin/erc-1155.git
cd .\erc-1155
npm install
truffle test

truffle test
Using network 'development'.


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

/Users/vitalihurski/Projects/tests/erc-1155/test/ERC1155Mintable.js:5
import expectThrow from './helpers/expectThrow';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:983:16)
    at Module._compile (internal/modules/cjs/loader.js:1033:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
    at Module.load (internal/modules/cjs/loader.js:914:32)
    at Function.Module._load (internal/modules/cjs/loader.js:822:14)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:576:10)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/test.js:134:1
    at new Promise (<anonymous>)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/test.js:133:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Truffle v5.1.0 (core: 5.1.0)
Node v13.1.0
@AC0DEM0NK3Y
Copy link
Contributor

AC0DEM0NK3Y commented Nov 22, 2019

Try this at top of your truffle config:

require("@babel/register");({ ignore: /node_modules\/(?!zeppelin-solidity)/ }); require("@babel/polyfill");

I'll ping someone at Enjin, I think they should push a barebones truffle-config into this repo so it works out of the box. I would do it but don't have write permission for it anymore.

edit: you might need a babel.rc file too

@ImmuneGit
Copy link
Author

@AC0DEM0NK3Y thanks, it runs now. But 13 of 30 tests were failed :(

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

No branches or pull requests

2 participants