import { expect } from '@loopback/testlab' ; import { once } from 'events' ; import path from 'path' ; const runShell = require ( '@loopback/build' ) . runShell ; export function assertGreetings ( greetings ) { greetings = greetings . map ( g => g . replace ( /\[[^\[\]]+\] / , '' ) ) ; expect ( greetings ) . to . eql ( [ '(en) Hello, Jane!' , 'Hello, John!' , '(zh) 你好，John！' , '(en) Hello, Jane!' , ] ) ; } export function generateBundle ( type ) { const child = runShell ( 'npm' , [ 'run' , `build:webpack-${ type }` ] , { stdio : 'ignore' , cwd : path . join ( __dirname , '../../..' ) , } ) ; return once ( child , 'close' ) ; }