import baseSetup from '@celo/dev-utils/lib/ganache-setup' ; import _unused from '@celo/dev-utils/lib/matchers' ; import { waitForPortOpen } from '@celo/dev-utils/lib/network' ; import flakeTrackerSetup from '@celo/flake-tracker/src/jest/setup.global' ; import * as path from 'path' ; const USE_GANACHE = process . env . NO_GANACHE ?. toLowerCase ( ) !== 'true' ; export default async function globalSetup ( ) { await flakeTrackerSetup ( ) ; if ( USE_GANACHE ) { console . log ( '\nstarting ganache... set NO_GANACHE=true to disable' ) ; await baseSetup ( path . resolve ( path . join ( __dirname , '../..' ) ) , '.tmp/devchain.tar.gz' , { from_targz : true } ) ; await waitForPortOpen ( 'localhost' , 8545 , 60 ) ; console . log ( '...ganache started' ) ; } else { console . log ( 'skipping ganache setup' ) ; } }