From ccbea85abaa7baf6e4bbb289fb86756edbde7388 Mon Sep 17 00:00:00 2001 From: 59naga Date: Sun, 7 Jun 2015 00:08:13 +0900 Subject: [PATCH 1/5] Add test #11 --- test/fixture/issue11.coffee | 10 ++++++++++ test/issue11.coffee | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 test/fixture/issue11.coffee create mode 100644 test/issue11.coffee diff --git a/test/fixture/issue11.coffee b/test/fixture/issue11.coffee new file mode 100644 index 0000000..3846754 --- /dev/null +++ b/test/fixture/issue11.coffee @@ -0,0 +1,10 @@ +# Dependencies +expect= require('chai').expect + +# Fixture +fixtureFixture= require './test004' + +# Specs +describe 'cover to code',-> + it '(#issue11 fixture)',-> + expect(fixtureFixture('Hello')).to.equal "Hello Path" \ No newline at end of file diff --git a/test/issue11.coffee b/test/issue11.coffee new file mode 100644 index 0000000..2456f8a --- /dev/null +++ b/test/issue11.coffee @@ -0,0 +1,35 @@ +# Dependencies +expect= require('chai').expect + +exec= (require 'child_process').exec +Promise= require 'bluebird' + +# Fixture +$ibrik= (command)-> + bin= require.resolve '../bin/ibrik' + script= bin+command + + new Promise (resolve,reject)-> + exec script,(error,stdout,stderr)-> + return reject error if error? + + resolve stdout + +# Specs +describe 'issue#11',-> + it 'Include test/**',(done)-> + command= '' + command+= ' cover '+(require.resolve 'mocha/bin/_mocha') + + command+= ' --default-excludes ""' + + command+= ' -- ' + command+= ' test/fixture/issue11.coffee ' + command+= ' --reporter spec' + command+= ' --recursive test' + command+= ' --compilers coffee:coffee-script/register' + + $ibrik command + .then (stdout)-> + expect(stdout).to.match /Coverage summary/ + done() \ No newline at end of file From 3f8899396e7a6edcddbeb1489be4cad4cc2ff4f7 Mon Sep 17 00:00:00 2001 From: 59naga Date: Sun, 7 Jun 2015 06:10:36 +0900 Subject: [PATCH 2/5] Fixed #34 --- src/command.coffee | 4 ++-- src/cover.coffee | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/command.coffee b/src/command.coffee index 074cdc9..f095a50 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -57,9 +57,9 @@ if command not in COMMANDS process.exit 1 -(require "./#{command}") argv, (err) -> +(require "./#{command}") argv, (err,cov,exitCode=0) -> if err console.error err process.exit 1 - process.exit 0 + process.exit exitCode # vim: set sw=4 ts=4 et tw=80 : diff --git a/src/cover.coffee b/src/cover.coffee index e2e2283..43f97e2 100644 --- a/src/cover.coffee +++ b/src/cover.coffee @@ -96,10 +96,10 @@ module.exports = (opts, callback) -> ibrik.hook.hookRequire matchFn, transformer, hookOpts - process.once 'exit', -> + process.once 'exit', (exitCode)-> file = path.resolve reportingDir, 'coverage.json' if not global[coverageVar]? - return callback('No coverage information was collected, exit without writing coverage information', null) + return callback('No coverage information was collected, exit without writing coverage information', null, exitCode) else cov = global[coverageVar] @@ -112,7 +112,7 @@ module.exports = (opts, callback) -> console.log "Writing coverage reports at [#{reportingDir}]" console.log '=============================================================================' report.writeReport collector, yes for report in reports - return callback(null, cov) + return callback(null, cov, exitCode) if opts?.files?.include if typeof opts.files.include is 'string' From 65e823be3696deadf23d6951d4a67187a0dbc572 Mon Sep 17 00:00:00 2001 From: 59naga Date: Sun, 7 Jun 2015 06:18:57 +0900 Subject: [PATCH 3/5] Lint, Refix issue#11 test --- src/command.coffee | 2 +- src/cover.coffee | 2 +- test/issue11.coffee | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/command.coffee b/src/command.coffee index f095a50..336e324 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -57,7 +57,7 @@ if command not in COMMANDS process.exit 1 -(require "./#{command}") argv, (err,cov,exitCode=0) -> +(require "./#{command}") argv, (err,cov,exitCode = 0) -> if err console.error err process.exit 1 diff --git a/src/cover.coffee b/src/cover.coffee index 43f97e2..e01b43c 100644 --- a/src/cover.coffee +++ b/src/cover.coffee @@ -96,7 +96,7 @@ module.exports = (opts, callback) -> ibrik.hook.hookRequire matchFn, transformer, hookOpts - process.once 'exit', (exitCode)-> + process.once 'exit', (exitCode) -> file = path.resolve reportingDir, 'coverage.json' if not global[coverageVar]? return callback('No coverage information was collected, exit without writing coverage information', null, exitCode) diff --git a/test/issue11.coffee b/test/issue11.coffee index 2456f8a..d57c557 100644 --- a/test/issue11.coffee +++ b/test/issue11.coffee @@ -27,7 +27,6 @@ describe 'issue#11',-> command+= ' test/fixture/issue11.coffee ' command+= ' --reporter spec' command+= ' --recursive test' - command+= ' --compilers coffee:coffee-script/register' $ibrik command .then (stdout)-> From af5c479d285c971775aed02e991745aae2cd32fa Mon Sep 17 00:00:00 2001 From: 59naga Date: Sun, 7 Jun 2015 06:19:26 +0900 Subject: [PATCH 4/5] Rebuild --- lib/command.js | 9 ++++++--- lib/cover.js | 8 ++++---- lib/hook.js | 2 +- lib/ibrik.js | 2 +- lib/instrumenter.js | 2 +- lib/report.js | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/command.js b/lib/command.js index 7009f00..d41a340 100644 --- a/lib/command.js +++ b/lib/command.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.2 +// Generated by CoffeeScript 1.9.3 (function() { var COMMANDS, TAB, argv, c, command, fs, optimist, possibilities, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; @@ -46,12 +46,15 @@ } } - (require("./" + command))(argv, function(err) { + (require("./" + command))(argv, function(err, cov, exitCode) { + if (exitCode == null) { + exitCode = 0; + } if (err) { console.error(err); process.exit(1); } - return process.exit(0); + return process.exit(exitCode); }); }).call(this); diff --git a/lib/cover.js b/lib/cover.js index 3e7898f..61e4d52 100644 --- a/lib/cover.js +++ b/lib/cover.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.2 +// Generated by CoffeeScript 1.9.3 (function() { var DEFAULT_REPORT_FORMAT, Module, existsSync, fileset, fs, ibrik, istanbul, mkdirp, path, which, slice = [].slice; @@ -97,11 +97,11 @@ ibrik.hook.unloadRequireCache(matchFn); } ibrik.hook.hookRequire(matchFn, transformer, hookOpts); - process.once('exit', function() { + process.once('exit', function(exitCode) { var collector, cov, i, len, report; file = path.resolve(reportingDir, 'coverage.json'); if (global[coverageVar] == null) { - return callback('No coverage information was collected, exit without writing coverage information', null); + return callback('No coverage information was collected, exit without writing coverage information', null, exitCode); } else { cov = global[coverageVar]; } @@ -119,7 +119,7 @@ report = reports[i]; report.writeReport(collector, true); } - return callback(null, cov); + return callback(null, cov, exitCode); }); if (opts != null ? (ref1 = opts.files) != null ? ref1.include : void 0 : void 0) { if (typeof opts.files.include === 'string') { diff --git a/lib/hook.js b/lib/hook.js index 253807e..f369f37 100644 --- a/lib/hook.js +++ b/lib/hook.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.2 +// Generated by CoffeeScript 1.9.3 (function() { var Module, coffee, endsWith, fs, hook, istanbul, originalJSLoader, originalLoader, transformFn; diff --git a/lib/ibrik.js b/lib/ibrik.js index 770e298..661725a 100644 --- a/lib/ibrik.js +++ b/lib/ibrik.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.2 +// Generated by CoffeeScript 1.9.3 (function() { var istanbul, key, value, hasProp = {}.hasOwnProperty; diff --git a/lib/instrumenter.js b/lib/instrumenter.js index a50a94b..453dfcc 100644 --- a/lib/instrumenter.js +++ b/lib/instrumenter.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.2 +// Generated by CoffeeScript 1.9.3 (function() { var Instrumenter, _, coffee, esprima, estraverse, fs, globalEval, istanbul, path, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, diff --git a/lib/report.js b/lib/report.js index 841ee84..9c2270c 100644 --- a/lib/report.js +++ b/lib/report.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.2 +// Generated by CoffeeScript 1.9.3 (function() { var istanbul; From 819f956052c30df8148242d02de349f6d0e9a033 Mon Sep 17 00:00:00 2001 From: 59naga Date: Sun, 7 Jun 2015 06:22:55 +0900 Subject: [PATCH 5/5] Up deps/devDeps / Fixed #35 --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 2290c17..24fd685 100644 --- a/package.json +++ b/package.json @@ -26,25 +26,25 @@ "url": "git://github.com/Constellation/ibrik.git" }, "dependencies": { - "coffee-script": "~1.8.0", - "esprima": "1.2.x", - "estraverse": "^1.9.0", + "coffee-script": "^1.9.3", + "esprima": "^2.2.0", + "estraverse": "^4.1.0", "fileset": "0.1.x", "istanbul": "~0.3.2", - "lodash": "~2.4.1", + "lodash": "^3.9.3", "mkdirp": "~0.5.0", "optimist": "~0.6.1", - "which": "~1.0.5" + "which": "^1.1.1" }, "devDependencies": { "bluebird": "^2.4.2", - "chai": "~1.10.0", - "chalk": "^0.5.1", + "chai": "^3.0.0", + "chalk": "^1.0.0", "gulp": "^3.8.10", "gulp-coffee": "^2.2.0", - "gulp-coffeelint": "^0.4.0", + "gulp-coffeelint": "^0.5.0", "gulp-mocha": "^2.0.0", - "mocha": "~2.0.1" + "mocha": "^2.2.5" }, "licenses": [ {