From d5d5395f7258e8851c19bae64790fe16d3c5e48a Mon Sep 17 00:00:00 2001 From: yo_waka Date: Thu, 7 Feb 2013 17:32:36 +0900 Subject: [PATCH] fix some typo, add todo --- .gitignore | 1 + .npmignore | 2 ++ bin/closure-library-phantomjs | 2 +- lib/adapter.js | 5 +++-- lib/closure-library-phantomjs.js | 6 +++--- lib/reporters.js | 23 +++++++++++++++-------- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 536f0be..3debe1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /node_modules +deps.js .DS_Store *~ diff --git a/.npmignore b/.npmignore index 4809ccf..d9b7dd1 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,8 @@ node_modules npm-debug.log +deps.js + .git .gitignore diff --git a/bin/closure-library-phantomjs b/bin/closure-library-phantomjs index f3d2d56..e84066d 100755 --- a/bin/closure-library-phantomjs +++ b/bin/closure-library-phantomjs @@ -170,7 +170,7 @@ phantomjs.stdout.on('data', function(data) { // Oops phantomjs.on('exit', function(code) { if (code === 127) { - util.print("Perhaps phantomjs is not installed?\n"); + util.print('Perhaps phantomjs is not installed?\n'); } process.exit(code); }) diff --git a/lib/adapter.js b/lib/adapter.js index f02a700..1a6d5bc 100644 --- a/lib/adapter.js +++ b/lib/adapter.js @@ -42,7 +42,7 @@ global.goog.testing.TestCase.prototype.runTests = function() { var data = { name: this.name_, - num: this.getCount(), + num: this.getCount() }; sendToPhantomJS('head', data); @@ -163,7 +163,8 @@ * * @override */ - goog.testing.MultiTestRunner.TestFrame.prototype.onIframeLoaded_ = function(e) { + goog.testing.MultiTestRunner.TestFrame.prototype.onIframeLoaded_ = + function(e) { this.iframeLoaded_ = true; var js = goog.dom.getFrameContentWindow(this.iframeEl_); diff --git a/lib/closure-library-phantomjs.js b/lib/closure-library-phantomjs.js index 2209e4c..05a6fae 100644 --- a/lib/closure-library-phantomjs.js +++ b/lib/closure-library-phantomjs.js @@ -50,12 +50,12 @@ function exitOnError(msg, trace) { /** * Wait timeout. * - * @param {number=} opt_timeout + * @param {number=} opt_timeout . * @return {number} . */ function waitTimeout(opt_timeout) { // Default max timeout is 600s - var timeout = opt_timeout || DEFAULT_TIMEOUT;; + var timeout = opt_timeout || DEFAULT_TIMEOUT; var timer = setTimeout(function() { console.log('PHANTOM_JS: Timeout'); @@ -179,7 +179,7 @@ page.open(testPath, function(status) { if (status === 'success') { waitTimer = waitTimeout(config.timeout); } else { - console.log("phantomjs: Unable to load page. [" + testPath + ']'); + console.log('phantomjs: Unable to load page. [' + testPath + ']'); phantom.exit(1); } }); diff --git a/lib/reporters.js b/lib/reporters.js index 5d1abe7..d414a86 100644 --- a/lib/reporters.js +++ b/lib/reporters.js @@ -9,7 +9,7 @@ */ var fs = require('fs'); -var os = require('system').os; +var system = require('system'); /** @@ -29,9 +29,9 @@ var Colors = { * Symbols of console. */ var Symbols = { - OK: (os.name === 'windows') ? '\u221A' : '✓', - NG: (os.name === 'windows') ? '\u00D7' : '✖', - DOT: '.', + OK: (system.os.name === 'windows') ? '\u221A' : '✓', + NG: (system.os.name === 'windows') ? '\u00D7' : '✖', + DOT: '.' }; @@ -63,7 +63,7 @@ function gray(str) { /** * @interface */ -function IReporter() {}; +function IReporter() {} /** * @param {Object} testcase . @@ -95,12 +95,15 @@ function DotReporter() { errors: [] }; console.log(''); + + // TODO after 1.9 released, use system module fs.write('/dev/stdout', ' ', 'w'); + //system.stdout.write(' '); } /** * @type {Object} - * @private/ + * @private */ DotReporter.prototype.stats_; @@ -119,9 +122,13 @@ DotReporter.prototype.writeResult = function(result) { result.error && this.stats_.errors.push(result.error); if (result.success) { + // TODO after 1.9 released, use system module fs.write('/dev/stdout', gray(Symbols.DOT), 'w'); + //system.stdout.write(gray(Symbols.DOT)); } else { + // TODO after 1.9 released, use system module fs.write('/dev/stdout', red(Symbols.DOT), 'w'); + //system.stdout.write(red(Symbols.DOT)); } }; @@ -180,7 +187,7 @@ function SpecReporter() { /** * @type {Object} - * @private/ + * @private */ SpecReporter.prototype.stats_; @@ -265,7 +272,7 @@ function TapReporter() { /** * @type {Object} - * @private/ + * @private */ TapReporter.prototype.stats_;