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

deno test --exclude #23731

Closed
alexgleason opened this issue May 8, 2024 · 3 comments
Closed

deno test --exclude #23731

alexgleason opened this issue May 8, 2024 · 3 comments
Labels
cli related to cli/ dir help wanted community help requested suggestion suggestions for new features (yet to be agreed) testing related to deno test and coverage

Comments

@alexgleason
Copy link
Contributor

alexgleason commented May 8, 2024

I would like to exclude some files with the command line, so I can skip certain tests in my CI.

It's possible to exclude certain tests with deno.json by adding a test.exclude property, but this applies to all invocations of deno test, even when you specify an excluded file directly by filename. So, I have to delete it from deno.json when I want to run those tests manually.

I couldn't find any --exclude option in deno test, but it seems like it should exist.

EDIT: It is also possible to set { ignore: true } in the test options, and even { ignore: Deno.env.get('CI') === 'true' }, eg:

Deno.test('NDatabase.query with postgres fts', { ignore: !Deno.env.get('DATABASE_URL') }, async (t) => {

This is a little better than using text.exclude in deno.json, but it only works on individual tests, not entire files. So it becomes a maintenance problem when you have a lot of tests.

@marvinhagemeister marvinhagemeister added cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) testing related to deno test and coverage labels May 8, 2024
@bartlomieju
Copy link
Member

Seems reasonable. PRs are welcome!

@bartlomieju bartlomieju added the help wanted community help requested label May 16, 2024
@Hasan-Alrimawi
Copy link
Contributor

Hasan-Alrimawi commented May 28, 2024

Hello @bartlomieju ,
during investigation to address this issue, I came across --ignore flag that can be paired with deno test command and it WORKS on entire files.
Check fn resolve_files within deno/cli/args/mod.rs
It seems to me that it fulfills what @alexgleason is trying to accomplish.

Can you @bartlomieju please confirm it, because if so, then there's no need to support --exclude.

@alexgleason
Copy link
Contributor Author

Confirmed --ignore solves my problem. I just couldn't find it. Thank you for figuring this out @Hasan-Alrimawi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir help wanted community help requested suggestion suggestions for new features (yet to be agreed) testing related to deno test and coverage
Projects
None yet
Development

No branches or pull requests

4 participants