import path from "path" ; import util from "util" ; import * as child from "child_process" ; import { expect , use } from "chai" ; import chaiAsPromised from "chai-as-promised" ; const scriptNames = { ok : "setPresetOk.ts" , error : "setPresetError.ts" , } ; use ( chaiAsPromised ) ; const exec = util . promisify ( child . exec ) ; const tsNodeBinary = path . join ( __dirname , "../../../../node_modules/.bin/ts-node" ) ; describe ( "setPreset" , function ( ) { this . timeout ( 30000 ) ; it ( "Should correctly set preset" , async ( ) => { await exec ( `${ tsNodeBinary } ${ path . join ( __dirname , scriptNames . ok ) }` ) ; } ) ; it ( "Should throw trying to set preset in the wrong order" , async ( ) => { await expect ( exec ( `${ tsNodeBinary } ${ path . join ( __dirname , scriptNames . error ) }` ) ) . to . be . rejectedWith ( "Lodestar preset is already frozen" ) ; } ) ; } ) ;