Sha256: 03eaffc94c57253e248021172e36f91400097bd735a3ffc1a3240c3ed2fcfee9

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

/**
 * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
 *
 * @constructor
 */
jasmine.NestedResults = function() {
  /**
   * The total count of results
   */
  this.totalCount = 0;
  /**
   * Number of passed results
   */
  this.passedCount = 0;
  /**
   * Number of failed results
   */
  this.failedCount = 0;
  /**
   * Was this suite/spec skipped?
   */
  this.skipped = false;
  /**
   * @ignore
   */
  this.items_ = [];
};

/**
 * Roll up the result counts.
 *
 * @param result
 */
jasmine.NestedResults.prototype.rollupCounts = function(result) {
  this.totalCount += result.totalCount;
  this.passedCount += result.passedCount;
  this.failedCount += result.failedCount;
};

/**
 * Tracks a result's message.
 * @param message
 */
jasmine.NestedResults.prototype.log = function(message) {
  this.items_.push(new jasmine.MessageResult(message));
};

/**
 * Getter for the results: message & results.
 */
jasmine.NestedResults.prototype.getItems = function() {
  return this.items_;
};

/**
 * Adds a result, tracking counts (total, passed, & failed)
 * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
 */
jasmine.NestedResults.prototype.addResult = function(result) {
  if (result.type != 'MessageResult') {
    if (result.items_) {
      this.rollupCounts(result);
    } else {
      this.totalCount++;
      if (result.passed()) {
        this.passedCount++;
      } else {
        this.failedCount++;
      }
    }
  }
  this.items_.push(result);
};

/**
 * @returns {Boolean} True if <b>everything</b> below passed
 */
jasmine.NestedResults.prototype.passed = function() {
  return this.passedCount === this.totalCount;
};

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
evergreen-0.1 lib/jasmine/src/NestedResults.js
jasnode-0.4.3.0 jasmine/src/NestedResults.js
jasnode-0.4.2.0 jasmine/src/NestedResults.js
jasnode-0.4.1.0 jasmine/src/NestedResults.js
jasnode-0.4.0.0 jasmine/src/NestedResults.js
jasnode-0.2.0.0 jasmine/src/NestedResults.js