Add test command to run any unit test#1092
Merged
ErikSchierboom merged 23 commits intoexercism:mainfrom Jul 28, 2023
xavdid:main
Merged
Add test command to run any unit test#1092ErikSchierboom merged 23 commits intoexercism:mainfrom xavdid:main
test command to run any unit test#1092ErikSchierboom merged 23 commits intoexercism:mainfrom
xavdid:main
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per discussion in this forum post, I've added a
testcommand to the exercism CLI. Much like the universal test runner it's inspired by, its goal is to be able to run the basic unit test suite for any exercism exercise.It does this by:
.exercism/metadata.jsonto get the track name.exercism/config.jsonto get test file name(s) and including themexercism testexec.Commandto run and return info about the exit codeTypes of Tests
Based on my (very brief) sampling of exercism tracks, there are 2 main ways tests are run:
cargo test,go test,lien test, etc)ruby lasagna_test.rb)So, the
TestConfigurationstruct covers both of those cases (by including an option to append the test file(s) to the command).The other configuration option aids in arg passing. Some language tools (namely
cargo) expect arguments to the test command to be after a double dash (--). Unfortunately, so doesCobra,thegoarg parser. So, I was running into the following trying to run rust tests with--include-ignored:exercism test --include-ignored:--include-ignoredis not a valid flag for the test commandexercism test -- --include-ignored:--include-ignoredis not a valid flag forcargo, put it behind a--exercism test -- -- --include-ignored: works as expectedThis isn't great UX though, so I added an option for languages to be able to ask that args to their test runner be put behind an implied
--. This way, the rust command works when run as option 2 above (which is in line with most other languages).TODO