this function is invoked by blanket.js when the coverage data is ready.  it will compute per-file coverage info, and send a message to the parent phantomjs process for each file, which the grunt task will use to report passes & failures.
16743
function(cov){
        cov = window._$blanket;

        var sortedFileNames = [];

        var totals =[];

        for (var filename in cov) {
            if (cov.hasOwnProperty(filename)) {
                sortedFileNames.push(filename);
            }
        }

        sortedFileNames.sort();

        for (var i = 0; i < sortedFileNames.length; i++) {
            var thisFile = sortedFileNames[i];
            var data = cov[thisFile];
            var thisTotal= reportFile( data );
            sendMessage("blanket:fileDone", thisTotal, thisFile);
        }

        sendMessage("blanket:done");

    }
969182
function() {
      if (dest) {
        // Restore console.log to original and write the output
        console.log = consoleLog;

        if (!grunt.file.exists(dest)) {
            // Write only if our reporter ignored our `output` option
            grunt.file.write(dest, output.join('\n'));
        }
      }
      var stats = helpers.reduceStats(testStats);

      if (stats.failures === 0) {
        var okMsg = stats.tests + ' passed!' + ' (' + stats.duration + 's)';

        if (options.growlOnSuccess) {
          growl(okMsg, {
            image: asset('growl/ok.png'),
            title: okMsg,
            priority: 3
          });
        }

        grunt.log.ok(okMsg);

        // Async test pass
        done(true);

      } else {
        var failMsg = stats.failures + '/' + stats.tests + ' tests failed (' +
          stats.duration + 's)';

        // Show Growl notice, if avail
        growl(failMsg, {
          image: asset('growl/error.png'),
          title: failMsg,
          priority: 3
        });

        // Bail tests if bail option is true
        if (options.bail) {
          grunt.warn(failMsg);
        } else {
          grunt.log.error(failMsg);
        }

        // Async test fail
        done(false);
      }
    }
722475
function checkPhantomjsVersion(phantomPath) {
  console.log('Found PhantomJS at', phantomPath, '...verifying')
  return kew.nfcall(cp.execFile, phantomPath, ['--version']).then(function (stdout) {
    var version = stdout.trim()
    if (helper.version == version) {
      return true
    } else {
      console.log('PhantomJS detected, but wrong version', stdout.trim(), '@', phantomPath + '.')
      return false
    }
  }).fail(function (err) {
    console.error('Error verifying phantomjs, continuing', err)
    return false
  })
}
1284492
function () {

      try {

        // we're creating a simple reporter to:
        // 1. track stats on the specs run
        // 2. mimic a 'finished' callback
        function FinishedReporter () {
          this.total = this.passed = this.failed = 0;
        }

        FinishedReporter.prototype = {
          reportRunnerResults: function (runner) {
            window.__runner__.failures = this.failed;
            window.__runner__.passed = (this.failed === 0);
            window.__runner__.finished = true;
          },

          reportSpecStarting: function (spec) {
            this.total++;
          },

          reportSpecResults: function(spec) {
            if (spec.results().skipped) {
              return;
            }

            spec.results().passed() ? this.passed++ : this.failed++;
          }
        };

        // this reporter is always added last
        jasmineEnv.addReporter(new FinishedReporter());

        jasmineEnv.execute();

        return true;
      }
      catch (e) {
        var out = 'Script Error in PhantomJS\n\nMessage:\n  ' + e.message +
          '\nStack:\n  ' + e.stack + '\n';

        console.log(out);

        return false;
      }
    }
440828
function (cfg, state, n) {
        cfg.args = cfg.args || {};
        var phantomPath = cfg.phantomPath;
        var controlScript = pathUtil.join(__dirname, '../browsers/phantomjs-control-script.js');

        var args = [];
        args.push(controlScript);
        args.push("--auto-exit");
        if (cfg.args.autoExitPolling) {
            args.push("--auto-exit-polling=" + cfg.args.autoExitPolling);
        }
        if (typeof n == "undefined") {
            n = Math.round(Math.random() * 1000) % 1000;
        }
        args.push("--instance-id=" + n);
        args.push(cfg.slaveURL);

        var phantomProcess = spawn(phantomPath, args, {
            stdio: "pipe"
        });
        if (cfg.pipeStdOut) {
            phantomProcess.stdout.pipe(process.stdout);
            phantomProcess.stderr.pipe(process.stderr);
        }
        if (cfg.onData) {
            phantomProcess.stdout.on("data", cfg.onData);
        }
        phantomProcess.on("exit", cfg.onExit || this.createPhantomExitCb(cfg, state, n).bind(this));
        phantomProcess.on("error", cfg.onError || this.createPhantomErrorCb(cfg, state, n).bind(this));
        return phantomProcess;
    }
