diff --git a/.travis.yml b/.travis.yml index 93112ccd..9997992b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 cucumber@1.0.0; 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" diff --git a/README.md b/README.md index 73c82714..3b820c68 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..2110afef --- /dev/null +++ b/appveyor.yml @@ -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" diff --git a/package.json b/package.json index 94ffafa6..2b3241cb 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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", @@ -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", diff --git a/scripts/cov b/scripts/cov index e5d0d6c5..513ec66b 100755 --- a/scripts/cov +++ b/scripts/cov @@ -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 diff --git a/scripts/cucumber.coffee b/scripts/cucumber.coffee new file mode 100644 index 00000000..8a30b704 --- /dev/null +++ b/scripts/cucumber.coffee @@ -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)) diff --git a/test/cucumber/step_definitions/cli_stepdefs.coffee b/test/cucumber/step_definitions/cli_stepdefs.coffee index 5c7531fd..e323d02d 100644 --- a/test/cucumber/step_definitions/cli_stepdefs.coffee +++ b/test/cucumber/step_definitions/cli_stepdefs.coffee @@ -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) @@ -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()