midniteio / multi-cuke

Parallel cucumber-js testing via Node's child_process.spawn api
13 stars 4 forks source link

Adding unit tests, some changes to functionality #4

Closed midniteio closed 8 years ago

midniteio commented 8 years ago

This adds unit tests to the project. In the process of defining and asserting expected behavior, some changes were made to the underlying contracts of the parsers, most notably that output is returned rather than print to console by default now (aside from summary output). This is a non-visible change from the consumers viewpoint, but provides a bit easier testing.

Summary output still, by default, prints to console so that this does not become a backwards incompatible change, and to provide an easier usecase for most situations. There is however an additional flag/option for -s / --silentsummary or the silentSummary boolean option, which will suppress the log of summary data. This is done as I've also added the outputHandler to the returned object in the resolved promise, so that you can handle the summary output as desired like so:

multicuke.run().then((results) => {
  // results.outputHandler is the defined parser
  let summaryOutput = results.outputHandler.getSummaryOutput();
  console.log(summaryOutput);
]);

This change is primarily so that, if desired, you can chain multicuke runs, and have access to the data afterwards. The above will allow you to get the summary output, as well as let add the data from another outputHandler to have amalgamated multi-run data. An example is in the readme.