lunarmodules / busted

Elegant Lua unit testing.
https://lunarmodules.github.io/busted/
MIT License
1.39k stars 184 forks source link

could busted exclude all testcase in sub dir? #669

Closed ykxpb closed 2 years ago

ykxpb commented 2 years ago

https://github.com/Olivine-Labs/busted/blob/cceb81b25d9f3daf7cb97dc1b630df8a8f72302d/busted/modules/test_file_loader.lua#L14-L36

exclude-pattern only exclude basename.

Tieske commented 2 years ago

Not sure what you mean exactly? could you create a testcase that shows the intended behaviour?

ykxpb commented 2 years ago

test file tree

testdir/foo/a.spec.lua
testdir/b.spec.lua

in .busted config file

["exclude-pattern"] = "foo"

expect a.spec.lua excluded

alerque commented 2 years ago

@ykxpb Does tagging your tests not work for your use case?

Tieske commented 2 years ago

see code here: https://github.com/Olivine-Labs/busted/commit/52cc01016dbb6a43510613663b0adf29291453d4#diff-9b0f5f2823375d63df9ecc9e211902db4567c0b9b87388a4812a0287f9981071R24 It checks against path.basename which is only the filename(+ext) part, so not the full path.