diff --git a/.travis.yml b/.travis.yml index e1cc5071..37f77007 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,5 +20,5 @@ script: if [[ $nodever == v12 ]]; then npm run test else - node ./bin/cli.js + npm run main fi diff --git a/appveyor.yml b/appveyor.yml index 72ed6f5e..84fb859b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,11 +12,13 @@ install: - set CI=true test_script: + - ver - node --version - npm --version - ps: if ($env:nodejs_version -like '') { npm run lint } - - "node bin/cli.js || ver > null" - - "echo Exit code: %errorlevel%" + - ps: | + node bin/cli.js + if ($LASTEXITCODE -ge 2) { Write-Output "Exit status: $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Output "All good" } build: off shallow_clone: true diff --git a/lib/cli.js b/lib/cli.js index cfe2aaed..4dc17427 100755 --- a/lib/cli.js +++ b/lib/cli.js @@ -131,7 +131,7 @@ Promise.resolve() console.log('For more detail, add `--debug` to the command'); } - process.exit(1); + process.exit(2); }); const SUPPORTED_INSTALLERS = ['npm', 'pnpm', 'ied', 'yarn']; diff --git a/package.json b/package.json index 684a1e1f..f0739185 100755 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "scripts": { "lint": "xo ./lib/**/*.js", "lint:fix": "xo ./lib/**/*.js --fix", - "test": "npm run lint && ./bin/cli.js || { ev=$?; echo \"Exit status: $ev\">&2; exit \"$ev\"; }", + "test": "npm run lint && npm run main", + "main": "./bin/cli.js; ev=$?; if (( ev >= 2 )); then echo \"Exit status: $ev\">&2; exit \"$ev\"; fi" , "transpile": "babel lib --out-dir lib-es5", "watch": "babel lib --out-dir lib-es5 --watch", "prepare": "npm run transpile"