-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdetector.go
More file actions
43 lines (39 loc) · 1.29 KB
/
detector.go
File metadata and controls
43 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package runner
import (
"fmt"
"github.com/buildkite/test-engine-client/internal/config"
)
func DetectRunner(cfg *config.Config) (TestRunner, error) {
runnerConfig := RunnerConfig{
TestRunner: cfg.TestRunner,
TestCommand: cfg.TestCommand,
TestFilePattern: cfg.TestFilePattern,
TestFileExcludePattern: cfg.TestFileExcludePattern,
RetryTestCommand: cfg.RetryCommand,
ResultPath: cfg.ResultPath,
TagFilters: cfg.TagFilters,
}
switch testRunner := cfg.TestRunner; testRunner {
case "rspec":
return NewRspec(runnerConfig), nil
case "jest":
return NewJest(runnerConfig), nil
case "cypress":
return NewCypress(runnerConfig), nil
case "playwright":
return NewPlaywright(runnerConfig), nil
case "pytest":
return NewPytest(runnerConfig), nil
case "pytest-pants":
return NewPytestPants(runnerConfig), nil
case "gotest":
return NewGoTest(runnerConfig), nil
case "cucumber":
return NewCucumber(runnerConfig), nil
case "custom":
return NewCustom(runnerConfig)
default:
// Update the error message to include the new runner
return nil, fmt.Errorf("runner value %q is invalid, possible values are 'rspec', 'jest', 'cypress', 'playwright', 'pytest', 'pytest-pants', 'gotest', 'cucumber', or 'custom'", testRunner)
}
}