Skip to content

Commit

Permalink
Scope npm package (#78)
Browse files Browse the repository at this point in the history
* Scope npm package

* Address review comments

* Add changelog entry

* Fix typo
  • Loading branch information
nventuro authored Oct 10, 2019
1 parent c59a7d1 commit ca500ba
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Removed check for truffle environments on configure due to issues with truffle migrations.

## 0.5.0 (2019-10-10)
* Renamed the package to `@openzeppelin/test-helpers`. ([#78](https://github.com/OpenZeppelin/openzeppelin-test-helpers/pull/78))
* Removed hard-dependency on `truffle-contract` ([#75](https://github.com/OpenZeppelin/openzeppelin-test-helpers/pull/75)):
* An `environment` option was added to `configure`, and can be set to either `web3` or `truffle` (default is `web3`, but there is automatic detection of a `truffle` environment)
* `singletons` return [`web3 Contract`](https://web3js.readthedocs.io/en/v1.2.0/web3-eth-contract.html) instances when `environment` is set to `web3`
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# OpenZeppelin Test Helpers

[![NPM Package](https://img.shields.io/npm/v/openzeppelin-test-helpers.svg)](https://www.npmjs.org/package/openzeppelin-test-helpers)
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/test-helpers.svg)](https://www.npmjs.org/package/@openzeppelin/test-helpers)
[![Build Status](https://travis-ci.com/OpenZeppelin/openzeppelin-test-helpers.svg?branch=master)](https://travis-ci.com/OpenZeppelin/openzeppelin-test-helpers)

**JavaScript testing helpers for Ethereum smart contract development.** These use [web3 1.2](https://www.npmjs.com/package/web3) under the hood, but include support for [`truffle-contract`](https://www.npmjs.com/package/@truffle/contract) objects. [Chai](http://chaijs.com/) [bn.js](https://github.com/indutny/bn.js) assertions using [chai-bn](https://github.com/OpenZeppelin/chai-bn) are also included.

## Installation

```bash
npm install --save-dev openzeppelin-test-helpers chai
npm install --save-dev @openzeppelin/test-helpers chai
```

## Usage

```javascript
// Import all required modules from openzeppelin-test-helpers
const { BN, constants, expectEvent, expectRevert } = require('openzeppelin-test-helpers');
// Import all required modules from @openzeppelin/test-helpers
const { BN, constants, expectEvent, expectRevert } = require('@openzeppelin/test-helpers');

// Import preferred chai flavor: both expect and should are supported
const { expect } = require('chai');
Expand Down Expand Up @@ -56,7 +56,7 @@ This library features support for both web3 and truffle contract instances. The
While automatic detection should cover most use cases, both the environment and provider can be manually supplied:

```javascript
require('openzeppelin-test-helpers/configure')({ environment: 'web3', provider: 'http://localhost:8080' });
require('@openzeppelin/test-helpers/configure')({ environment: 'web3', provider: 'http://localhost:8080' });

const { expectEvent } = require('openzeppelin-test-helpers');
```
Expand Down Expand Up @@ -218,7 +218,7 @@ contract Owned {
Can be tested as follows:
```javascript
const { expectRevert } = require('openzeppelin-test-helpers');
const { expectRevert } = require('@openzeppelin/test-helpers');

const Owned = artifacts.require('Owned');

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "openzeppelin-test-helpers",
"name": "@openzeppelin/test-helpers",
"version": "0.5.1",
"description": "JavaScript testing helpers for Ethereum smart contract development.",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ push_and_publish() {
push_release_branch_and_tag

log "Publishing package on npm"
npm publish --tag "$dist_tag" --otp "$(prompt_otp)"
npm publish --tag "$dist_tag" --otp "$(prompt_otp)" --access=public

if [[ "$dist_tag" == "latest" ]]; then
npm dist-tag rm --otp "$(prompt_otp)" openzeppelin-test-helpers next
npm dist-tag rm --otp "$(prompt_otp)" @openzeppelin/test-helpers next
fi
}

Expand Down
2 changes: 1 addition & 1 deletion src/expectRevert.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function checkRevertReasonSupport (provider) {

const warn = function (msg) {
console.log(`\
${colors.white.bgBlack('openzeppelin-test-helpers')} ${colors.black.bgYellow('WARN')} expectRevert: ${msg}`
${colors.white.bgBlack('@openzeppelin/test-helpers')} ${colors.black.bgYellow('WARN')} expectRevert: ${msg}`
);
};

Expand Down
2 changes: 1 addition & 1 deletion test-integration/ganache-core-2.1.x/test/Tested.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { expectRevert } = require('openzeppelin-test-helpers');
const { expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');

const Tested = artifacts.require('Tested');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { BN, constants, expectEvent, expectRevert, singletons } = require('openzeppelin-test-helpers');
const { BN, constants, expectEvent, expectRevert, singletons } = require('@openzeppelin/test-helpers');

const Tested = artifacts.require('Tested');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { balance, BN, ether, send } = require('openzeppelin-test-helpers');
const { balance, BN, ether, send } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');

contract('accounts', function (accounts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function(deployer) {
deployer.deploy(Migrations);

try {
require('openzeppelin-test-helpers/configure')({ provider: web3.currentProvider, environment: 'truffle' });
require('@openzeppelin/test-helpers/configure')({ provider: web3.currentProvider, environment: 'truffle' });

console.error('Successfully configured Web3 instance');
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = async function(deployer, network, accounts) {
const { send } = require('openzeppelin-test-helpers');
const { send } = require('@openzeppelin/test-helpers');

await send.ether(accounts[0], accounts[1], 1);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = async function(deployer, network, accounts) {
const { singletons } = require('openzeppelin-test-helpers');
const { singletons } = require('@openzeppelin/test-helpers');

await singletons.ERC1820Registry(accounts[0]);

Expand Down

0 comments on commit ca500ba

Please sign in to comment.