Skip to content

Commit a03809d

Browse files
committed
test: verify npm compatibility with releases
This adds a test that makes sure than running `npm` from a release does not print warnings to the console. PR-URL: #30082 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 1cfa98c commit a03809d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/parallel/test-release-npm.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const child_process = require('child_process');
6+
const path = require('path');
7+
8+
const releaseReg = /^v\d+\.\d+\.\d+$/;
9+
10+
if (!releaseReg.test(process.version)) {
11+
common.skip('This test is only for release builds');
12+
}
13+
14+
{
15+
// Verify that npm does not print out a warning when executed
16+
17+
const npmCli = path.join(__dirname, '../../deps/npm/bin/npm-cli.js');
18+
const npmExec = child_process.spawnSync(process.execPath, [npmCli]);
19+
assert.strictEqual(npmExec.status, 1);
20+
21+
const stderr = npmExec.stderr.toString();
22+
assert.strictEqual(stderr.length, 0, 'npm is not ready for this release ' +
23+
'and is going to print warnings to users:\n' + stderr);
24+
}

0 commit comments

Comments
 (0)