totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 450 forks source link

Test count smaller than pass count #557

Closed ckpiggy closed 7 years ago

ckpiggy commented 7 years ago

I use multiple FAIL() or OK() in one test, and here are the logs.

===================== TESTING ======================

[ TEST: api-response.js ]

Passed ............. err resp <expect 400 status got 400> [49 ms]
Passed ............. json resp <expect data.res === "test" got test> [31 ms]
Passed ............. json resp <expect 200 status got 200> [31 ms]

[ TEST: events.js ]

sqlagent/mongodb (490) ----- exec
sqlagent/mongodb (490) ----- done (9 ms)
Passed ............. create event <expect 200 status> [27 ms]
Passed ............. create event <expect identity> [27 ms]

===================== RESULTS ======================

> Passed ......... 5/3
> Failed ......... 0/3

Test count is smaller than pass count.

I am not sure which is better :

planA: Move T.count++ from global.Test to logger

planB: If one check in a test failed, then the test failed, we should skip remain checks in the test and T.countno++. The test should pass only if all the checks in the test passed, and T.countok++.

petersirka commented 7 years ago

@ckpiggy can you update it? Maybe planA will be enough. Thank you!