ben-page / node-test

A simple, asynchronous test runner for Node.js.
https://www.npmjs.com/package/node-test
MIT License
4 stars 1 forks source link

Events doesn't get triggered correctly and not in correct order. #11

Closed ghost closed 8 years ago

ghost commented 8 years ago

Let say you have this:


- new suite  #1
     - test #1
     - test #2
- new suite  #2
     - test #1
    - test #2

Current output:

start
testEnd // all testEnd are executed together, not inside the suite it belong to
testEnd
testEnd
testEnd
suiteEnd  //  Where is tests belonging to this suit?
suiteEnd  // Both suiteEnd are executed at the end, but should execute at the end of each suite
end

Expected output regarding js-reports and normal thinking :)

start
suiteStart
testStart
testEnd
testStart
testEnd
suiteEnd
suiteStart
testStart
testEnd
testStart
testEnd
suiteEnd
end
ben-page commented 8 years ago

This is correct. I'm not implementing js-reports. js-reports is insufficient for many usages, especially concurrent tests.

In node-test the tests run concurrently. They effectively all start at the same time and will finish in any order. The order in which the events fire is not deterministic, but the event data makes it very easy to know which test completed.

See the documentation on custom reporters for more info.