Skip to content

Commit

Permalink
Pass exit code -- fix bug on drone (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipesilva authored and delambo committed Sep 2, 2016
1 parent 7fbbe04 commit d2e2ad8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/actions/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ module.exports = () => {
`NODE_PATH=$NODE_PATH:${userNodeModulesPath} node ${avaCLI} ${userRootPath}/build/test/*.js`;
if (global.config.debug) command += ' --verbose';
shell.config.silent = false;
shell.exec(command);
shell.exec(command, (code) => {
process.exit(code)
});
});


Expand Down

2 comments on commit d2e2ad8

@scottastrophic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@delambo @felipesilva This change causes npm run test, when run from a terminal, to output

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.4.0/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: 'kyt test'
npm ERR! Exit status 1
npm ERR! Failed at the [email protected] test script 'kyt test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the games-web-code-test package,
npm ERR! not with npm itself.

I was able to append --loglevel=silent to the command to disable this, but trying to add it to the package.json (i.e., "test": "kyt test --loglevel=silent", does not work, and this repo is intended to be sent to potential external candidates and ideally we would prefer not to instruct them to append the command themselves or to have npm tell them our package is broken. Is there some way of detecting that the tests are being run from drone so we could do something like

shell.exec(command, (code) => {
  process.exit(isDrone ? code : 0);
});

@tizmagik
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottastrophic good point. I think the real problem is that kyt does not allow for "extra" flags that it doesn't recognize, either directly, kyt test --loglevel=silent or as proxy kyt test -- --loglevel=silent. I think that shouldn't be too difficult to add support for though.

Please sign in to comment.