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

Do not panic if user puts strange things in tests directory #828

Closed
mkaput opened this issue Oct 27, 2023 · 0 comments · Fixed by #1006
Closed

Do not panic if user puts strange things in tests directory #828

mkaput opened this issue Oct 27, 2023 · 0 comments · Fixed by #1006
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mkaput
Copy link
Member

mkaput commented Oct 27, 2023

Problem

Scarb tests directory target collector is building tests packages named from non-relevant files, like Scarb.toml. This results in trials to create packages named like foo_Scarb etc.

Steps

For the following project with the following tests directory:

https://github.com/gizatechxyz/orion/tree/bbf9833c437b83c7b4dd1fd4dde194717321628a/tests

After being run in Scarb 2.3.0, Scarb started panicking with:

thread 'main' panicked at scarb/src/core/package/name.rs:38:29:
called `Result::unwrap()` on an `Err` value: invalid package name: `orion_Scarb`
note: usage of ASCII uppercase letters in the package name has been disallowed
help: change package name to: orion_scarb
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Possible Solution(s)

Add an error condition in the test collector checking if there are unexpected files and bail with a user-friendly error message, which will cleanly describe what the user's project setup is doing wrong and how the user can fix it.

Notes

Starting point:

fn collect_test_targets(

Additional reference: https://discordapp.com/channels/793094838509764618/1166735890291372063/1166868590797013094

Version

2.3.0
@mkaput mkaput added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Oct 27, 2023
@maciektr maciektr assigned maciektr and unassigned maciektr Oct 27, 2023
@maciektr maciektr self-assigned this Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants