import { FtrConfigProviderContext } from '@kbn/test' ; import { resolve } from 'path' ; import fs from 'fs' ; import { KIBANA_ROOT } from '@kbn/test' ; export default async function ( { readConfigFile } ) { const xpackFunctionalConfig = await readConfigFile ( require . resolve ( '../functional/config' ) ) ; const examplesFiles = fs . readdirSync ( resolve ( KIBANA_ROOT , 'examples' ) ) ; const examples = examplesFiles . filter ( ( file ) => fs . statSync ( resolve ( KIBANA_ROOT , 'examples' , file ) ) . isDirectory ( ) ) ; const xpackExamplesFiles = fs . readdirSync ( resolve ( KIBANA_ROOT , 'x-pack/examples' ) ) ; const xpackExamples = xpackExamplesFiles . filter ( ( file ) => fs . statSync ( resolve ( KIBANA_ROOT , 'x-pack/examples' , file ) ) . isDirectory ( ) ) ; return { ... xpackFunctionalConfig . getAll ( ) , junit : { reportName : 'X-Pack Example plugin functional tests' , } , testFiles : [ require . resolve ( './search_examples' ) , require . resolve ( './embedded_lens' ) , require . resolve ( './reporting_examples' ) , ] , kbnTestServer : { ... xpackFunctionalConfig . get ( 'kbnTestServer' ) , serverArgs : [ ... xpackFunctionalConfig . get ( 'kbnTestServer.serverArgs' ) , '--env.name=development' , ... examples . map ( ( exampleDir ) => `--plugin-path=${ resolve ( KIBANA_ROOT , 'examples' , exampleDir ) }` ) , ... xpackExamples . map ( ( exampleDir ) => `--plugin-path=${ resolve ( KIBANA_ROOT , 'x-pack/examples' , exampleDir ) }` ) , ] , } , } ; }