Skip to content

Commit

Permalink
chore: Make cucumber not to run the @cli tag on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed Aug 11, 2016
1 parent 738143a commit 3d9cb2f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
35 changes: 35 additions & 0 deletions scripts/cucumber.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

{spawn} = require('child_process')


# This script removes @cli behavior from tests due to
# https://github.com/apiaryio/gavel-spec/issues/24


tags = ['@nodejs', '~@proposal', '~@draft', '~@nodejs-pending']
tags.push('~@cli') if process.platform.match(/^win/)


args = []
for tag in tags
args.push('-t')
args.push(tag)


cucumber = spawn('node_modules/.bin/cucumber-js', args.concat([
'-r', 'test/cucumber/support/',
'-r', 'test/cucumber/step_definitions/',
'-f', 'pretty',
'--compiler=coffee:coffee-script/register',
'node_modules/gavel-spec/features/',
]))

cucumber.stdout.on('data', (data) -> process.stdout.write(data))
cucumber.stderr.on('data', (data) -> process.stderr.write(data))

cucumber.on('error', (err) ->
process.stdout.write(err)
process.exit(1)
)

cucumber.on('close', (code) -> process.exit(code))
4 changes: 2 additions & 2 deletions test/cucumber/step_definitions/cli_stepdefs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = ->
callback()

@Then /^exit status is (\d+)$/, (expectedExitStatus, callback) ->
cmd = "PATH=$PATH:" + process.cwd() + "/bin; cd /tmp/gavel-* " + @commandBuffer
cmd = "PATH=$PATH:" + process.cwd() + "/bin:" + process.cwd() + "/node_modules/.bin; cd /tmp/gavel-* " + @commandBuffer
child = exec cmd, (error, stdout, stderr) ->
if error
unless parseInt(error.code) == parseInt(expectedExitStatus)
Expand All @@ -31,5 +31,5 @@ module.exports = ->

child.on 'exit', (code) ->
unless parseInt(code) == parseInt(expectedExitStatus)
callback new Error 'Expected exit status ' + expectedExitStatus + ' but got ' + code + '.'
callback new Error 'Expected exit status ' + expectedExitStatus + ' but got ' + code + '.'
callback()

0 comments on commit 3d9cb2f

Please sign in to comment.