From 85f49cbad78cf944d5e5f1456f2a64a6ad9c5516 Mon Sep 17 00:00:00 2001 From: Sergey Ukustov Date: Sat, 1 Sep 2018 18:39:22 +0300 Subject: [PATCH] Add contract global function to mimic Truffle test --- lib/environment.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/environment.js b/lib/environment.js index 2c0d0d7..38a481d 100644 --- a/lib/environment.js +++ b/lib/environment.js @@ -14,6 +14,11 @@ class TruffleEnvironment extends NodeEnvironment { this.global.accounts = this.global.__truffleTest.accounts; this.global.web3 = this.global.__truffleTest.web3; this.global.runner = this.global.__truffleTest.runner; + this.global.contract = (name, body) => { + this.global.describe(name, () => { + body(this.global.accounts, this.global.web3) + }) + }; return new Promise(resolve => { this.global.__truffleTest.runner.initialize(resolve);