Skip to content

Commit

Permalink
fix: require authentication when running snyk.test module directly
Browse files Browse the repository at this point in the history
  • Loading branch information
joshje authored and darscan committed Jan 12, 2017
1 parent d6d2d53 commit 6d0e770
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/snyk-test/index.js
Expand Up @@ -2,6 +2,7 @@ module.exports = test;

var Promise = require('es6-promise').Promise; // jshint ignore:line
var detect = require('../detect');
var apiTokenExists = require('../../lib/api-token').exists;

function test(root, options, callback) {
if (typeof options === 'function') {
Expand All @@ -12,7 +13,9 @@ function test(root, options, callback) {
options = {};
}

var promise = executeTest(root, options);
var promise = apiTokenExists('snyk test').then(function () {
return executeTest(root, options);
});
if (callback) {
promise.then(function (res) {
callback(null, res);
Expand Down

0 comments on commit 6d0e770

Please sign in to comment.