Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @nomiclabs/buidler-truffle5 with all npm packages installed. Try it out:

require("@nomiclabs/buidler/package.json"); // @nomiclabs/buidler is a peer dependency. require("@nomiclabs/buidler-web3/package.json"); // @nomiclabs/buidler-web3 is a peer dependency. require("web3/package.json"); // web3 is a peer dependency. var buidlerTruffle5 = require("@nomiclabs/buidler-truffle5")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@nomiclabs/buidler-truffle5 v1.3.3

Truffle 5 Buidler compatibility plugin

npm buidler


Buidler plugin for integration with TruffleContract from Truffle 5. This allows tests and scripts written for Truffle to work with Buidler.


This plugin brings to Buidler TruffleContracts from Truffle 5. With it you can call contract() and artifacts.require() like you normally would with Truffle. Interact with your contracts with a familiar API from tasks, scripts and tests.

Required plugins

This plugin requires buidler-web3 as a prerequisite.


npm install --save-dev @nomiclabs/buidler-truffle5 @nomiclabs/buidler-web3 web3

And add the following statement to your buidler.config.js:



This plugin creates no additional tasks.

Environment extensions

An instance of TruffleEnvironmentArtifacts is injected into env.artifacts and the method contract() is injected into the global scope for using in tests.


There are no additional steps you need to take for this plugin to work. Install it, run npx buidler test and your Truffle tests should run with no need to make any modifications.

Take a look at the testing guide for a tutorial using it.

TypeScript support

This plugin supports TypeScript through a type extensions file type-extensions.d.ts. Add it to the files field of your tsconfig.json file to enable TypeScript support. This plugins depends on the buidler-web3 plugin, so you should add that plugin's type extensions file as well, like this:

"files": [
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free