235598
function(callback) {
				async.each(task.files, function(file, callback2) {
					var srcPath = file.src[0],
						extName = path.extname(srcPath).toLowerCase();

					// if it’s an SVG or a PDF, copy the file to the output dir
					if (extName === '.svg' || extName === '.pdf') {
						var dstPath = getDestination(srcPath, file.dest, false, options);
						fs.copy(srcPath, dstPath, function(err){
							if (err) {
								grunt.fail.fatal(err);
							}

							outputFiles.push(dstPath);
							callback2(null);
						});
					} else {
						callback2(null);
					}

				}, callback);
			}
1231302
function jscoverageFromIstanbulCoverage(coverage, chdir) {
  var jscov = {}, file, filename, hitCount, line, sid;

  chdir = chdir || process.cwd();

  for (file in coverage) {
    filename = path.relative(chdir, file);
    jscov[filename] = {};
    jscov[filename]['source'] = fs.readFileSync(file).toString().split('\n');

    for (line = 0; line < jscov[filename]['source'].length; ++line) {
      jscov[filename][line] = null;
    }

    for (sid in coverage[file].s) {
      if (coverage[file].s.hasOwnProperty(sid)) {
        hitCount = coverage[file].s[sid];
        if (typeof(coverage[file].statementMap[sid]) !== 'undefined') {
          line = coverage[file].statementMap[sid].start.line;
          jscov[filename][line] = hitCount;
        } else {
          // somehow log an error here.  Recommendations welcome.
          // Can this error ever happen in the first place?
        }
      }
    }
  }

  return jscov;
}
1012957
function run(cmd){

        var proc = require('child_process'),
            done = grunt.task.current.async(); // Tells Grunt that an async task is complete

        proc.exec(cmd,
            function(error, stdout, stderr){
                if(stderr){
                    grunt.log.writeln('ERROR: ' + stderr).error();
                }
                grunt.log.writeln(stdout);
                done(error);
            }
        );
    }
1142369
function suiteComplete(result) {
		if (result.coverage) {
			coverageCollector.addCoverage(result.coverage);
		}

		// Have all suites completed?
		let completedSuites = suitesWithState('complete');
		if(Object.keys(completedSuites).length < Object.keys(suites).length) {
			return;
		}
		// All suites have completed, send the “complete” message to karma
		if(isDebug) {
			let [total, finished] = countTests();
			console.debug(`All ${Object.keys(suites).length} suites have completed, ran ${finished} of ${total} tests`);
		}
		if (result.coverage) {
			result.coverage = coverageCollector.getFinalCoverage();
		}
		karma.complete(result);
	}
207634
function JSONReporter (runner) {
  Base.call(this, runner)

  var self = this
  var tests = []
  var pending = []
  var failures = []
  var passes = []

  runner.on('test end', function (test) {
    tests.push(test)
  })

  runner.on('pass', function (test) {
    passes.push(test)
  })

  runner.on('fail', function (test) {
    failures.push(test)
  })

  runner.on('pending', function (test) {
    pending.push(test)
  })

  runner.on('end', function () {
    var obj = {
      stats: self.stats,
      tests: tests.map(clean),
      pending: pending.map(clean),
      failures: failures.map(clean),
      passes: passes.map(clean)
    }

    runner.testResults = obj

    process.stdout.write(JSON.stringify(obj, null, 2))
  })
}
259507
def coverage():
    """"""
    run("coverage run --source {PROJECT_NAME} -m py.test".format(PROJECT_NAME=PROJECT_NAME))
    run("coverage report -m")
    run("coverage html")

    webbrowser.open('file://' + os.path.realpath("htmlcov/index.html"), new=2)
