v0.8.0
Extending Interchange Formats & Subset Testing (v0.8.0)
Hello!
This patch introduces the ability to select your output format, which should help with editor integrations in the future.
If you use OUTPUT_FORMAT=JSON
or -f json
, you are able to have Pineapple output to an ndjson stream which should be more easily parsable by a program.
For reference:
✔ Passed test (fib): 1
✔ Passed test (fib): 3
✔ Passed test (fib): 10
✔ Passed test (add): 1, 2
✔ Passed test (add): '4', 3 throws
✔ Passed test (add): 1, '0' throws
✔ Passed test (add): -1, 1
✔ Passed test (add): -1, 1 to 0
✖ Failed test (add): -1, 1 to -1
Will become the following in JSON mode:
{"type":"Success","name":"fib","input":"1","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:39"}
{"type":"Success","name":"fib","input":"3","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:40"}
{"type":"Success","name":"fib","input":"10","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:41"}
{"type":"Success","name":"add","input":"1, 2","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:2"}
{"type":"Success","name":"add","input":"'4', 3 throws","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:3"}
{"type":"Success","name":"add","input":"1, '0' throws","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:4"}
{"type":"Success","name":"add","input":"-1, 1","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:5"}
{"type":"Success","name":"add","input":"-1, 1 to 0","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:6"}
{"type":"Failure","name":"add","input":"-1, 1 to -1","message":"- Expected\n+ Received\n\n- -1\n+ 0","file":"file:///Users/jesse/Documents/Projects/pineapple/test/math.js:7"
This release also introduces the ability to run a subset of tests using the --only
flag.
Additionally, it adds the file name & line number to failed test output (even in pretty mode), which should make it easier to jump to your test cases.