only-cliches/snap-db

`npm test` will exit 0 when unit tests failed

huan opened this issue · 0 comments

huan commented

See: https://travis-ci.com/ClickSimply/snap-db/jobs/281511493

The above log shows that our unit tests failed, however, the CI passed.

I tried to run npm test and see that the tests failed when I'm expecting the exit code is non-zero, but I got an exit code with 0:

$ rm -rf testDB* && ./node_modules/.bin/mocha bin/test-single.js


  SnapDB Tests (Single Thread)
    ✓ Put Data (9736ms)
    1) The count should be zero after puting then deleting
    2) The count should be 1 after put data to the same key multiple times
    ✓ Get non-exist key
    ✓ Call close() for multiple times (344ms)
    ✓ Integer: Sorted Keys
    ✓ Integer: Key Exists
    ✓ Integer: Key Doesn't Exist
    ✓ Integer: Delete Key
    ✓ Integer: Offset Select
    ✓ Integer: Offset Select (Reverse)
    ✓ Integer: Range Select
    ✓ Integer: Range Select (Reverse)
    ✓ Integer: Loading From Log Works (114ms)
    ✓ Float: Sorted Keys
    ✓ Float: Key Exists
    ✓ Float: Key Doesn't Exist
    ✓ Float: Delete Key
    ✓ Float: Offset Select
    ✓ Float: Offset Select (Reverse)
    ✓ Float: Range Select
    ✓ Float: Range Select (Reverse)
    ✓ Float: Loading From Log Works (112ms)
    3) String: Sorted Keys
    ✓ String: Key Exists
    ✓ String: Key Doesn't Exist
    4) String: Delete Key
    ✓ String: Offset Select
    ✓ String: Offset Select (Reverse)
    ✓ String: Range Select
    ✓ String: Range Select (Reverse)
    5) String: Loading From Log Works
    ✓ Any: Sorted Keys
    ✓ Any: Key Exists
    ✓ Any: Key Doesn't Exist
    ✓ Any: Delete Key
    ✓ Any: Offset Select
    ✓ Any: Offset Select (Reverse)
    ✓ Any: Range Select
    ✓ Any: Range Select (Reverse)
    ✓ Any: Loading From Log Works (110ms)
(python3) ┌ huan@huan-home:~/git/snap-db [11:05:03] tty:[1] jobs:[0]
└ {master} $ echo $?
0