Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@openzeppelin/test-environment
Advanced tools
Blazing fast smart contract testing. One-line setup for an awesome testing experience.
npm test
.@truffle/contract
or web3-eth-contract
as you see fit.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!
npm install --save-dev @openzeppelin/test-environment
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.
truffle test
, head instead to Migrating from Truffle.Released under the MIT License.
FAQs
One-line setup for an awesome testing experience.
We found that @openzeppelin/test-environment demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.