Add TestNearest support for Lua's Busted test runner #598
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.
This PR updates the
busted
plugin to add support forTestNearest
so that it will execute the nearest test instead of the entire file (which is the current implementation). The modifications handle bothit
anddescribe
functions. I also wrote some tests for Moonscript to make sure that it works for that style of Lua too.I made this work by taking advantage of the
--filter
flag withbusted
. The--filter
flag expects the value to be a proper Lua pattern. Because of that constraint, the plugin does the proper escaping of the Lua pattern "magic characters" (defined in the Lua docs).There is a small limitation to this implementation. If multiple tests in the same file have the same string description, then
TestNearest
will run all identically labeled tests. This seemed like an acceptable tradeoff because it's still more accurate than running all the tests in a file.PR Checklist:
doc/test.txt