jasmine-phantomjs.js
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;
      }
    }
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;
      }
    }
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 ; } }
this runs in the context of a phantomjs page.
this runs in the context of a phantomjs page .