Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support directory (go package) execution #24

Closed
wants to merge 26 commits into from

Conversation

fredrikaverpil
Copy link
Owner

@fredrikaverpil fredrikaverpil commented Jun 3, 2024

Why this change?

  • Makes execution of all tests in a folder (or the entire suite) a lot faster. Only
    runs one go test command. Could potentially and hopefully lay the
    foundation for implementing a similar or the same behavior when running
    all tests in a file.
  • Aims to help us get there for File run causes cov report messed up #23

What was changed

  • When running all tests in a folder (from e.g. the summary window), run just
    one go test command.
  • Parse go test output and map the test name to the Neotest node id, return
    status, output and errors per Neotest node id.

Notes

  • There's a bunch of stuff missing and cleanup needed, but some tests are
    passing on my end now.
  • The timeout in the (configurable) arguments might have to be addressed
    somehow, as you could time out more easily now in a large project.
  • It so far looks promising; might be able to use the same logic for when
    running all tests in a file.
  • There are failing commits in this branch, will clean up later.

Try it out

Set the branch:

-- lazy.nvim
return {
  {
    "fredrikaverpil/neotest-golang",
    branch = "rnd-run-testfolder-populate-statuses",
  },
}

@fredrikaverpil fredrikaverpil self-assigned this Jun 3, 2024
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch from 92efb71 to 0a2a67e Compare June 3, 2024 22:33
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch 4 times, most recently from b553fa6 to bf9e648 Compare June 9, 2024 21:31
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch 5 times, most recently from 5ba2854 to e01f4ad Compare June 11, 2024 23:34
async.fn.writefile(test_properties.output, test_output_path)
neotest_results[test_properties.node_data.id] = {
status = test_properties.status,
output = test_output_path, -- NOTE: could be slow when running many tests?
Copy link
Owner Author

Choose a reason for hiding this comment

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

This should definitively be configurable. To keep reliability/stability higher, it's possible that the default should be to disable this and instead refer to the full output here for each test.

@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch 5 times, most recently from 2ebfc9f to e8b9e68 Compare June 15, 2024 08:56
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch from d3bc87f to ba05767 Compare June 15, 2024 15:05
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch from 1924f9b to 78a7fa0 Compare June 15, 2024 20:03
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch from 78a7fa0 to 3006146 Compare June 15, 2024 20:10
@fredrikaverpil fredrikaverpil force-pushed the rnd-run-testfolder-populate-statuses branch from 5b9a69a to 0d58b21 Compare June 15, 2024 21:14
@fredrikaverpil
Copy link
Owner Author

I'm concluding the discovery process here, and closing this PR in favour for #32

@fredrikaverpil fredrikaverpil deleted the rnd-run-testfolder-populate-statuses branch June 24, 2024 20:49
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.

1 participant