Skip to content

Commit

Permalink
fix: show authentication message for anon tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshje committed Nov 29, 2016
1 parent e2002c7 commit b8fb251
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cli/commands/test.js
Expand Up @@ -6,6 +6,11 @@ var Promise = require('es6-promise').Promise; // jshint ignore:line
var config = require('../../lib/config');
var isCI = require('../../lib/is-ci');

var authenticationWarning = '\n\n' + chalk.bgRed.bold.white(
'Warning: `snyk test` will soon require authentication. ' +
'Authenticate now with `snyk auth`.'
);

function test(path, options) {
var args = [].slice.call(arguments, 0);

Expand Down Expand Up @@ -99,6 +104,9 @@ function test(path, options) {
'about new related vulnerabilities.\n- Run `snyk test` as part of ' +
'your CI/test.';
}
if (!snyk.api) {
summary += authenticationWarning;
}
return summary;
}

Expand Down Expand Up @@ -187,8 +195,7 @@ function test(path, options) {
}).join(sep) + sep + summary;

if (!snyk.api) {
body += sep + chalk.bgRed.bold.white('Warning: `snyk test` will soon ' +
'require authentication. Authenticate now with `snyk auth`.');
body += authenticationWarning;
}

if (res.ok) {
Expand Down

0 comments on commit b8fb251

Please sign in to comment.