995688
function (cfg, state, n) {
        // Node 0.8 and 0.10 differently handle spawning errors ('exit' vs 'error'), but errors that happened after
        // launching the command are both handled in 'exit' callback
        return function (code, signal) {
            // See http://tldp.org/LDP/abs/html/exitcodes.html and http://stackoverflow.com/a/1535733/
            if (code === 0 || signal == "SIGTERM" || state.resetCalled) {
                return;
            }

            var isNotRecoverable = (code == 127 || code == 126);
            if (isNotRecoverable) {
                ++state.erroredPhantomInstances;
                var path = cfg.phantomPath;
                if (code == 127) {
                    logger.logError("Spawn: exited with code 127. PhantomJS executable not found. Make sure to download PhantomJS and add its folder to your system's PATH, or pass the full path directly to Attester via --phantomjs-path.\nUsed command: '" + path + "'");
                } else if (code == 126) {
                    logger.logError("Spawn: exited with code 126. Unable to execute PhantomJS. Make sure to have proper read & execute permissions set.\nUsed command: '" + path + "'");
                }
                checkIfAllPhantomsDied(cfg, state);
                return;
            }

            // Now, try to recover unless retried too many times

            // prepare error message
            var errMsg;
            if (code == 75) {
                errMsg = "Spawn: PhantomJS[" + n + "] exited with code 75: unable to load attester page within specified timeout, or errors happened while loading.";
                if (cfg.phantomInstances > 1) {
                    errMsg += " You may try decreasing the number of PhantomJS instances in attester config to avoid that problem.";
                }
            } else {
                errMsg = "Spawn: PhantomJS[" + n + "] exited with code " + code + " and signal " + signal;
            }

            // check how many retries happened for this instance
            var retries = state.retries;
            retries[n] = (retries[n] || 0) + 1;
            if (retries[n] < cfg.maxRetries) {
                // log just a warning and try rebooting
                logger.logWarn(errMsg);
                logger.logWarn("Trying to reboot instance nr " + n + "...");
                this.bootPhantom(cfg, state, n);
            } else {
                logger.logError(errMsg);
                ++state.erroredPhantomInstances;
                checkIfAllPhantomsDied(cfg, state);
            }
        };
    }
399163
function() {
        // Log results.
        if (utils.status.failed > 0 || utils.status.total === 0) {
          grunt.log.writeln();
          grunt.log.writeln('Failed Assertions:');
          // Log failed assertions
          utils.logFailedAssertions(phantomjsHooks.failedAssertions);
          // Warn unless force option is passed
          utils.warnUnlessForced(options.force);
        }
        else {
          grunt.log.writeln();
          grunt.log.ok(utils.status.total.toString().green + ' assertions passed');
          grunt.log.ok('duration: ' + utils.status.duration + 'ms');
        }

        // If resemble is on
        if(options.resemble && options.originalScreenshotPath) {
         resembleOptions = typeof options.resemble === 'object' ? options.resemble : {};

          grunt.config.merge({
            'qunit-resemble': {
              qunit: {
                options: {
                  screenshotPath: options.screenshotPath,
                  originalScreenshotPath: options.originalScreenshotPath,
                  diffScreenshotPath: options.diffScreenshotPath,
                  errorDiffPath: options.errorDiffPath,
                  errorColor: resembleOptions.errorColor,
                  errorType: resembleOptions.errorType,
                  transparency: resembleOptions.transparency
                }
              }
            }
          });

          grunt.task.run('qunit-resemble:qunit');
        }

        done(utils.status.failed === 0);
      }
171500
function startWatcherForLinting (src)
{
    watch(src,
        function (file)
        {
            if (file.path)
            {
                lintFiles(file.path);
            }
        }
    );
}
1315546
def coverage():
    ""
    coverage_index = path("build/coverage/index.html")
    coverage_index.remove()
    sh("paver test")
    coverage_index.exists() and webbrowser.open(coverage_index)
1101573
def post_report(coverage, args):
    """"""
    response = requests.post(URL, files={'json_file': json.dumps(coverage)},
                             verify=(not args.skip_ssl_verify))
    try:
        result = response.json()
    except ValueError:
        result = {'error': 'Failure to submit data. '
                  'Response [%(status)s]: %(text)s' % {
                      'status': response.status_code,
                      'text': response.text}}
    print(result)
    if 'error' in result:
        return result['error']
    return 0
757797
function spawnJSDoc(paths) {
  return new Promise((resolve, reject) => {
    let output = '';
    let errors = '';
    const cwd = path.join(__dirname, '..');
    const child = spawn(jsdoc, ['-c', jsdocConfig].concat(paths), {cwd: cwd});

    child.stdout.on('data', data => {
      output += String(data);
    });

    child.stderr.on('data', data => {
      errors += String(data);
    });

    child.on('exit', code => {
      if (code) {
        reject(new Error(errors || 'JSDoc failed with no output'));
        return;
      }

      let info;
      try {
        info = parseOutput(output);
      } catch (err) {
        reject(err);
        return;
      }
      resolve(info);
    });
  });
}