@@ -15,6 +15,7 @@ var RunTestsCmd = &cobra.Command{
1515 Use : "run" ,
1616 Short : "Run tests to check if they are flaky" ,
1717 Run : func (cmd * cobra.Command , args []string ) {
18+ projectPath , _ := cmd .Flags ().GetString ("project-path" )
1819 testPackagesJson , _ := cmd .Flags ().GetString ("test-packages-json" )
1920 testPackagesArg , _ := cmd .Flags ().GetStringSlice ("test-packages" )
2021 runCount , _ := cmd .Flags ().GetInt ("run-count" )
@@ -34,10 +35,11 @@ var RunTestsCmd = &cobra.Command{
3435 }
3536
3637 runner := runner.Runner {
37- Verbose : true ,
38- RunCount : runCount ,
39- UseRace : useRace ,
40- FailFast : threshold == 1.0 , // Fail test on first test run if threshold is 1.0
38+ ProjectPath : projectPath ,
39+ Verbose : true ,
40+ RunCount : runCount ,
41+ UseRace : useRace ,
42+ FailFast : threshold == 1.0 , // Fail test on first test run if threshold is 1.0
4143 }
4244
4345 testResults , err := runner .RunTests (testPackages )
@@ -82,6 +84,7 @@ var RunTestsCmd = &cobra.Command{
8284}
8385
8486func init () {
87+ RunTestsCmd .Flags ().StringP ("project-path" , "r" , "." , "The path to the Go project. Default is the current directory. Useful for subprojects." )
8588 RunTestsCmd .Flags ().String ("test-packages-json" , "" , "JSON-encoded string of test packages" )
8689 RunTestsCmd .Flags ().StringSlice ("test-packages" , nil , "Comma-separated list of test packages to run" )
8790 RunTestsCmd .Flags ().IntP ("run-count" , "c" , 1 , "Number of times to run the tests" )
0 commit comments