buidler/draft
cgewecke 5 years ago
parent 6d6259d6a6
commit 92fa5e0f77
  1. 23
      test/util/integration.js

@ -1,14 +1,16 @@
/* /*
Utilities for generating a mock truffle project to test plugin. Utilities for generating & managing mock projects to test plugins.
*/ */
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const shell = require('shelljs'); const shell = require('shelljs');
const TruffleConfig = require('truffle-config');
const decache = require('decache'); const decache = require('decache');
const PluginsTestHelpers = require("@nomiclabs/buidler/plugins-testing")
const TruffleConfig = require('truffle-config');
const temp = './sc_temp'; const temp = './sc_temp';
const truffleConfigName = 'truffle-config.js'; const truffleConfigName = 'truffle-config.js';
const buidlerConfigName = 'buidler.config.js'; const buidlerConfigName = 'buidler.config.js';
@ -49,6 +51,23 @@ function getOutput(truffleConfig){
return JSON.parse(fs.readFileSync(jsonPath, 'utf8')); return JSON.parse(fs.readFileSync(jsonPath, 'utf8'));
} }
// Buidler env set up / tear down.
function useEnvironment(projectPath) {
let previousCWD;
beforeEach("Loading buidler environment", function() {
previousCWD = process.cwd();
process.chdir(projectPath);
process.env.BUIDLER_NETWORK = "develop";
this.env = require("@nomiclabs/buidler");
});
afterEach("Resetting buidler", function() {
PluginsTestHelpers.resetBuidlerContext();
process.chdir(previousCWD);
});
}
// ========================== // ==========================
// Truffle Configuration // Truffle Configuration
// ========================== // ==========================

Loading…
Cancel
Save