Skip to content

restore npm_config_user_agent env variable #1919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update config related tests
  • Loading branch information
nlf committed Oct 7, 2020
commit 95c7d682bb587fd0959d68e8ed9ae71be36bd2d7
42 changes: 21 additions & 21 deletions tap-snapshots/test-lib-utils-config.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Object {
"cafile": null,
"call": "",
"cert": null,
"ci-name": null,
"cidr": null,
"color": true,
"commit-hooks": true,
Expand Down Expand Up @@ -78,6 +79,7 @@ Object {
"node-options": null,
"node-version": "v14.8.0",
"noproxy": null,
"npm-version": "7.0.0",
"offline": false,
"omit": Array [],
"only": null,
Expand Down Expand Up @@ -201,9 +203,6 @@ Object {
"n": Array [
"--no-yes",
],
"N": Array [
"--no-registry",
],
"no-desc": Array [
"--no-description",
],
Expand Down Expand Up @@ -317,6 +316,10 @@ Object {
null,
"{String TYPE}",
],
"ci-name": Array [
null,
"{String TYPE}",
],
"cidr": Array [
null,
"{String TYPE}",
Expand Down Expand Up @@ -349,10 +352,6 @@ Object {
"global": "{Boolean TYPE}",
"global-style": "{Boolean TYPE}",
"globalconfig": "{PATH MODULE}",
"group": Array [
"{Number TYPE}",
"{String TYPE}",
],
"heading": "{String TYPE}",
"https-proxy": Array [
null,
Expand Down Expand Up @@ -421,6 +420,7 @@ Object {
"{String TYPE}",
"{Array TYPE}",
],
"npm-version": "{SEMVER MODULE}",
"offline": "{Boolean TYPE}",
"omit": Array [
"{Array TYPE}",
Expand Down Expand Up @@ -543,6 +543,7 @@ Object {
"cafile": null,
"call": "",
"cert": null,
"ci-name": null,
"cidr": null,
"color": true,
"commit-hooks": true,
Expand Down Expand Up @@ -592,6 +593,7 @@ Object {
"node-options": null,
"node-version": "v14.8.0",
"noproxy": null,
"npm-version": "7.0.0",
"offline": false,
"omit": Array [],
"only": null,
Expand Down Expand Up @@ -715,9 +717,6 @@ Object {
"n": Array [
"--no-yes",
],
"N": Array [
"--no-registry",
],
"no-desc": Array [
"--no-description",
],
Expand Down Expand Up @@ -831,6 +830,10 @@ Object {
null,
"{String TYPE}",
],
"ci-name": Array [
null,
"{String TYPE}",
],
"cidr": Array [
null,
"{String TYPE}",
Expand Down Expand Up @@ -863,10 +866,6 @@ Object {
"global": "{Boolean TYPE}",
"global-style": "{Boolean TYPE}",
"globalconfig": "{PATH MODULE}",
"group": Array [
"{Number TYPE}",
"{String TYPE}",
],
"heading": "{String TYPE}",
"https-proxy": Array [
null,
Expand Down Expand Up @@ -935,6 +934,7 @@ Object {
"{String TYPE}",
"{Array TYPE}",
],
"npm-version": "{SEMVER MODULE}",
"offline": "{Boolean TYPE}",
"omit": Array [
"{Array TYPE}",
Expand Down Expand Up @@ -1057,6 +1057,7 @@ Object {
"cafile": null,
"call": "",
"cert": null,
"ci-name": null,
"cidr": null,
"color": true,
"commit-hooks": true,
Expand Down Expand Up @@ -1106,6 +1107,7 @@ Object {
"node-options": null,
"node-version": "v14.8.0",
"noproxy": null,
"npm-version": "7.0.0",
"offline": false,
"omit": Array [],
"only": null,
Expand Down Expand Up @@ -1229,9 +1231,6 @@ Object {
"n": Array [
"--no-yes",
],
"N": Array [
"--no-registry",
],
"no-desc": Array [
"--no-description",
],
Expand Down Expand Up @@ -1345,6 +1344,10 @@ Object {
null,
"{String TYPE}",
],
"ci-name": Array [
null,
"{String TYPE}",
],
"cidr": Array [
null,
"{String TYPE}",
Expand Down Expand Up @@ -1377,10 +1380,6 @@ Object {
"global": "{Boolean TYPE}",
"global-style": "{Boolean TYPE}",
"globalconfig": "{PATH MODULE}",
"group": Array [
"{Number TYPE}",
"{String TYPE}",
],
"heading": "{String TYPE}",
"https-proxy": Array [
null,
Expand Down Expand Up @@ -1451,6 +1450,7 @@ Object {
"{String TYPE}",
"{Array TYPE}",
],
"npm-version": "{SEMVER MODULE}",
"offline": "{Boolean TYPE}",
"omit": Array [
"{Array TYPE}",
Expand Down
10 changes: 7 additions & 3 deletions test/lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ const networkInterfaces = () => ({
})
const tmpdir = () => '/tmp'
const os = { networkInterfaces, tmpdir }
const pkg = { version: '7.0.0' }

t.test('working network interfaces, not windows', t => {
const config = requireInject('../../../lib/utils/config.js', {
os,
'@npmcli/ci-detect': () => false,
'../../../lib/utils/is-windows.js': false
'../../../lib/utils/is-windows.js': false,
'../../../package.json': pkg
})
t.matchSnapshot(config)
t.end()
Expand All @@ -85,7 +87,8 @@ t.test('no working network interfaces, on windows', t => {
const config = requireInject('../../../lib/utils/config.js', {
os: { tmpdir, networkInterfaces: networkInterfacesThrow },
'@npmcli/ci-detect': () => false,
'../../../lib/utils/is-windows.js': true
'../../../lib/utils/is-windows.js': true,
'../../../package.json': pkg
})
t.matchSnapshot(config)
t.end()
Expand All @@ -109,7 +112,8 @@ t.test('no process.umask() method', t => {
const config = requireInject('../../../lib/utils/config.js', {
os: { tmpdir, networkInterfaces: networkInterfacesThrow },
'@npmcli/ci-detect': () => false,
'../../../lib/utils/is-windows.js': true
'../../../lib/utils/is-windows.js': true,
'../../../package.json': pkg
})
t.equal(config.defaults.umask, 0o22)
t.matchSnapshot(config)
Expand Down