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

Provide some kind of "coverage" warning/error if a test file includes code outside a testitem #43

Open
NHDaly opened this issue Jan 20, 2023 · 2 comments

Comments

@NHDaly
Copy link

NHDaly commented Jan 20, 2023

If you have a test file that has a typo in it, and accidentally looks like this:

# src/foo_test.jl
@testitem "test 1" begin
    ...
end

@testiteem "test 2" begin
    ...
end

You'll notice that there is a typo in the definition of test 2: @testiteem.

But since this file isn't included anywhere, it's never actually executed by anything, and so no one will ever warn you that this test item macro is malformed! 😱

So it seems like we'll need some kind of ability to report on lines in a "test file" that weren't covered.
Maybe this is just integrating with the standard coverage report, and generating code coverage on the test files? Maybe that'll "just work" if you put your testitems in the src/ directory?

@NHDaly
Copy link
Author

NHDaly commented Jan 20, 2023

CC: @nickrobinson251

@davidanthoff
Copy link
Member

Another option would be to have a "strict test file" option. If that is enabled, if there is a Julia file that has anything other than @testitem or @testsetup in it, then we report an error. Could even be a separate file extension, I guess?

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

No branches or pull requests

2 participants