Skip to content

Releases: OpenZeppelin/openzeppelin-test-helpers

OpenZeppelin Test Helpers v0.4.0

27 May 15:52
Compare
Choose a tag to compare

This release includes a revamped expectRevert helper, configurability for using outside of Truffle, and more!

When we first took these helpers out of openzeppelin-solidity, our main concern was the quality of the API. We had collected these functions over time and they had been written by multiple contributors, so they lacked a cohesive structure, making them sometimes a bit unwieldy. Things are starting to take shape, and with this release we feel one step closer to v1.0! 🌟

Testing revert reasons

We've reworked shouldFail, our module used to test transaction promises that throw an exception. It is now called expectRevert. There are two main reasons behind this change:

  • A minor one: we're leaving behind should style and going for expect. (See openzeppelin-solidity#1678. Help welcome!)
  • We want to encourage developers to use revert reasons in their contracts, and to assert in their tests the precise reason a transaction is expected to fail. Because of this, the default helper expectRevert receives both a promise and a mandatory expected error message. (It's also possible to expect an unspecified revert with expectRevert.unspecified.) We even found some hidden errors in our own tests after we started using this new version.

There's a handy guide in the changelog explaining how to migrate from shouldFail to expectRevert: How to upgrade from v0.3.

Configurability

Some of the helpers need to use a web3.js instance. Until now, this instance was taken from the global variable web3 found in a Truffle testing environment. We've now added to possibility to manually specify an instance, which allows using the helpers in other environments. Check out the instructions in the readme!

Changelog

For a complete list of changes, take a look at the changelog.

v0.3.1

01 Apr 18:07
Compare
Choose a tag to compare

Minor release, adding support for [web3-provider-engine]. This is required to use 0x's tooling. See here for a PR where said integration is done on OpenZeppelin.

v0.3.0

01 Apr 18:10
Compare
Choose a tag to compare

For the first 'announced' release, we've removed the auto-installation of chai (#18).

For those migrating from the v0.2.0 version, if you use chai assertions in your project you should make sure to explicitly install it: npm install chai. If you need to access the chai instance you should now get it through require('chai'). If you use should-style assertions you should set it up manually now, by adding require('chai/register-should') in your tests, or e.g. in your Truffle config. Check out OpenZeppelin's upgrade commit in case it might be helpful: cf7375d.

v0.2.0

14 Mar 16:25
Compare
Choose a tag to compare

This is a breaking release introducing balance.tracker as a replacement for balance.difference. Check out the README for documentation!