Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Include devDependencies in default test from Wizard #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/commands/protect/wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function processAnswers(answers, policy, options) {
}

var test = pkg.scripts.test;
var cmd = 'snyk test';
var cmd = 'snyk test --dev';
if (test && test !== 'echo "Error: no test specified" && exit 1') {
// only add the test if it's not already in the test
if (test.indexOf(cmd) === -1) {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/pkg-mean-io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"start": "node server",
"mocha": "node tools/test/run-mocha.js",
"karma": "node node_modules/karma/bin/karma start karma.conf.js",
"test": "snyk test && gulp test",
"test": "snyk test --dev && gulp test",
"test-e2e": "gulp e2e.test",
"postinstall": "node tools/scripts/postinstall.js",
"snyk-protect": "snyk protect",
Expand Down Expand Up @@ -99,4 +99,4 @@
"through": "latest"
},
"snyk": true
}
}
6 changes: 3 additions & 3 deletions test/wizard-process-answers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test('wizard replaces npm\s default scripts.test', function (t) {
}).then(function () {
t.equal(writeSpy.callCount, 1, 'package was written to');
var pkg = JSON.parse(writeSpy.args[0][1]);
t.equal(pkg.scripts.test, 'snyk test', 'default npm exit 1 was replaced');
t.equal(pkg.scripts.test, 'snyk test --dev', 'default npm exit 1 was replaced');
}).catch(t.threw).then(function () {
process.chdir(old);
t.end();
Expand All @@ -153,7 +153,7 @@ test('wizard replaces prepends to scripts.test', function (t) {
}).then(function () {
t.equal(writeSpy.callCount, 1, 'package was written to');
var pkg = JSON.parse(writeSpy.args[0][1]);
t.equal(pkg.scripts.test, 'snyk test && ' + prevPkg.scripts.test, 'prepended to test script');
t.equal(pkg.scripts.test, 'snyk test --dev && ' + prevPkg.scripts.test, 'prepended to test script');
}).catch(t.threw).then(function () {
process.chdir(old);
t.end();
Expand All @@ -178,4 +178,4 @@ test('wizard detects existing snyk in scripts.test', function (t) {
process.chdir(old);
t.end();
});
});
});