Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test #11 #33

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/cover.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/hook.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ibrik.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/instrumenter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/report.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/command.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
6 changes: 3 additions & 3 deletions src/cover.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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'
Expand Down
10 changes: 10 additions & 0 deletions test/fixture/issue11.coffee
Original file line number Diff line number Diff line change
@@ -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"
34 changes: 34 additions & 0 deletions test/issue11.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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'

$ibrik command
.then (stdout)->
expect(stdout).to.match /Coverage summary/
done()