Bundle and compile test helper functions
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
@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 awesome! we'll review it and maybe we can add it to the OpenZeppelin org :)
Went through the exact same process a few days ago, great work!
@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?
@mikec has already done some of the work here. We should definitely bundle the test helpers for the community.
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!
@mikec Well done.
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.
After #1074 is merged, this should be much easier to implement.
Superceded by #1204.