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

feat(cli/test): deno test --clean #23519

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

Conversation

iuioiua
Copy link
Collaborator

@iuioiua iuioiua commented Apr 24, 2024

The result of the call is ignored as it throws even when the directory does not exist.

Closes #23491

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Please add an integration test

@lucacasonato
Copy link
Member

This has the downside that you can not run multiple deno test calls in parallel, or even in series unless you specify a different directories.

@iuioiua
Copy link
Collaborator Author

iuioiua commented Apr 25, 2024

I think it's a fair trade-off, as long as the behaviour is clearly documented. Perhaps, if we receive too many complaints, which we may not, we can add a --no-clean, or similar, flag.

For context, I recently waited for ~5 minutes on my M2 MacBook to delete /coverage for std.

@lucacasonato
Copy link
Member

The point is, as is, this PR breaks existing workflows

@iuioiua
Copy link
Collaborator Author

iuioiua commented Apr 25, 2024

We could make this behaviour opt-in via --clean-cov-dir (or similar) and then at some point decide whether we make this default behaviour in Deno 2.

@iuioiua
Copy link
Collaborator Author

iuioiua commented May 1, 2024

I've changed my mind. I think this should just be opt-in for good.

@iuioiua iuioiua changed the title fix(cli/test): empty coverage directory first feat(cli/test): deno test --clean May 1, 2024
@iuioiua iuioiua requested a review from lucacasonato May 1, 2024 00:50
@bartlomieju bartlomieju added this to the 1.44 milestone May 5, 2024
Comment on lines +2463 to +2470
.arg(
Arg::new("clean")
.long("clean")
.help("Empty the coverage profile data directory before running tests.

Note: running multiple `deno test --clean` calls in series or parallel for the same coverage directory may cause race conditions.")
.action(ArgAction::SetTrue),
)
Copy link
Member

Choose a reason for hiding this comment

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

This makes sense, but I'm wondering if we should reword this to say

"Empty any temporary files created by `deno test` before running the tests. Currently this includes coverage data, but may change in the future."

Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I feel like saying it might change in the future might cause some confusion. IMO, how it is now is fine. At most, we could do "Empty the temporary coverage profile data..."

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.

deno test --coverage should clear the coverage directory first
3 participants