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 6685aa5 commit 778af5c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
3 changes: 1 addition & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
environment:
nodejs_version: "0.10"
nodejs_version: "6"
cache:
- "node_modules"
install:
- ps: Install-Product node 6
- "npm -g install npm@latest"
- "set PATH=%APPDATA%\\npm;%PATH%"
- "npm install"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "npm run test:server && npm run test:browser && npm run test:features",
"test:server": "mocha test/unit/**/*-test.coffee",
"test:browser": "mochify test/unit/**/*.coffee --transform=coffeeify --extension=.coffee",
"test:features": "cucumber-js --compiler=coffee:coffee-script/register -f pretty -t @nodejs -t ~@proposal -t ~@draft -t ~@nodejs-pending -r test/cucumber/support/ -r test/cucumber/step_definitions/ node_modules/gavel-spec/features/",
"test:features": "coffee scripts/cucumber.coffee",
"prepublish": "npm run build",
"coverage": "scripts/cov",
"coveralls": "npm run coverage mocha-lcov-reporter | coveralls"
Expand All @@ -39,6 +39,7 @@
"coffee-script": "^1.10.0",
"coffeeify": "^2.0.1",
"coveralls": "^2.11.9",
"cross-spawn": "^4.0.0",
"cucumber": "^1.2.2",
"cz-conventional-changelog": "^1.1.6",
"gavel-spec": "^1.1.0",
Expand Down
36 changes: 36 additions & 0 deletions scripts/cucumber.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

spawn = require('cross-spawn')


IS_WINDOWS = process.platform.match(/^win/)


# Removing '@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) ->
console.error(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 778af5c

Please sign in to comment.