Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Using es6 style in tests. #281

Open
AC0DEM0NK3Y opened this issue Sep 18, 2019 · 4 comments
Open

Using es6 style in tests. #281

AC0DEM0NK3Y opened this issue Sep 18, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@AC0DEM0NK3Y
Copy link

Just trying this in place of truffle and while compile seems to go fine my tests fall over on something like:

import expectThrow from '../helpers/expectThrow';

In truffle the way to allow this syntax is with @babel dependencies added to the package.json and a .babelrc file and the below to the truffle-config.js to activate:

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

How can I do the same with etherlime?

Thanks.

@ochikov
Copy link
Collaborator

ochikov commented Sep 24, 2019

Hello @AC0DEM0NK3Y, can you provide repository se we can tests and help resolve the issue ?

@ochikov ochikov added the bug Something isn't working label Sep 24, 2019
@AC0DEM0NK3Y
Copy link
Author

Repo here: https://github.com/AC0DEM0NK3Y/etherlime_es6

master branch works with truffle.
etherlime branch compiles, fails on test.

The magic for the truffle version to work is this in truffle-config.js:

require("@babel/register");
require("@babel/polyfill");

@ochikov
Copy link
Collaborator

ochikov commented Oct 7, 2019

Hello @AC0DEM0NK3Y
I go through your repository and special through the etherlime branch. I could not reproduce your issue because:

  1. Your tests and import of contracts are truffle style, not etherlime.
  2. Why there is .sol file in the tests ?

Can you go through the migration guide from truffle to etherlime here.

Also can you join and write me in our Telegram group.

@AC0DEM0NK3Y
Copy link
Author

I'm no longer working on this, but I think if you want to boost popularity of your framework and help teams migrate who already have a large bank of tests (for eg. I know we had close to 500) you might want to consider looking at this some more.

  1. What the tests do is kind of immaterial, the bug is in the import yes...it's an es6 vs es5 problem your framework currently doesn't have a way to support es6 style code but truffle does. This is the problem.

  2. The code is taken from a truffle "box" as mentioned, it's their code so they would be best asked why they put a .sol in the test. That doesn't affect the bug though.

I went through your guide while I was looking at this and it looks reasonably simple to move over...unless you use es6 code in your bank of truffle tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants