Skip to content

Commit

Permalink
Merge pull request #75 from apiaryio/honzajavorek/appveyor
Browse files Browse the repository at this point in the history
AppVeyor CI
  • Loading branch information
honzajavorek authored Aug 22, 2016
2 parents ae58190 + fb2174d commit 5ae2086
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ cache:
before_install:
- "npm -g install npm@latest"
- "curl -Lo travis_after_all.py https://raw.githubusercontent.com/dmakhno/travis_after_all/master/travis_after_all.py"
before_script: # https://github.com/cucumber/cucumber-js/issues/602
- "if [[ $TRAVIS_NODE_VERSION = '0.10' ]]; then npm install [email protected]; fi"
after_success: # travis_after_all.py is needed due to travis-ci/travis-ci#1548 & travis-ci/travis-ci#929
- "npm run coveralls"
- "python travis_after_all.py"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![npm version](https://badge.fury.io/js/gavel.svg)](https://badge.fury.io/js/gavel)
[![Build Status](https://travis-ci.org/apiaryio/gavel.js.svg?branch=master)](https://travis-ci.org/apiaryio/gavel.js)
[![Build status](https://ci.appveyor.com/api/projects/status/0cpnaoakhs8q58tn/branch/master?svg=true)](https://ci.appveyor.com/project/Apiary/gavel-js/branch/master)
[![Dependency Status](https://david-dm.org/apiaryio/gavel.js.svg)](https://david-dm.org/apiaryio/gavel.js)
[![devDependency Status](https://david-dm.org/apiaryio/gavel.js/dev-status.svg)](https://david-dm.org/apiaryio/gavel.js#info=devDependencies)
[![Coverage Status](https://coveralls.io/repos/apiaryio/gavel.js/badge.svg?branch=master)](https://coveralls.io/r/apiaryio/gavel.js?branch=master)
Expand Down
14 changes: 14 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
environment:
nodejs_version: "6"
cache:
- "node_modules"
install:
- ps: Install-Product node 6
- "npm -g install npm@latest"
- "set PATH=%APPDATA%\\npm;%PATH%"
- "npm install"
build: off
test_script:
- "node --version"
- "npm --version"
- "npm test"
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"build": "coffee -b -c -o lib/ src/",
"lint": "coffeelint src",
"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:server": "mocha \"test/unit/**/*-test.coffee\"",
"test:browser": "mochify \"test/unit/**/*.coffee\" --transform=coffeeify --extension=.coffee",
"test:features": "coffee scripts/cucumber.coffee",
"prepublish": "npm run build",
"coverage": "./scripts/cov",
"coverage": "scripts/cov",
"coveralls": "npm run coverage mocha-lcov-reporter | coveralls",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
Expand All @@ -41,7 +41,8 @@
"coffeeify": "^2.0.1",
"coffeelint": "^1.15.7",
"coveralls": "^2.11.9",
"cucumber": "1.0.0",
"cross-spawn": "^4.0.0",
"cucumber": "^1.2.2",
"cz-conventional-changelog": "^1.1.6",
"gavel-spec": "^1.1.0",
"jscoverage": "^0.6.0",
Expand All @@ -50,8 +51,8 @@
"mocha-lcov-reporter": "^1.2.0",
"mochify": "^2.18.1",
"prettyjson": "^1.1.3",
"sinon": "^1.17.4",
"semantic-release": "^4.3.5"
"semantic-release": "^4.3.5",
"sinon": "^1.17.4"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion scripts/cov
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# ./scripts/cov html-cov > cov.html


COV=./node_modules/coffee-coverage/bin/coffeecoverage
COV=./node_modules/.bin/coffeeCoverage
MOCHA=./node_modules/.bin/mocha
REPORTER=$1

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 5ae2086

Please sign in to comment.