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

[test-runner] Allow to pass if no tests #1331

Open
fgblomqvist opened this issue Mar 2, 2021 · 5 comments · May be fixed by #2758
Open

[test-runner] Allow to pass if no tests #1331

fgblomqvist opened this issue Mar 2, 2021 · 5 comments · May be fixed by #2758

Comments

@fgblomqvist
Copy link

If I run e.g. web-test-runner "src/**/*.test.tsx" and there are no files matching that pattern, I get this error:

Error: Could not find any test files with pattern(s): src/**/*.test.tsx

Would be nice if there was a flag that could be passed to allow it to pass if no files are found. This is useful for scaffolds and other initial stages.

@fgblomqvist fgblomqvist changed the title Allow to pass if no tests [test-runner] Allow to pass if no tests Mar 2, 2021
@Westbrook
Copy link
Member

Confirmation question, if you do the same with a config file pointing to the files in question, does it error the same? It's possible that you are running into the unix blob errors that can occur here before you even get into WTR.

Regardless, I'm not sure that this is something that we would likely add to the config/CLI options, though others may speak up differently on the subject. However, if you were to use the following command, you can achieve roughly the same results locally.

test -f "src/**/*.test.tsx" && wtr "src/**/*.test.tsx" ||:

@fgblomqvist
Copy link
Author

Unfortunately I don't have this setup anymore, otherwise I would have tested it. I don't remember seeing a way to code the pattern into the config file, but I might have missed something. Either way, thanks for taking the time to respond! Feel free to close this if the decision is not to support something like it.

@peschee
Copy link
Contributor

peschee commented Mar 12, 2021

@Westbrook I'm having the same issue. I'm passing the files as a glob, not in the config file. But as soon as there are files, it works. When wtr does not find any files, I get the same error.

Your proposal works as a workaround / solution.

@LarsDenBakker
Copy link
Member

Do we know how other test runners deal with this? I think we can follow the convention.

@fgblomqvist
Copy link
Author

jest has a --passWithNoTests option, plain and simple.

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 a pull request may close this issue.

4 participants