@@ -18,8 +18,15 @@ interface Callbacks {
1818const failChannelName = 'CodeRoad (Tests)'
1919const logChannelName = 'CodeRoad (Logs)'
2020
21+ interface TestRunnerParams {
22+ position :T . Position
23+ filter ?:string
24+ onSuccess ?:( ) => void
25+ }
26+
2127const createTestRunner = ( config :TT . TestRunnerConfig , callbacks :Callbacks ) => {
22- return async ( position :T . Position , onSuccess ?:( ) => void ) :Promise < void > => {
28+ const testRunnerFilterArg = config . args ?. filter
29+ return async ( { position, filter :testFilter , onSuccess} :TestRunnerParams ) :Promise < void > => {
2330logger ( 'createTestRunner' , position )
2431const startTime = throttle ( )
2532// throttle time early
@@ -34,7 +41,16 @@ const createTestRunner = (config: TT.TestRunnerConfig, callbacks: Callbacks) =>
3441
3542let result :{ stdout :string | undefined ; stderr :string | undefined }
3643try {
37- const command = config . args ?`${ config . command } ${ config ?. args . tap } ` :config . command // TODO: enforce TAP
44+ let command = config . args ?`${ config . command } ${ config ?. args . tap } ` :config . command // TODO: enforce TAP
45+
46+ // filter tests if requested
47+ if ( testRunnerFilterArg ) {
48+ if ( testFilter ) {
49+ command += `${ testRunnerFilterArg } ${ testFilter } `
50+ } else {
51+ throw new Error ( 'Test Runner filter not configured' )
52+ }
53+ }
3854result = await exec ( { command, dir :config . directory || config . path } ) // TODO: remove config.path later
3955} catch ( err ) {
4056result = { stdout :err . stdout , stderr :err . stack }