Skip to content
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ raywu0123 <b05901189@ntu.edu.tw>
Iván Reinoso García <ireinoso@plainconcepts.com>
Roy Marples <roy@marples.name>
Robert James Gabriel <robert_gabriel@outlook.com>
Timo Sand <timo.sand@iki.fi>
John Firebaugh <john.firebaugh@gmail.com>
Kitten King <hi@kittenking.me>
Claudia Hernández <cghr1990@gmail.com>
Expand Down
4 changes: 1 addition & 3 deletions lib/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ function run (pkg, wd, cmd, args, cb) {
]
} else {
if (pkg.scripts[cmd] == null) {
if (cmd === 'test') {
pkg.scripts.test = 'echo \'Error: no test specified\''
} else if (cmd === 'env') {
if (cmd === 'env') {
if (isWindowsShell) {
log.verbose('run-script using default platform env: SET (Windows)')
pkg.scripts[cmd] = 'SET'
Expand Down
9 changes: 0 additions & 9 deletions test/need-npm5-update/rm-linked.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ var linkedJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
dependencies: {
'baz': '1.0.0'
},
Expand All @@ -41,9 +38,6 @@ var linkedDepJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
author: '',
license: 'ISC'
}
Expand All @@ -53,9 +47,6 @@ var installJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
dependencies: {
'foo': '1.0.0'
},
Expand Down
2 changes: 1 addition & 1 deletion test/tap/install-test-cli-without-package-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test('\'npm install-test\' should not generate package-lock.json.*', function (t
if (err) throw err
t.comment(stdout.trim())
t.comment(stderr.trim())
t.is(code, 0, 'npm install did not raise error code')
t.is(code, 1, 'npm install-test w/o test defined should return error')
var files = fs.readdirSync(pkg).filter(function (f) {
return f.indexOf('package-lock.json.') === 0
})
Expand Down
2 changes: 1 addition & 1 deletion test/tap/legacy-test-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test('test-package', function (t) {

function testCheckAndRemove (err, code, stdout, stderr) {
if (err) throw err
t.is(code, 0, 'npm test w/o test is ok')
t.is(code, 1, 'npm test w/o test should return error')
common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone)
}

Expand Down
12 changes: 0 additions & 12 deletions test/tap/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ var readJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
author: '',
license: 'ISC'
}
Expand All @@ -38,9 +35,6 @@ var readScopedJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
author: '',
license: 'ISC'
}
Expand All @@ -50,9 +44,6 @@ var installJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
author: '',
license: 'ISC'
}
Expand All @@ -62,9 +53,6 @@ var insideInstallJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
author: '',
license: 'ISC'
}
Expand Down
3 changes: 0 additions & 3 deletions test/tap/no-global-warns.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ var installJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
author: '',
license: 'ISC'
}
Expand Down
3 changes: 2 additions & 1 deletion test/tap/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ test('npm run-script explicitly call pre script with arg', function (t) {

test('npm run-script test', function (t) {
common.npm(['run-script', 'test'], opts, function (er, code, stdout, stderr) {
t.match(stderr, /npm ERR! missing script: test/)
t.ifError(er, 'npm run-script test ran without issue')
t.notOk(stderr, 'should not generate errors')
t.ok(stderr, 'should generate errors')
t.end()
})
})
Expand Down
32 changes: 32 additions & 0 deletions test/tap/sorted-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,35 @@ test('sorting dependencies', function (t) {
})
})
})

test('cleanup', function (t) {
cleanup()
t.pass('cleaned up')
t.end()
})

function setup () {
cleanup()
mkdirp.sync(pkg)

fs.writeFileSync(packageJson, JSON.stringify({
'name': 'sorted-package-json',
'version': '0.0.0',
'description': '',
'main': 'index.js',
'author': 'Rocko Artischocko',
'license': 'ISC',
'dependencies': {
'underscore': '^1.3.3',
'request': '^0.9.0'
}
}, null, 2), 'utf8')
}

function cleanup () {
process.chdir(osenv.tmpdir())
rimraf.sync(cache)
rimraf.sync(pkg)
mkdirp.sync(cache)
mkdirp.sync(tmp)
}
3 changes: 0 additions & 3 deletions test/tap/symlink-cycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ var cycleJSON = {
version: '1.0.0',
description: '',
main: 'index.js',
scripts: {
test: 'echo "Error: no test specified" && exit 1'
},
dependencies: {
'cycle': '*'
},
Expand Down