You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -36,15 +44,17 @@ var RunTestsCmd = &cobra.Command{
36
44
}
37
45
38
46
runner:= runner.Runner{
39
-
ProjectPath: projectPath,
40
-
Verbose: true,
41
-
RunCount: runCount,
42
-
UseRace: useRace,
43
-
FailFast: threshold==1.0, // Fail test on first test run if threshold is 1.0
44
-
SkipTests: skipTests,
47
+
ProjectPath: projectPath,
48
+
Verbose: true,
49
+
RunCount: runCount,
50
+
UseRace: useRace,
51
+
FailFast: threshold==1.0, // Fail test on first test run if threshold is 1.0
52
+
SkipTests: skipTests,
53
+
RunAllTestPackages: runAllPackages,
54
+
SelectedTestPackages: testPackages,
45
55
}
46
56
47
-
testResults, err:=runner.RunTests(testPackages)
57
+
testResults, err:=runner.RunTests()
48
58
iferr!=nil {
49
59
fmt.Printf("Error running tests: %v\n", err)
50
60
os.Exit(1)
@@ -87,10 +97,26 @@ func init() {
87
97
RunTestsCmd.Flags().StringP("project-path", "r", ".", "The path to the Go project. Default is the current directory. Useful for subprojects")
88
98
RunTestsCmd.Flags().String("test-packages-json", "", "JSON-encoded string of test packages")
89
99
RunTestsCmd.Flags().StringSlice("test-packages", nil, "Comma-separated list of test packages to run")
100
+
RunTestsCmd.Flags().Bool("run-all-packages", false, "Run all test packages in the project. This flag overrides --test-packages and --test-packages-json")
90
101
RunTestsCmd.Flags().IntP("run-count", "c", 1, "Number of times to run the tests")
91
102
RunTestsCmd.Flags().Bool("race", false, "Enable the race detector")
92
103
RunTestsCmd.Flags().Bool("fail-fast", false, "Stop on the first test failure")
93
104
RunTestsCmd.Flags().String("output-json", "", "Path to output the test results in JSON format")
94
105
RunTestsCmd.Flags().Float64("threshold", 0.8, "Threshold for considering a test as flaky")
95
106
RunTestsCmd.Flags().StringSlice("skip-tests", nil, "Comma-separated list of test names to skip from running")
96
107
}
108
+
109
+
funccheckDependencies(projectPathstring) error {
110
+
cmd:=exec.Command("go", "mod", "tidy")
111
+
cmd.Dir=projectPath
112
+
113
+
varout bytes.Buffer
114
+
cmd.Stdout=&out
115
+
cmd.Stderr=&out
116
+
117
+
iferr:=cmd.Run(); err!=nil {
118
+
returnfmt.Errorf("dependency check failed: %v\n%s\nPlease run 'go mod tidy' to fix missing or unused dependencies", err, out.String())
0 commit comments