1.0.0 • Published 4 years ago

buidler-test-isolater v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Buidler Test Isolater

Reinitialize the Buidler Runtime Environment before each Mocha test.

Installation

yarn add --dev buidler-test-isolater

Usage

Load plugin in Buidler config:

usePlugin('buidler-test-isolater');

This plugin is intended for use in combination with the buidler-ganache plugin when testing against a forked network. Re-initializing the network before each test prevents errors such as the following:

Error: Returned error: project ID does not have access to archive state

This plugin is not compatible with Mocha describe-level exclusive tests.

Isolated tests are run via a temporary file .buidler_test_isolater_tmp.js created in the buidler tests directory. This file is deleted upon test completion, but may not be removed if test execution halts unexpectedly; therefore, it should be added to the .gitignore file or deleted manually.