Skip to content

Commit deffadc

Browse files
deigaisaacs
authored andcommitted
Removes special handling of npm test
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.
1 parent b498cf0 commit deffadc

9 files changed

Lines changed: 5 additions & 33 deletions

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,3 +695,4 @@ Jarda Snajdr <jsnajdr@gmail.com>
695695
Naix Geng <1308363651@qq.com>
696696
Dylan Treisman <dylanzt@gmail.com>
697697
mum-never-proud <abhuz@hotmail.com>
698+
Timo Sand <timo.sand@iki.fi>

test/need-npm5-update/rm-linked.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ var linkedJSON = {
2626
version: '1.0.0',
2727
description: '',
2828
main: 'index.js',
29-
scripts: {
30-
test: 'echo "Error: no test specified" && exit 1'
31-
},
3229
dependencies: {
3330
'baz': '1.0.0'
3431
},
@@ -41,9 +38,6 @@ var linkedDepJSON = {
4138
version: '1.0.0',
4239
description: '',
4340
main: 'index.js',
44-
scripts: {
45-
test: 'echo "Error: no test specified" && exit 1'
46-
},
4741
author: '',
4842
license: 'ISC'
4943
}
@@ -53,9 +47,6 @@ var installJSON = {
5347
version: '1.0.0',
5448
description: '',
5549
main: 'index.js',
56-
scripts: {
57-
test: 'echo "Error: no test specified" && exit 1'
58-
},
5950
dependencies: {
6051
'foo': '1.0.0'
6152
},

test/tap/install-test-cli-without-package-lock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test('\'npm install-test\' should not generate package-lock.json.*', function (t
5151
if (err) throw err
5252
t.comment(stdout.trim())
5353
t.comment(stderr.trim())
54-
t.is(code, 0, 'npm install did not raise error code')
54+
t.is(code, 1, 'npm install-test w/o test defined should return error')
5555
var files = fs.readdirSync(pkg).filter(function (f) {
5656
return f.indexOf('package-lock.json.') === 0
5757
})

test/tap/legacy-test-package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test('test-package', function (t) {
4242

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

test/tap/link.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ var readJSON = {
2626
version: '1.0.0',
2727
description: '',
2828
main: 'index.js',
29-
scripts: {
30-
test: 'echo "Error: no test specified" && exit 1'
31-
},
3229
author: '',
3330
license: 'ISC'
3431
}
@@ -38,9 +35,6 @@ var readScopedJSON = {
3835
version: '1.0.0',
3936
description: '',
4037
main: 'index.js',
41-
scripts: {
42-
test: 'echo "Error: no test specified" && exit 1'
43-
},
4438
author: '',
4539
license: 'ISC'
4640
}
@@ -50,9 +44,6 @@ var installJSON = {
5044
version: '1.0.0',
5145
description: '',
5246
main: 'index.js',
53-
scripts: {
54-
test: 'echo "Error: no test specified" && exit 1'
55-
},
5647
author: '',
5748
license: 'ISC'
5849
}
@@ -62,9 +53,6 @@ var insideInstallJSON = {
6253
version: '1.0.0',
6354
description: '',
6455
main: 'index.js',
65-
scripts: {
66-
test: 'echo "Error: no test specified" && exit 1'
67-
},
6856
author: '',
6957
license: 'ISC'
7058
}

test/tap/no-global-warns.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ var installJSON = {
2828
version: '1.0.0',
2929
description: '',
3030
main: 'index.js',
31-
scripts: {
32-
test: 'echo "Error: no test specified" && exit 1'
33-
},
3431
author: '',
3532
license: 'ISC'
3633
}

test/tap/run-script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ test('npm run-script explicitly call pre script with arg', function (t) {
166166

167167
test('npm run-script test', function (t) {
168168
common.npm(['run-script', 'test'], opts, function (er, code, stdout, stderr) {
169+
t.match(stderr, /npm ERR! missing script: test/)
169170
t.ifError(er, 'npm run-script test ran without issue')
170-
t.notOk(stderr, 'should not generate errors')
171+
t.ok(stderr, 'should generate errors')
171172
t.end()
172173
})
173174
})

test/tap/sorted-package-json.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ fs.writeFileSync(packageJson, JSON.stringify({
1313
'version': '0.0.0',
1414
'description': '',
1515
'main': 'index.js',
16-
'scripts': {
17-
'test': 'echo \'Error: no test specified\' && exit 1'
18-
},
1916
'author': 'Rocko Artischocko',
2017
'license': 'ISC',
2118
'dependencies': {

test/tap/symlink-cycle.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ var cycleJSON = {
1414
version: '1.0.0',
1515
description: '',
1616
main: 'index.js',
17-
scripts: {
18-
test: 'echo "Error: no test specified" && exit 1'
19-
},
2017
dependencies: {
2118
'cycle': '*'
2219
},

0 commit comments

Comments
 (0)