From 04959162c64d7e4212ffcb90026aec5a5b059ee2 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Fri, 1 Dec 2017 13:19:48 -0800 Subject: [PATCH] AppVeyor (#4812) * First attempt at using AppVeyor * Maybe it doesn't like the leading dot? * Versions are an array * Fix tests on Windows: for some reason, Windows requires `coffee` to be executed as `node coffee` (in the context of `spawnSync`, at least) * Use npm@latest, see if that's less noisy * Nevermind, only an issue on Node 6 * Better to see the NPM version before npm install --- appveyor.yml | 24 ++++++++++++++++++++++++ test/invocation_argument_parsing.coffee | 20 +++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..c23bcee5 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +environment: + matrix: + - nodejs_version: '6' + - nodejs_version: '8' + - nodejs_version: '' # Installs latest. + +install: + - ps: Install-Product node $env:nodejs_version + - node --version + - npm --version + - npm install + +test_script: + - node ./bin/cake build:except-parser + - node ./bin/cake build:parser + - node ./bin/cake build:full + - node ./bin/cake build:browser + - node ./bin/cake test + - node ./bin/cake test:browser + - node ./bin/cake test:integrations + +build: off + +version: "{build}" diff --git a/test/invocation_argument_parsing.coffee b/test/invocation_argument_parsing.coffee index b28e426c..073c551e 100644 --- a/test/invocation_argument_parsing.coffee +++ b/test/invocation_argument_parsing.coffee @@ -6,6 +6,8 @@ path = require 'path' # Get the folder containing the compiled `coffee` executable and make it the # PATH so that `#!/usr/bin/env coffee` resolves to our locally built file. coffeeBinFolder = path.dirname require.resolve '../bin/coffee' +# For some reason, Windows requires `coffee` to be executed as `node coffee`. +coffeeCommand = if isWindows() then 'node coffee' else 'coffee' spawnOptions = cwd: coffeeBinFolder encoding: 'utf8' @@ -18,7 +20,7 @@ initialSpaceScript = require.resolve './importing/shebang_initial_space.coffee' extraArgsScript = require.resolve './importing/shebang_extra_args.coffee' initialSpaceExtraArgsScript = require.resolve './importing/shebang_initial_space_extra_args.coffee' -test "parse arguments for shebang scripts correctly (on unix platforms)", -> +test "parse arguments for shebang scripts correctly (on *nix platforms)", -> return if isWindows() stdout = execFileSync shebangScript, ['-abck'], spawnOptions @@ -32,7 +34,7 @@ test "parse arguments for shebang scripts correctly (on unix platforms)", -> arrayEq expectedArgs, realArgs test "warn and remove -- if it is the second positional argument", -> - result = spawnSync 'coffee', [shebangScript, '--'], spawnOptions + result = spawnSync coffeeCommand, [shebangScript, '--'], spawnOptions stderr = result.stderr.toString() arrayEq JSON.parse(result.stdout), ['coffee', shebangScript] ok stderr.match /^coffee was invoked with '--'/m @@ -40,7 +42,7 @@ test "warn and remove -- if it is the second positional argument", -> arrayEq JSON.parse(posArgs), [shebangScript, '--'] ok result.status is 0 - result = spawnSync 'coffee', ['-b', shebangScript, '--'], spawnOptions + result = spawnSync coffeeCommand, ['-b', shebangScript, '--'], spawnOptions stderr = result.stderr.toString() arrayEq JSON.parse(result.stdout), ['coffee', shebangScript] ok stderr.match /^coffee was invoked with '--'/m @@ -49,7 +51,7 @@ test "warn and remove -- if it is the second positional argument", -> ok result.status is 0 result = spawnSync( - 'coffee', ['-b', shebangScript, '--', 'ANOTHER'], spawnOptions) + coffeeCommand, ['-b', shebangScript, '--', 'ANOTHER'], spawnOptions) stderr = result.stderr.toString() arrayEq JSON.parse(result.stdout), ['coffee', shebangScript, 'ANOTHER'] ok stderr.match /^coffee was invoked with '--'/m @@ -58,7 +60,7 @@ test "warn and remove -- if it is the second positional argument", -> ok result.status is 0 result = spawnSync( - 'coffee', ['--', initialSpaceScript, 'arg'], spawnOptions) + coffeeCommand, ['--', initialSpaceScript, 'arg'], spawnOptions) expectedArgs = ['coffee', initialSpaceScript, 'arg'] realArgs = JSON.parse result.stdout arrayEq expectedArgs, realArgs @@ -66,7 +68,7 @@ test "warn and remove -- if it is the second positional argument", -> ok result.status is 0 test "warn about non-portable shebang lines", -> - result = spawnSync 'coffee', [extraArgsScript, 'arg'], spawnOptions + result = spawnSync coffeeCommand, [extraArgsScript, 'arg'], spawnOptions stderr = result.stderr.toString() arrayEq JSON.parse(result.stdout), ['coffee', extraArgsScript, 'arg'] ok stderr.match /^The script to be run begins with a shebang line with more than one/m @@ -77,14 +79,14 @@ test "warn about non-portable shebang lines", -> arrayEq JSON.parse(args), ['coffee', '--'] ok result.status is 0 - result = spawnSync 'coffee', [initialSpaceScript, 'arg'], spawnOptions + result = spawnSync coffeeCommand, [initialSpaceScript, 'arg'], spawnOptions stderr = result.stderr.toString() ok stderr is '' arrayEq JSON.parse(result.stdout), ['coffee', initialSpaceScript, 'arg'] ok result.status is 0 result = spawnSync( - 'coffee', [initialSpaceExtraArgsScript, 'arg'], spawnOptions) + coffeeCommand, [initialSpaceExtraArgsScript, 'arg'], spawnOptions) stderr = result.stderr.toString() arrayEq JSON.parse(result.stdout), ['coffee', initialSpaceExtraArgsScript, 'arg'] ok stderr.match /^The script to be run begins with a shebang line with more than one/m @@ -97,7 +99,7 @@ test "warn about non-portable shebang lines", -> test "both warnings will be shown at once", -> result = spawnSync( - 'coffee', [initialSpaceExtraArgsScript, '--', 'arg'], spawnOptions) + coffeeCommand, [initialSpaceExtraArgsScript, '--', 'arg'], spawnOptions) stderr = result.stderr.toString() arrayEq JSON.parse(result.stdout), ['coffee', initialSpaceExtraArgsScript, 'arg'] ok stderr.match /^The script to be run begins with a shebang line with more than one/m