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

Already on GitHub? Sign in to your account

fix: npm run fails silently. closes #2959 #4546

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
6 participants
Contributor

flipside commented Jan 24, 2014

if the missing command is "test", logs a text error, otherwise creates an actual error.

fix: npm run fails silently. closes #2959
if the missing command is "test", logs a text error, otherwise creates an actual error.

@domenic domenic and 1 other commented on an outdated diff Jan 24, 2014

lib/run-script.js
@@ -89,6 +88,13 @@ function run (pkg, wd, cmd, cb) {
,"restart"
,"prestart","start","poststart"]
} else {
+ if (!pkg.scripts[cmd]) {
+ if (cmd === "test") {
+ pkg.scripts.test = "echo \"Error: no test specified\" && exit 1";
@domenic

domenic Jan 24, 2014

Member

Why treat this as a special case?

@flipside

flipside Jan 24, 2014

Contributor

it was brought up in the issue that making "npm test" throw an error when there are no tests could break things for some people.

plus there already was a pull request without the special case.

@domenic

domenic Jan 24, 2014

Member

This code also makes npm test throw an error when there are no tests....

Member

domenic commented Jan 24, 2014

I am +1 on this kind of change, but IIRC from #2959 it's fairly controversial :(. We'd need to get @isaacs buy-in.

Owner

isaacs commented May 12, 2014

I actually really like this. Then we can stop defaulting it that way in npm init :)

It needs a test, though.

Member

domenic commented May 12, 2014

Yaaaaaaaaay

Contributor

thomblake commented Jul 26, 2014

Also needs to fix test/tap/ignore-scripts.js which fails with this code.

Contributor

smikes commented Nov 19, 2014

This can be closed. The change went in #6631.

@domenic domenic closed this Nov 19, 2014

@othiym23 othiym23 removed the review label Nov 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment