<commit_before>/**
 * Module dependencies
 */
var path = require('path');
var fs = require('fs');
var util = require('util');
var mkpath = require('mkpath');
var minimatch = require('minimatch');
var Nightwatch = require('../../index.js');
var Logger = require('../util/logger.js');

module.exports = new (function() {
  var globalStartTime;
  var globalResults = {
    passed : 0,
    failed : 0,
    errors : 0,
    skipped : 0,
    tests : 0,
    errmessages : [],
    modules : {}
  };

  function runModule(module, opts, moduleName, moduleCallback, finishCallback) {
    var client;
    try {
      client = Nightwatch.client(opts);
    } catch (err) {
      console.log(err.stack);
      finishCallback(err, false);
      return;
    }
    var keys = Object.keys(module);
    var currentTest;
    var setUp;
    var tearDown;
    var testResults = {
      passed  : 0,
      failed  : 0,
      errors  : 0,
      skipped : 0,
      tests   : 0,
      steps   : keys.slice(0)
    };

    var onTestFinished = function (results, errors, startTime) {
      globalResults.modules[moduleName][currentTest] = {
        passed  : results.passed,
        failed  : results.failed,
        errors  : results.errors,
        skipped : results.skipped,
        tests   : [].concat(results.tests)
      };

      if (Array.isArray(errors) && errors.length) {
        globalResults.errmessages = globalResults.errmessages.concat(errors);
      }

      globalResults.passed += testResults.passed += results.passed;
      globalResults.failed += testResults.failed += results.failed;
      globalResults.errors += testResults.errors += results.errors;
      globalResults.skipped += testResults.skipped += results.skipped;
      globalResults.tests += testResults.tests += results.tests.length;

      if (opts.output && (opts.modulesNo > 1 || testResults.tests != globalResults.tests || testResults.steps.length > 1)) {
        client.printResult(startTime);<commit_msg>Fixed #164 - an issue with reporting the total number of assertions incorrectly<commit_after>/**
 * Module dependencies
 */
var path = require('path');
var fs = require('fs');
var util = require('util');
var mkpath = require('mkpath');
var minimatch = require('minimatch');
var Nightwatch = require('../../index.js');
var Logger = require('../util/logger.js');

module.exports = new (function() {
  var globalStartTime;
  var globalResults = {
    passed : 0,
    failed : 0,
    errors : 0,
    skipped : 0,
    tests : 0,
    errmessages : [],
    modules : {}
  };

  function runModule(module, opts, moduleName, moduleCallback, finishCallback) {
    var client;
    try {
      client = Nightwatch.client(opts);
    } catch (err) {
      console.log(err.stack);
      finishCallback(err, false);
      return;
    }
    var keys = Object.keys(module);
    var currentTest;
    var setUp;
    var tearDown;
    var testResults = {
      passed  : 0,
      failed  : 0,
      errors  : 0,
      skipped : 0,
      tests   : 0,
      steps   : keys.slice(0)
    };

    var onTestFinished = function (results, errors, startTime) {
      globalResults.modules[moduleName][currentTest] = {
        passed  : results.passed,
        failed  : results.failed,
        errors  : results.errors,
        skipped : results.skipped,
        tests   : [].concat(results.tests)
      };

      if (Array.isArray(errors) && errors.length) {
        globalResults.errmessages = globalResults.errmessages.concat(errors);
      }

      testResults.passed += results.passed;
      testResults.failed += results.failed;
      testResults.errors += results.errors;
      testResults.skipped += results.skipped;
      testResults.tests += results.tests.length;

      globalResults.passed += results.passed;
      globalResults.failed += results.failed;
      globalResults.errors += results.errors;
      globalResults.skipped += results.skipped;
      globalResults.tests += results.tests;

      if (opts.output && (opts.modulesNo > 1 || testResults.tests != globalResults.tests || testResults.steps.length > 1)) {
        client.printResult(startTime);
{'fraction_non_alphanumeric': 0.13112356812088716, 'fraction_numerical': 0.0070679990251035826, 'mean_word_length': 2.68733153638814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5065527', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1182, 'n_words': 273}