Giter Site home page Giter Site logo

william3johnson / openzeppelin-test-environment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openzeppelin/openzeppelin-test-environment

0.0 1.0 0.0 3.03 MB

[Not actively maintained] One-line setup for blazing-fast smart contracts tests

Home Page: https://docs.openzeppelin.com/test-environment

License: MIT License

JavaScript 3.83% TypeScript 7.50% Solidity 88.67%

openzeppelin-test-environment's Introduction

⚠️ This project is not being actively maintained. It is advisable to use an alternative (Hardhat, Truffle).

OpenZeppelin Test Environment

Docs NPM Package Build Status

Blazing fast smart contract testing. One-line setup for an awesome testing experience.

  • Near-instant start up: have your code running in under 2s after typing npm test.
  • Test runner agnostic – from the familiarity of Mocha, to parallel tests using Jest or Ava!
  • Non-opinionated: use either @truffle/contract or web3-eth-contract as you see fit.
  • First class support for the OpenZeppelin Test Helpers.
  • Highly configurable: from gas limit and initial balance, to complex custom web3 providers.
  • No global variables, no hacks.

test-environment is the result of our learnings while developing the OpenZeppelin Contracts, combining best practices and the tools we've come to rely on over the years. We think you'll love it!

Overview

Installation

npm install --save-dev @openzeppelin/test-environment

Usage

By including require('@openzeppelin/test-environment') in your test files, a local ganache-powered blockchain with unlocked accounts will be spun up, and all tools configured to work with it.

Here's a quick sample of how using test-environment in a Mocha + Chai setup looks like.

const { accounts, contract } = require('@openzeppelin/test-environment');
const [ owner ] = accounts;

const { expect } = require('chai');

const MyContract = contract.fromArtifact('MyContract'); // Loads a compiled contract

describe('MyContract', function () {
  it('deployer is owner', async function () {
    const myContract = await MyContract.new({ from: owner });
    expect(await myContract.owner()).to.equal(owner);
  });
});

If you're used to truffle test, this probably looks very familiar. Follow our guide on migrating from Truffle to have your project running with test-environment in a breeze!

Note: if you'd rather not rely on truffle contracts and use web3 contract types directly, worry not: you can configure test-environment to use the web3-eth-contract abstraction.

Learn More

License

Released under the MIT License.

openzeppelin-test-environment's People

Contributors

abcoathup avatar crazyrabbitltc avatar dependabot-preview[bot] avatar dependabot[bot] avatar epiccoolguy avatar frangio avatar mds1 avatar nventuro avatar pinglamb avatar spalladino avatar ylv-io avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.