Skip to content

Conversation

zankich
Copy link

@zankich zankich commented May 10, 2023

While taking a look at #47 I noticed that the testify output wasn't correctly being parsed which may have contributed to the nil reference error.

Testify will reports errors with the format:

Error Trace:    /my-package/my_test.go:49

and

at: [/some-package/file.go:104 /my-package/my_test.go:933]\n

This PR fixes the nil exception and also returns the test diagnostics for failed tests using testify.

@zankich
Copy link
Author

zankich commented May 10, 2023

The tests are probably gonna fail for this PR. How do I run the tests?

Comment on lines 223 to 245
if file_id ~= nil then
-- when executing a function there may be no file_id
results[file_id].status = test_statuses.fail
end
Copy link

Choose a reason for hiding this comment

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

I think file_id is always nil here? So I think that the if statement can be removed completely.

Copy link
Author

Choose a reason for hiding this comment

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

I've seen this value to be nil when executing a t.Run test function.

@sergii4
Copy link
Collaborator

sergii4 commented May 11, 2023

Hi @zankich, to run test you need plenary installed then map:

nmap <leader>t <Plug>PlenaryTestFile

and finally use that mapping when you are in test(spec) file

@zankich
Copy link
Author

zankich commented May 11, 2023

@sergii4 thanks for the tip. The tests pass and this is ready for review.

@sergii4
Copy link
Collaborator

sergii4 commented Jun 27, 2023

Hi @zankich, sorry for late response. Could you please navigate me what issue this PR fixes?

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.

3 participants