How to use the jasmine.ConsoleReporter function in jasmine

To help you get started, we’ve selected a few jasmine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yeoman / yeoman-app / spec / renderer-process / helpers / bootstrap.js View on Github external
var remote = require('remote');
var app = remote.require('app');
var pkgJson = require('../../../package.json');

// Start the crash reporter before anything else
require('crash-reporter').start({
  productName: pkgJson.name,
  companyName: 'atom-shell-starter'
});

var specRootPath = path.resolve(__dirname, '..');

if (global.loadSettings.exitWhenDone) {
  var jasmineFn = require('jasmine');
  jasmineFn(global.jasmine);
  var reporter = new jasmineFn.ConsoleReporter({
    print: function (str) {
      process.stderr.write(str);
    },

    onComplete: function (allPassed) {
      return app.exit(allPassed ? 0 : 1);
    }
  });

  var jasmineEnv = jasmine.getEnv();
  jasmineEnv.addReporter(reporter);
  fs.listTreeSync(specRootPath).forEach(function (specFilePath) {
    if (/-spec\.js$/.test(specFilePath)) {
      require(specFilePath);
    }
  });
github angular / zone.js / gulpfile.js View on Github external
jrunner.configureDefaultReporter({showColors: true});

  jrunner.onComplete(function(passed) {
    if (!passed) {
      var err = new Error('Jasmine node tests failed.');
      // The stack is not useful in this context.
      err.showStack = false;
      cb(err);
    } else {
      cb();
    }
  });
  jrunner.print = function(value) {
    process.stdout.write(value);
  };
  jrunner.addReporter(new JasmineRunner.ConsoleReporter(jrunner));
  jrunner.projectBaseDir = __dirname;
  jrunner.specDir = '';
  jrunner.addSpecFiles(specFiles);
  jrunner.execute();
}
github yeoman / yeoman-app / spec / helpers / bootstrap.js View on Github external
var fs = require('fs-plus');
var path = require('path');
var electron = require('electron');
var app = electron.remote.app;
var newLine = require('os').EOL;

var specRootPath = path.resolve(__dirname, '..');

if (global.loadSettings.exitWhenDone) {
  var jasmineFn = require('jasmine');
  jasmineFn(global.jasmine);
  var out = '';
  var reporter = new jasmineFn.ConsoleReporter({
    print: function (str) {
      if (str === newLine) {
        electron.remote.getGlobal('console').log(out);
        out = '';
        return;
      }
      out += str;
    },

    onComplete: function (allPassed) {
      return app.exit(allPassed ? 0 : 1);
    }
  });

  var jasmineEnv = jasmine.getEnv();
  jasmineEnv.addReporter(reporter);