mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-21 22:34:21 +08:00
test: suppress npm update warnings
This commit is contained in:
parent
13eaa3916d
commit
aae30d5a84
@ -41,6 +41,11 @@ export default async function () {
|
||||
setGlobalVariable('npm-global', npmModulesPrefix);
|
||||
setGlobalVariable('yarn-global', yarnModulesPrefix);
|
||||
|
||||
// Disable all update/notification related npm/yarn features such as the NPM updater notifier.
|
||||
// The NPM updater notifier may prevent the child process from closing until it timeouts after 3 minutes.
|
||||
process.env.NO_UPDATE_NOTIFIER = '1';
|
||||
process.env.NPM_CONFIG_UPDATE_NOTIFIER = 'false';
|
||||
|
||||
console.log(` Using "${npmModulesPrefix}" as e2e test global npm bin dir.`);
|
||||
console.log(` Using "${yarnModulesPrefix}" as e2e test global yarn bin dir.`);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import * as assert from 'assert';
|
||||
import { execSync } from 'child_process';
|
||||
import { valid as validSemVer } from 'semver';
|
||||
import { rimraf } from '../../utils/fs';
|
||||
import { getActivePackageManager } from '../../utils/packages';
|
||||
@ -21,16 +20,7 @@ export default async function () {
|
||||
}
|
||||
|
||||
// Get current package manager version to restore after tests
|
||||
const initialVersionText = execSync('npm --version', {
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
env: {
|
||||
...process.env,
|
||||
// NPM updater notifier will prevent the child process from closing until it timeouts after 3 minutes.
|
||||
NO_UPDATE_NOTIFIER: '1',
|
||||
NPM_CONFIG_UPDATE_NOTIFIER: 'false',
|
||||
},
|
||||
}).trim();
|
||||
const initialVersionText = (await npm('--version')).stdout.trim();
|
||||
const initialVersion = validSemVer(initialVersionText);
|
||||
assert.ok(
|
||||
initialVersion,
|
||||
|
@ -16,7 +16,7 @@ interface ExecOptions {
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
const NPM_CONFIG_RE = /^(npm_config_|yarn_)/i;
|
||||
const NPM_CONFIG_RE = /^(npm_config_|yarn_|no_update_notifier)/i;
|
||||
|
||||
let _processes: child_process.ChildProcess[] = [];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user