2

So I have some simple unit tests setup in busted. I am a little new to LUA, so I may be missing something obvious.

When I run:

lua test.lua

I get expected results (7 succeed, 1 failed on purpose to try out busted) in the nice terminal output.

My ultimate goal however is to output JSON results, and have a script that consumes JSON from multiple tests to make some summary pages for my fellow WoW addon developers.

When I run:

lua test.lua -o json

my terminal pauses for a brief second, and I am returned to the command line.

There is no terminal output, nor is any file created.

I am relatively new to lua and busted in general, could you provide me any pointers?

Here is a screenshot:

enter image description here

And here is a link to Busted's website.

Thomas W
  • 14,757
  • 6
  • 48
  • 67
Brandon
  • 261
  • 1
  • 8
  • 17
  • Apparently, latest Busted version fails producing JSON output of **some** tests with error code 1. Must try digging deeper... – Kamiccolo Aug 17 '15 at 18:00
  • Also, could You please clarify Lua and Busted versions You're using? – Kamiccolo Aug 17 '15 at 18:06
  • Does `lua -o json test.lua` work by any chance? – Etan Reisner Aug 18 '15 at 17:59
  • 1
    @Kamiccolo LUA version - 5.1.5 Busted version - 2.0.rc10-0 – Brandon Aug 18 '15 at 22:26
  • @EtanReisner That gives me a lua error as it doesn't recognize the -o option. I tried `busted -o json test.lua`. It ran, but produced no output just like my original post. – Brandon Aug 18 '15 at 22:29
  • Ah, true, I had originally been thinking you were running `busted` directly but then realized you were using `lua` without rethinking my argument order question. – Etan Reisner Aug 18 '15 at 23:24

1 Answers1

3

The issue in question was caused by dkjson module not using functions in tables properly. The bug was fixed in pull request #449, so, You should wait for the fix to get to next release candidate (>2.0.rc10-0) of Busted or just download and build recent version from here. Btw, relevant bug report - #448.

Kamiccolo
  • 7,758
  • 3
  • 34
  • 47