diff --git a/appveyor.yml b/appveyor.yml index fe51ad35..0b80bcb5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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" diff --git a/package.json b/package.json index 1f4f3165..d4580c63 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", 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()