88 "github.com/buildkite/test-engine-client/internal/config"
99 "github.com/buildkite/test-engine-client/internal/debug"
1010 "github.com/buildkite/test-engine-client/internal/plan"
11+ "github.com/buildkite/test-engine-client/internal/runner"
1112)
1213
1314// createRequestParam generates the parameters needed for a test plan request.
@@ -18,16 +19,16 @@ import (
1819//
1920// If tag filtering is enabled, all files are split into examples to support filtering.
2021// Currently only the Pytest runner supports tag filtering.
21- func createRequestParam (ctx context.Context , cfg * config.Config , files []string , client api.Client , runner TestRunner ) (api.TestPlanParams , error ) {
22+ func createRequestParam (ctx context.Context , cfg * config.Config , files []string , client api.Client , runner runner. TestRunner ) (api.TestPlanParams , error ) {
2223 testFiles := []plan.TestCase {}
2324 for _ , file := range files {
2425 testFiles = append (testFiles , plan.TestCase {
2526 Path : file ,
2627 })
2728 }
2829
29- // Splitting files by example is only supported for rspec, cucumber, and pytest runners
30- if runner . Name () != "RSpec" && runner .Name () != "Cucumber" && runner . Name () != "pytest" {
30+ // Short circuit here if the runner doesn't support split by example
31+ if ! runner .SupportedFeatures (). SplitByExample {
3132 params := api.TestPlanParams {
3233 Identifier : cfg .Identifier ,
3334 Parallelism : cfg .Parallelism ,
@@ -86,7 +87,7 @@ func createRequestParam(ctx context.Context, cfg *config.Config, files []string,
8687}
8788
8889// Splits all the test files into examples to support tag filtering.
89- func splitAllFiles (files []plan.TestCase , runner TestRunner ) (api.TestPlanParamsTest , error ) {
90+ func splitAllFiles (files []plan.TestCase , runner runner. TestRunner ) (api.TestPlanParamsTest , error ) {
9091 debug .Printf ("Splitting all %d files" , len (files ))
9192 filePaths := make ([]string , 0 , len (files ))
9293 for _ , file := range files {
@@ -108,7 +109,7 @@ func splitAllFiles(files []plan.TestCase, runner TestRunner) (api.TestPlanParams
108109// filterAndSplitFiles filters the test files through the Test Engine API and splits the filtered files into examples.
109110// It returns the test plan parameters with the examples from the filtered files and the remaining files.
110111// An error is returned if there is a failure in any of the process.
111- func filterAndSplitFiles (ctx context.Context , cfg * config.Config , client api.Client , files []plan.TestCase , runner TestRunner ) (api.TestPlanParamsTest , error ) {
112+ func filterAndSplitFiles (ctx context.Context , cfg * config.Config , client api.Client , files []plan.TestCase , runner runner. TestRunner ) (api.TestPlanParamsTest , error ) {
112113 // Filter files that need to be split.
113114 debug .Printf ("Filtering %d files" , len (files ))
114115 filteredFiles , err := client .FilterTests (ctx , cfg .SuiteSlug , api.FilterTestsParams {
0 commit comments