Sha256: 69164671928a88c3f0b72062b90e10fe1e3fd6e2a1e65f587d016cb47f4f92d1

Contents?: true

Size: 1.94 KB

Versions: 6

Compression:

Stored size: 1.94 KB

Contents

JsTestServer.JasmineDriver = {};

JsTestServer.JasmineDriver.init = function() {
  JsTestServer.JasmineDriver.instance = new JsTestServer.JasmineDriver.Instance();
  JsTestServer.JasmineDriver.instance.init();
  JsTestServer.JasmineDriver.instance.startJasmine();
};

JsTestServer.JasmineDriver.Instance = function() {
};

(function(Instance) {
  var jsTestServerReporter;

  Instance.prototype.init = function() {
    this.defineStatusMethod();
  };

  Instance.prototype.defineStatusMethod = function() {
    JsTestServer.status = function() {
      var runnerState;
      var jasmineEnv = jasmine.getEnv();
      jasmineEnv.reporter.log("jsTestServerReporter.finished: " + jsTestServerReporter.finished)

      return JsTestServer.JSON.stringify({
        "runner_state": jsTestServerReporter.runnerState,
        "console": jsTestServerReporter.console
      });
    };
  };

  Instance.prototype.startJasmine = function() {
    var jasmineEnv = jasmine.getEnv();
    jsTestServerReporter = new JsTestServer.JasmineDriver.Reporter();
    jasmineEnv.addReporter(jsTestServerReporter);
    jasmineEnv.addReporter(new jasmine.JsApiReporter());
    jasmine.TrivialReporter.prototype.log = function() {
      if (window.console && window.console.log) window.console.log.apply(window.console, arguments);
    };
    jasmineEnv.addReporter(new jasmine.TrivialReporter());

    window.onload = function() {
      jasmineEnv.execute();
    }
  };

  JsTestServer.JasmineDriver.Reporter = function() {
    this.console = "";
    this.finished = false;
    this.runnerState = "running";
  };
  JsTestServer.JasmineDriver.Reporter.prototype.log = function(str) {
    this.console += (str + "\n");
  };
  JsTestServer.JasmineDriver.Reporter.prototype.reportRunnerResults = function(runner) {
    this.finished = true;
    if (runner.results().failedCount == 0) {
      this.runnerState = "passed";
    } else {
      this.runnerState = "failed";
    }
  }
})(JsTestServer.JasmineDriver.Instance);

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
honkster-js-test-server-0.2.12 public/js_test_server/jasmine_driver.js
honkster-js-test-server-0.2.11 public/js_test_server/jasmine_driver.js
honkster-js-test-server-0.2.10 public/js_test_server/jasmine_driver.js
honkster-js-test-server-0.2.9 public/js_test_server/jasmine_driver.js
js-test-server-0.2.8 public/js_test_server/jasmine_driver.js
js-test-server-0.2.7 public/js_test_server/jasmine_driver.js