Skip to content

Commit

Permalink
Removes special handling of npm test
Browse files Browse the repository at this point in the history
PR-URL: #91
Credit: @deiga
Close: #91
Reviewed-by: @isaacs

NOTE: The functional part of this was actually done in ac25561, with
the refactoring of lib/run-script.js, but this PR also adds the updates
to the tests that go along with that change.
  • Loading branch information
deiga authored and isaacs committed Jul 7, 2020
1 parent b498cf0 commit deffadc
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 33 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -695,3 +695,4 @@ Jarda Snajdr <jsnajdr@gmail.com>
Naix Geng <1308363651@qq.com>
Dylan Treisman <dylanzt@gmail.com>
mum-never-proud <abhuz@hotmail.com>
Timo Sand <timo.sand@iki.fi>
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
3 changes: 0 additions & 3 deletions test/tap/sorted-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ fs.writeFileSync(packageJson, JSON.stringify({
'version': '0.0.0',
'description': '',
'main': 'index.js',
'scripts': {
'test': 'echo \'Error: no test specified\' && exit 1'
},
'author': 'Rocko Artischocko',
'license': 'ISC',
'dependencies': {
Expand Down
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

0 comments on commit deffadc

Please sign in to comment.