Make options optional
doug-wade opened this issue · 0 comments
doug-wade commented
Currently, with the minimal config,
gulp.task('snyk-protect', function(cb) {
return snyk({command: 'protect'}, cb);
});
gulp.task('snyk-test', function (cb) {
return snyk({command: 'test'}, cb);
});
I get the following error:
doug-UX301LAA packages/generator-clefs-plugin ‹switch-to-snyk› » gulp prepublish 1 ↵
[14:59:45] Using gulpfile ~/workplace/clefs/packages/generator-clefs-plugin/gulpfile.js
[14:59:45] Starting 'snyk-protect'...
[14:59:45] 'snyk-protect' errored after 262 μs
[14:59:45] TypeError: Cannot convert undefined or null to object
at hashToString (/home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/gulp-snyk/index.js:43:9)
at module.exports (/home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/gulp-snyk/index.js:26:75)
at Gulp.<anonymous> (/home/doug/workplace/clefs/packages/generator-clefs-plugin/gulpfile.js:20:9)
at module.exports (/home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:46:20
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
However, when I add the options hash
gulp.task('snyk-protect', function(cb) {
return snyk({command: 'protect', debug: true, options: {}}, cb);
});
gulp.task('snyk-test', function (cb) {
return snyk({command: 'test', debug: true, options: {}}, cb);
});
it works as intended
doug-UX301LAA packages/generator-clefs-plugin ‹switch-to-snyk*› » gulp prepublish 1 ↵
[15:00:12] Using gulpfile ~/workplace/clefs/packages/generator-clefs-plugin/gulpfile.js
[15:00:12] Starting 'snyk-protect'...
[15:00:12] running command /home/doug/workplace/clefs/packages/generator-clefs-plugin/node_modules/.bin/snyk protect
[15:00:27] Successfully applied Snyk patches
[15:00:27] Finished 'snyk-protect' after 15 s
[15:00:27] Starting 'prepublish'...
[15:00:27] Finished 'prepublish' after 18 μs