lunarmodules / busted

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

Penlight 1.4.0 breaks build #528

Closed smhxx closed 8 years ago

smhxx commented 8 years ago

Hi there!

Just thought I'd leave you a heads-up as a warning that Busted's next CI build is going to fail. I actually just ran into this problem myself on my own project, caused by a new version of Penlight that was pushed to Luarocks about 3 hours ago. Luarocks will use the new version (1.4.0-1) by default since it falls within the >=1.3.2-2 rule in Busted's rockspec files, and something's changed in pl.path pl.dir that's causing problems. I'm not actually sure the direct cause of the problem, (_EDIT:_ It's a bug in Penlight. See below.) but when I run busted spec with the latest version of Penlight, Busted is no longer able to find the test files.

smhxx@Development:~/GitHub/busted$ sudo luarocks make busted-2.0.rc12-1.rockspec 
Updating manifest for /usr/local/lib/luarocks/rocks
busted 2.0.rc12-1 is now built and installed in /usr/local (license: MIT <http://opensource.org/licenses/MIT>)

smhxx@Development:~/GitHub/busted$ busted spec

0 successes / 0 failures / 1 error / 0 pending : 0.000033 seconds

Error → No test files found matching Lua pattern: _spec

smhxx@Development:~/GitHub/busted$ sudo luarocks make busted-scm-0.rockspec 
Updating manifest for /usr/local/lib/luarocks/rocks
busted scm-0 is now built and installed in /usr/local (license: MIT <http://opensource.org/licenses/MIT>)

Checking stability of dependencies on the absence of
busted 2.0.rc12-1...

Removing busted 2.0.rc12-1...
Removal successful.
smhxx@Development:~/GitHub/busted$ busted spec

0 successes / 0 failures / 1 error / 0 pending : 0.000022 seconds

Error → No test files found matching Lua pattern: _spec

Anyway, I'm just updating my .travis.yml for now to use the older version of Penlight, just thought I'd help out and bring this to your attention so that it doesn't come as a surprise the next time you commit. Cheers!

smhxx commented 8 years ago

To clarify, I've done some digging and I believe that this is a bug in Penlight's dir.getallfiles() method. I'm pretty sure Busted should be fine once it is resolved. I'm going to keep at it and see if I can figure out for sure what's going on, and I'll submit a PR to Penlight if I can verify that my suspicions are correct.

EDIT: I went ahead and fixed the bug and submitted a PR to the Penlight repo. I'd recommend just having Travis use the old version (1.3.2-2) until the issue is resolved. :)

jszakmeister commented 8 years ago

FWIW, this issue manifests itself as the following when running with TAP support:

/Users/jszakmeister/projects/neovim/neovim/.deps/usr/bin/luajit: ...im/.deps/usr/share/lua/5.1/busted/outputHandlers/TAP.lua:33: attempt to concatenate field 'currentline' (a nil value)
stack traceback:
        ...im/.deps/usr/share/lua/5.1/busted/outputHandlers/TAP.lua:33: in function 'showFailure'
        ...im/.deps/usr/share/lua/5.1/busted/outputHandlers/TAP.lua:72: in function 'fn'
        ...jects/neovim/neovim/.deps/usr/share/lua/5.1/mediator.lua:103: in function 'publish'
        ...ps/usr/share/lua/5.1/busted/modules/test_file_loader.lua:93: in function 'testFileLoader'
        .../neovim/neovim/.deps/usr/share/lua/5.1/busted/runner.lua:158: in function <.../neovim/neovim/.deps/usr/share/lua/5.1/busted/runner.lua:11>
        ...deps/usr/lib/luarocks/rocks/busted/2.0.rc12-1/bin/busted:3: in main chunk
        [C]: at 0x01000010c0

CMake Error at /Users/jszakmeister/projects/neovim/neovim/cmake/RunTests.cmake:39 (message):
  Running unit tests failed with error: 1.
smhxx commented 8 years ago

Update: The bugfix is now merged into Penlight/master, so the next time they push to Luarocks it should fix everything. I guess it's up to the maintainer whether they're going to do a 1.4.0-2 version right away (I would hope so) or wait to see if any new problems crop up. All in all, it's been a year since the last update to Penlight, so something was pretty much guaranteed to be off... good thing it was literally a one-character fix! (Smallest PR ever?)

ajacksified commented 8 years ago

I'll point to 1.4.0-2 (or whatever they choose) once it goes live - thanks!

mpeterv commented 8 years ago

Penlight 1.4.1 has been released with a fix for this issue.

smhxx commented 8 years ago

Cool, thanks @mpeterv!