Skip to content

Conversation

@shay-dahan
Copy link

…n JSON file

  • Introduced a new flag --failed-first to specify the path to a JSON file containing the results of the previous test run.
  • Implemented logic to read the JSON file and prioritize running failed tests before executing all tests.
  • Added unit tests to validate the new functionality and ensure correct behavior when handling various scenarios, including no failed tests and invalid file paths.
  • Updated help text to include the new flag description.

…n JSON file

- Introduced a new flag `--failed-first` to specify the path to a JSON file containing the results of the previous test run.
- Implemented logic to read the JSON file and prioritize running failed tests before executing all tests.
- Added unit tests to validate the new functionality and ensure correct behavior when handling various scenarios, including no failed tests and invalid file paths.
- Updated help text to include the new flag description.
Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

Can you tell me more about the problem this solves for you? Is this to run tests in CI, or running them locally as you make changes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file was committed by accident? Let's leave launch config up to the individual developer. If you'd like to add something consider adding it to contrib/vscode/launch.json.sample.

Comment on lines +289 to +299
var failedTests []struct{ Package, Test, Action string }
for _, line := range strings.Split(string(data), "\n") {
if strings.TrimSpace(line) == "" {
continue
}
var evt struct{ Package, Test, Action string }
_ = json.Unmarshal([]byte(line), &evt)
if evt.Action == "fail" && evt.Test != "" {
failedTests = append(failedTests, evt)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's code in the testjson package to do this: https://pkg.go.dev/gotest.tools/[email protected]/testjson#ScanTestOutput

I'd suggest using that to read the JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants