@@ -13,11 +13,9 @@ const TruffleConfig = require('truffle-config');
1313
1414const { HARDHAT_NETWORK_NAME } = require ( "hardhat/plugins" )
1515const { resetHardhatContext } = require ( "hardhat/plugins-testing" )
16- const { resetBuidlerContext } = require ( "@nomiclabs/buidler/plugins-testing" )
1716
1817const temp = './sc_temp' ;
1918const truffleConfigName = 'truffle-config.js' ;
20- const buidlerConfigName = 'buidler.config.js' ;
2119const hardhatConfigName = 'hardhat.config.js' ;
2220const configPath = `${ temp } /.solcover.js` ;
2321const testPath = './test/sources/js/' ;
@@ -35,7 +33,6 @@ function decacheConfigs(){
3533 const paths = [
3634 `${ process . cwd ( ) } /${ temp } /.solcover.js` ,
3735 `${ process . cwd ( ) } /${ temp } /${ truffleConfigName } ` ,
38- `${ process . cwd ( ) } /${ temp } /${ buidlerConfigName } ` ,
3936 `${ process . cwd ( ) } /${ temp } /${ hardhatConfigName } ` ,
4037 `${ process . cwd ( ) } /${ temp } /contracts/Simple.sol` ,
4138 `${ process . cwd ( ) } /${ temp } /test/simple.js` ,
@@ -72,16 +69,6 @@ function getOutput(config){
7269 return JSON . parse ( fs . readFileSync ( jsonPath , 'utf8' ) ) ;
7370}
7471
75- // Buidler env set up
76- function buidlerSetupEnv ( mocha ) {
77- const mockwd = path . join ( process . cwd ( ) , temp ) ;
78- previousCWD = process . cwd ( ) ;
79- process . chdir ( mockwd ) ;
80- mocha . env = require ( "@nomiclabs/buidler" ) ;
81- mocha . env . config . logger = testLogger
82- mocha . logger = testLogger
83- } ;
84-
8572// Hardhat env set up
8673function hardhatSetupEnv ( mocha ) {
8774 const mockwd = path . join ( process . cwd ( ) , temp ) ;
@@ -92,12 +79,6 @@ function hardhatSetupEnv(mocha) {
9279 mocha . logger = testLogger
9380} ;
9481
95- // Buidler env tear down
96- function buidlerTearDownEnv ( ) {
97- resetBuidlerContext ( ) ;
98- process . chdir ( previousCWD ) ;
99- } ;
100-
10182// Hardhat env tear down
10283function hardhatTearDownEnv ( ) {
10384 resetHardhatContext ( ) ;
@@ -178,17 +159,6 @@ function getDefaultNomicLabsConfig(){
178159 return vals ;
179160}
180161
181- function getDefaultBuidlerConfig ( ) {
182- const config = getDefaultNomicLabsConfig ( )
183- config . defaultNetwork = "buidlerevm" ;
184- config . solc = {
185- version : "0.7.3" ,
186- evmVersion : 'petersburg'
187- }
188-
189- return config ;
190- }
191-
192162function getDefaultHardhatConfig ( ) {
193163 const config = getDefaultNomicLabsConfig ( )
194164 config . defaultNetwork = HARDHAT_NETWORK_NAME ;
@@ -198,22 +168,6 @@ function getDefaultHardhatConfig() {
198168 return config ;
199169}
200170
201- function getBuidlerConfigJS ( config ) {
202- // Hardhat tests will crash if the buidler plugin is loaded from the shared entrypoint
203- // b/c of some kind of weird cacheing or context reset issue.
204- const prefix = `
205- const { loadPluginFile } = require("@nomiclabs/buidler/plugins-testing");
206- loadPluginFile(__dirname + "/../plugins/buidler.plugin");
207- usePlugin("@nomiclabs/buidler-truffle5");
208- `
209-
210- if ( config ) {
211- return `${ prefix } module.exports = ${ JSON . stringify ( config , null , ' ' ) } ` ;
212- } else {
213- return `${ prefix } module.exports = ${ JSON . stringify ( getDefaultBuidlerConfig ( ) , null , ' ' ) } ` ;
214- }
215- }
216-
217171function getHardhatConfigJS ( config ) {
218172 const prefix = `
219173 require("@nomiclabs/hardhat-truffle5");
@@ -262,7 +216,7 @@ function deployDouble(contractNames){
262216// Project Installers
263217// ==========================
264218/**
265- * Installs mock truffle/buidler project at ./temp with a single contract
219+ * Installs mock project at ./temp with a single contract
266220 * and test specified by the params.
267221 * @param {String } contract <contractName.sol> located in /test/sources/cli/
268222 * @param {[type] } test <testName.js> located in /test/cli/
@@ -293,15 +247,14 @@ function install(
293247
294248 // Configs
295249 fs . writeFileSync ( `${ temp } /${ truffleConfigName } ` , getTruffleConfigJS ( devPlatformConfig ) ) ;
296- fs . writeFileSync ( `${ temp } /${ buidlerConfigName } ` , getBuidlerConfigJS ( devPlatformConfig ) ) ;
297250 fs . writeFileSync ( `${ temp } /${ hardhatConfigName } ` , getHardhatConfigJS ( devPlatformConfig ) ) ;
298251 if ( solcoverConfig ) fs . writeFileSync ( configPath , solcoverJS ) ;
299252
300253 decacheConfigs ( ) ;
301254} ;
302255
303256/**
304- * Installs mock truffle/buidler project with two contracts (for inheritance, libraries, etc)
257+ * Installs mock project with two contracts (for inheritance, libraries, etc)
305258 */
306259function installDouble ( contracts , test , config , skipMigration ) {
307260 const configjs = getSolcoverJS ( config ) ;
@@ -328,15 +281,14 @@ function installDouble(contracts, test, config, skipMigration) {
328281
329282 // Configs
330283 fs . writeFileSync ( `${ temp } /${ truffleConfigName } ` , getTruffleConfigJS ( ) ) ;
331- fs . writeFileSync ( `${ temp } /${ buidlerConfigName } ` , getBuidlerConfigJS ( ) ) ;
332284 fs . writeFileSync ( `${ temp } /${ hardhatConfigName } ` , getHardhatConfigJS ( ) ) ;
333285 fs . writeFileSync ( configPath , configjs ) ;
334286
335287 decacheConfigs ( ) ;
336288} ;
337289
338290/**
339- * Installs full truffle/buidler project
291+ * Installs full project
340292 */
341293function installFullProject ( name , config ) {
342294 shell . mkdir ( temp ) ;
@@ -370,16 +322,13 @@ module.exports = {
370322 testLogger : testLogger ,
371323 loggerOutput : loggerOutput ,
372324 getDefaultTruffleConfig : getDefaultTruffleConfig ,
373- getDefaultBuidlerConfig : getDefaultBuidlerConfig ,
374325 getDefaultHardhatConfig : getDefaultHardhatConfig ,
375326 install : install ,
376327 installDouble : installDouble ,
377328 installFullProject : installFullProject ,
378329 clean : clean ,
379330 pathToContract : pathToContract ,
380331 getOutput : getOutput ,
381- buidlerSetupEnv : buidlerSetupEnv ,
382- buidlerTearDownEnv : buidlerTearDownEnv ,
383332 hardhatSetupEnv : hardhatSetupEnv ,
384333 hardhatTearDownEnv : hardhatTearDownEnv
385334}
0 commit comments