Sha256: 351d33d367c2f29fea85cad1877bc19485ec05a9f46f16652ecbc90109445d0f

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

(function() {
  var port = phantom.args[0], filter = phantom.args[1];

  if (!parseInt(port, 10) || phantom.args.length > 2) {
    console.log('Usage: run-jasmine.js PORT [spec_name_filter]');
    phantom.exit(1);
  }

  var page = require('webpage').create(), fs = require('fs');

  var url = 'http://localhost:' + port;
  if (filter) {
    url += '?spec=' + encodeURIComponent(filter);
  }

  page.open(url, function(status) {
    if (status !== "success") {
      console.log("Unable to access network");
      phantom.exit(1);
    } else {
      var json = page.evaluate(function() {
        var topLevelSuites = [], suites = jasmine.getEnv().currentRunner().topLevelSuites();
        for (var i = 0; i < suites.length; i++) {
          var suite = suites[i];
          topLevelSuites.push({
            id: suite.id,
            description: suite.description
          });
        }
        return JSON.stringify({
          suites: jsApiReporter.suites(),
          top_level_suites: topLevelSuites
        });
      });
      console.log(json);
      phantom.exit(0);
    }
  });
}).call(this);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phantom_jasmine-0.1.0 lib/jasmine/runners/phantom_jasmine_count.js
phantom_jasmine-0.0.9 lib/jasmine/runners/phantom_jasmine_count.js
phantom_jasmine-0.0.8 lib/jasmine/runners/phantom_jasmine_count.js