Skip to content
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
Next Next commit
test: add lib/config.js tests
  • Loading branch information
ruyadorno committed Oct 21, 2020
commit 433ffca9d9689986ea22e99fac07385cfc8f262c
150 changes: 150 additions & 0 deletions tap-snapshots/test-lib-config.js-TAP.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/lib/config.js TAP config edit --global > should write global config file 1`] = `
;;;;
; npm globalconfig file: /etc/npmrc
; this is a simple ini-formatted file
; lines that start with semi-colons are comments
; run \`npm help 7 config\` for documentation of the various options
;
; Configs like \`@scope:registry\` map a scope to a given registry url.
;
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
; to the registry host specified.

init.author.name=Foo

;;;;
; all available options shown below with default values
;;;;


; init-author-name=
; init-version=1.0.0
; init.author.name=
; init.version=1.0.0

`

exports[`test/lib/config.js TAP config edit > should write config file 1`] = `
;;;;
; npm userconfig file: ~/.npmrc
; this is a simple ini-formatted file
; lines that start with semi-colons are comments
; run \`npm help 7 config\` for documentation of the various options
;
; Configs like \`@scope:registry\` map a scope to a given registry url.
;
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
; to the registry host specified.

//registry.npmjs.org/:_authToken=0000000
init.author.name=Foo
sign-git-commit=true

;;;;
; all available options shown below with default values
;;;;


; init-author-name=
; init-version=1.0.0
; init.author.name=
; init.version=1.0.0

`

exports[`test/lib/config.js TAP config edit > should write config file 2`] = `
;;;;
; npm userconfig file: ~/.npmrc
; this is a simple ini-formatted file
; lines that start with semi-colons are comments
; run \`npm help 7 config\` for documentation of the various options
;
; Configs like \`@scope:registry\` map a scope to a given registry url.
;
; Configs like \`//<hostname>/:_authToken\` are auth that is restricted
; to the registry host specified.



;;;;
; all available options shown below with default values
;;;;


; init-author-name=
; init-version=1.0.0
; init.author.name=
; init.version=1.0.0

`

exports[`test/lib/config.js TAP config get no args > should list configs on config get no args 1`] = `
; "cli" config from command line options

editor = "vi"
global = false
json = false
long = false

; node bin location = /path/to/node
; cwd = {CWD}
; HOME = ~/
; Run \`npm config ls -l\` to show all defaults.
`

exports[`test/lib/config.js TAP config list --long > should list all configs 1`] = `
; "default" config from default values

init-author-name = ""
init-version = "1.0.0"
init.author.name = ""
init.version = "1.0.0"

; "cli" config from command line options

editor = "vi"
global = false
json = false
long = true
`

exports[`test/lib/config.js TAP config list > should list configs 1`] = `
; "cli" config from command line options

editor = "vi"
global = false
json = false
long = false

; node bin location = /path/to/node
; cwd = {CWD}
; HOME = ~/
; Run \`npm config ls -l\` to show all defaults.
`

exports[`test/lib/config.js TAP config list overrides > should list overriden configs 1`] = `
; "cli" config from command line options

editor = "vi"
global = false
init.author.name = "Bar"
json = false
long = false

; "user" config from ~/.npmrc

; //private-reg.npmjs.org/:_authThoken = (protected) ; overridden by cli
; init.author.name = "Foo" ; overridden by cli

; node bin location = /path/to/node
; cwd = {CWD}
; HOME = ~/
; Run \`npm config ls -l\` to show all defaults.
`
Loading