openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Bundle and compile test helper functions

Open mikec opened this issue 9 years ago • 10 comments

I wanted to use the helper functions in zeppelin-solidity/test/helpers/ in my project, but had a hard time importing them. They’re exported using ES2015 module syntax, so I had to add babel-register as a dependency and run:

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

It would be easier to add as a dependency in other projects if they were bundled and transformed to CommonJS

mikec avatar Jul 21 '17 19:07 mikec

@maraoz I created https://github.com/levelkdev/zeppelin-testing. It has all the js from test/helpers, exports each named function, and bundles them into a dist file. Haven't tested it yet, but could be a good starting point if you want to add to OpenZeppelin

mikec avatar Jul 21 '17 20:07 mikec

@mikec awesome! we'll review it and maybe we can add it to the OpenZeppelin org :)

maraoz avatar Jul 23 '17 19:07 maraoz

Went through the exact same process a few days ago, great work!

SylTi avatar Aug 25 '17 23:08 SylTi

@martriay can you take over the task of moving our existing test helpers to a separate module, and make it part of the OpenZeppelin org? That'd be helpful for other projects too. @frangio thoughts?

maraoz avatar Nov 10 '17 21:11 maraoz

@mikec has already done some of the work here. We should definitely bundle the test helpers for the community.

frangio avatar Nov 10 '17 21:11 frangio

Many thanks to @mikec for a babel configuration excerpt as everywhere advised require('babel-register'); does not work and I had very hard time making helpers work too. I still do not know why it does not work without ({ ignore: ... }) (I guess default ignore?) but at least it runs now!

mancze avatar Nov 21 '17 12:11 mancze

@mikec Well done.

shenzhun avatar Feb 08 '18 11:02 shenzhun

Would be nice to get these helper functions compiled down so babel is no longer needed. I'm using Typescript so babel is no longer needed, would have to include it just for this purpose.

kingjerod avatar Apr 08 '18 05:04 kingjerod

After #1074 is merged, this should be much easier to implement.

nventuro avatar Jul 17 '18 18:07 nventuro

Superceded by #1204.

nventuro avatar Aug 13 '18 12:08 nventuro