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

Count files under spec/ as test files #7730

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

KaanOzkan
Copy link
Contributor

@KaanOzkan KaanOzkan commented Feb 28, 2024

Is this acceptable given this code path is used for more than highlight T.untyped feature?

Motivation

Rspec style tests put tests under the spec folder which is currently not supported for everywhere-but-tests option for highlightUntyped feature.

Test plan

I couldn't find tests for this file.

@KaanOzkan KaanOzkan requested a review from a team as a code owner February 28, 2024 21:18
@KaanOzkan KaanOzkan requested review from jez and removed request for a team February 28, 2024 21:18
@jez
Copy link
Collaborator

jez commented Feb 28, 2024

Hey unfortunately we can't take this patch as implemented—we'll probably have to make a command line for this, which makes it into a bit of a larger change (because the place where isTestPath is called does not have access to an Options nor GlobalState argument).

Stripe's codebase has about 50 files inside /spec/ where the presence of /spec/ in the name does not mean that the file is a test file. This option is also used with the --stripe-packages flag, which is Stripe's mechanism for enforcing modularity between logical packages. That packaging system differentiates between test and non-test files, and has a way to mark imports and definitions as "test-only," which get special treatment.

If we can make what counts as a test configurable per project I'd be happy to review it.

Copy link
Collaborator

@jez jez left a comment

Choose a reason for hiding this comment

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

^

@KaanOzkan
Copy link
Contributor Author

@jez understandable. Would you be okay with using a separate flag for this or doing the check inline in infer.cc (path seems to be a public field)?

I think this use case is common enough that it's better to support inside Sorbet rather than individual project configurations.

@jez
Copy link
Collaborator

jez commented Feb 28, 2024

I don't quite know what you mean by saying both

Would you be okay with using a separate flag for this

and also

I think this use case is common enough that it's better to support inside Sorbet rather than individual project configurations.

Could you clarify what you're suggesting?

@KaanOzkan
Copy link
Contributor Author

KaanOzkan commented Feb 28, 2024

I pushed 2 commits to show the different solutions. I thought you meant this PR is an issue due to --stripe-packages feature and Stripe codebase. Instead if the problem is that you want the everywhere-but-tests flag to still include spec/ folder in Stripe then yes it'd have to be customizable. With either an opt in or an opt out CLI flag.

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.

None yet

2 participants