SamirTalwar / smoke

Runs tests against anything, using command-line arguments, STDIN, STDOUT and STDERR.
MIT License
90 stars 11 forks source link

Run tests from within the test file's directory #88

Closed jonaprieto closed 1 year ago

jonaprieto commented 1 year ago

Let Smoke discover and run all the tests available within a folder. The flag can be --execdir as in shelltestrunner. One optional flag could be -r --recursive if one wants to traverse the whole input directory.

The user may want to provide the extension for the test files to perform the search. I suggest having the suffix .smoke.yaml for this. The option flag can be --extension.

SamirTalwar commented 1 year ago

You can point it to a directory, and it'll find all the YAML files in there, or you can just pass it a bunch of arguments (or a glob):

$ smoke test/*.smoke.yaml
jonaprieto commented 1 year ago

Is this feature you mentioned working? I'm getting an error, running it with fish and bash.

❯ smoke tests/*.smoke.yaml
fish: No matches for wildcard 'tests/*.smoke.yaml'. See `help wildcards-globbing`.
smoke tests/*.smoke.yaml
      ^
❯ bash
$ smoke tests/smoke/*.smoke.yaml
There is no such location "tests/smoke/*.smoke.yaml".
[jonaprieto@fedora juvix]$ find tests/ -name "*.smoke.yaml"
tests/smoke/Commands/compile.smoke.yaml
...
SamirTalwar commented 1 year ago

Glob expansion is a feature of your shell, not Smoke. echo tests/*.smoke.yaml will yield the same error.

You can try a recursive glob (I don't know if fish supports this):

$ smoke tests/**/*.smoke.yaml

Or you can use the output of find:

$ smoke $(find tests -name '*.smoke.yaml')
jonaprieto commented 1 year ago
$ smoke $(find tests -name '*.smoke.yaml')

Thanks. This works for me.

SamirTalwar commented 1 year ago

Great. I'll improve the docs and then close this issue.