• Home
  • Raw
  • Download

Lines Matching full:config

11 t.test('config no args', async t => {
15 sandbox.run('config', []),
23 t.test('config ignores workspaces', async t => {
27 sandbox.run('config', ['--workspaces']),
35 t.test('config list', async t => {
52 await sandbox.run('config', ['list'])
57 t.test('config list --long', async t => {
74 await sandbox.run('config', ['list', '--long'])
79 t.test('config list --json', async t => {
96 await sandbox.run('config', ['list', '--json'])
101 t.test('config list with publishConfig', async t => {
115 await sandbox.run('config', ['list', ''])
116 await sandbox.run('config', ['list', '--global'])
121 t.test('config delete no args', async t => {
125 sandbox.run('config', ['delete']),
133 t.test('config delete single key', async t => {
140 await sandbox.run('config', ['delete', 'access'])
142 t.equal(sandbox.config.get('access'), null, 'acces should be defaulted')
149 t.test('config delete multiple keys', async t => {
155 await sandbox.run('config', ['delete', 'access', 'all'])
157 t.equal(sandbox.config.get('access'), null, 'access should be defaulted')
158 t.equal(sandbox.config.get('all'), false, 'all should be defaulted')
166 t.test('config delete key --location=global', async t => {
172 await sandbox.run('config', ['delete', 'access', '--location=global'])
174 t.equal(sandbox.config.get('access', 'global'), undefined, 'access should be defaulted')
181 t.test('config delete key --global', async t => {
187 await sandbox.run('config', ['delete', 'access', '--global'])
189 t.equal(sandbox.config.get('access', 'global'), undefined, 'access should no longer be set')
196 t.test('config set invalid option', async t => {
199 sandbox.run('config', ['set', 'nonexistantconfigoption', 'something']),
204 t.test('config set deprecated option', async t => {
207 sandbox.run('config', ['set', 'shrinkwrap', 'true']),
212 t.test('config set nerf-darted option', async t => {
214 await sandbox.run('config', ['set', '//npm.pkg.github.com/:_authToken', '0xdeadbeef'])
216 sandbox.config.get('//npm.pkg.github.com/:_authToken'),
218 'nerf-darted config is set'
222 t.test('config set scoped optoin', async t => {
224 await sandbox.run('config', ['set', '@npm:registry', 'https://registry.npmjs.org'])
226 sandbox.config.get('@npm:registry'),
228 'scoped config is set'
232 t.test('config set no args', async t => {
236 sandbox.run('config', ['set']),
244 t.test('config set key', async t => {
251 await sandbox.run('config', ['set', 'access'])
253 t.equal(sandbox.config.get('access'), null, 'set the value for access')
255 await t.rejects(fs.stat(join(home, '.npmrc'), { encoding: 'utf8' }), 'removed empty config')
258 t.test('config set key value', async t => {
265 await sandbox.run('config', ['set', 'access', 'restricted'])
267 t.equal(sandbox.config.get('access'), 'restricted', 'set the value for access')
274 t.test('config set key=value', async t => {
281 await sandbox.run('config', ['set', 'access=restricted'])
283 t.equal(sandbox.config.get('access'), 'restricted', 'set the value for access')
290 t.test('config set key1 value1 key2=value2 key3', async t => {
296 await sandbox.run('config', ['set', 'access', 'restricted', 'all=false', 'audit'])
298 t.equal(sandbox.config.get('access'), 'restricted', 'access was set')
299 t.equal(sandbox.config.get('all'), false, 'all was set')
300 t.equal(sandbox.config.get('audit'), true, 'audit was unset and restored to its default')
306 t.not(contents.includes('audit='), 'config file does not set audit')
309 t.test('config set invalid key logs warning', async t => {
313 await sandbox.run('config', ['set', 'access=foo'])
316 [['invalid config', 'access="foo"', `set in ${join(sandbox.home, '.npmrc')}`]],
321 t.test('config set key=value --location=global', async t => {
327 await sandbox.run('config', ['set', 'access=restricted', '--location=global'])
329 t.equal(sandbox.config.get('access', 'global'), 'restricted', 'foo should be set')
336 t.test('config set key=value --global', async t => {
342 await sandbox.run('config', ['set', 'access=restricted', '--global'])
344 t.equal(sandbox.config.get('access', 'global'), 'restricted', 'access should be set')
351 t.test('config get no args', async t => {
354 await sandbox.run('config', ['get'])
359 await sandbox.run('config', ['list'])
365 t.test('config get single key', async t => {
368 await sandbox.run('config', ['get', 'all'])
369 t.equal(sandbox.output, `${sandbox.config.get('all')}`, 'should get the value')
372 t.test('config get multiple keys', async t => {
375 await sandbox.run('config', ['get', 'yes', 'all'])
377 sandbox.output.includes(`yes=${sandbox.config.get('yes')}`),
381 sandbox.output.includes(`all=${sandbox.config.get('all')}`),
386 t.test('config get private key', async t => {
390 sandbox.run('config', ['get', '_authToken']),
396 sandbox.run('config', ['get', '//localhost:8080/:_password']),
402 t.test('config edit', async t => {
411 await sandbox.run('config', ['edit'])
417 'editor opened the user config file'
426 t.test('config edit - editor exits non-0', async t => {
433 sandbox.run('config', ['edit']),
444 'editor opened the user config file'
448 t.test('config fix', (t) => {
455 await sandbox.run('config', ['fix'])
474 await sandbox.run('config', ['fix'])
476 // global config fixes
477 t.match(sandbox.output, '`_authtoken` deleted from global config',
479 t.match(sandbox.output, `\`_authToken\` renamed to \`${registry}:_authToken\` in global config`,
481 t.not(sandbox.config.get('_authtoken', 'global'), '_authtoken is not set globally')
482 t.not(sandbox.config.get('_authToken', 'global'), '_authToken is not set globally')
483 t.equal(sandbox.config.get(`${registry}:_authToken`, 'global'), 'afaketoken',
486 t.equal(globalConfig, `${registry}:_authToken=afaketoken\n`, 'global config was written')
488 // user config fixes
489 t.match(sandbox.output, '`_authtoken` deleted from user config',
491 t.match(sandbox.output, `\`_auth\` renamed to \`${registry}:_auth\` in user config`,
493 t.not(sandbox.config.get('_authtoken', 'user'), '_authtoken is not set in user config')
494 t.not(sandbox.config.get('_auth'), '_auth is not set in user config')
495 t.equal(sandbox.config.get(`${registry}:_auth`, 'user'), 'beef', 'user _auth was scoped')
497 t.equal(userConfig, `${registry}:_auth=beef\n`, 'user config was written')
500 t.test('repairs only the config specified by --location if asked', async (t) => {
515 await sandbox.run('config', ['fix', '--location=user'])
517 // global config should be untouched
522 t.equal(sandbox.config.get('_authtoken', 'global'), 'notatoken', 'global _authtoken untouched')
523 t.equal(sandbox.config.get('_authToken', 'global'), 'afaketoken', 'global _authToken untouched')
524 t.not(sandbox.config.get(`${registry}:_authToken`, 'global'), 'global _authToken not scoped')
527 'global config was not written')
529 // user config fixes
534 t.not(sandbox.config.get('_authtoken', 'user'), '_authtoken is not set in user config')
535 t.not(sandbox.config.get('_auth', 'user'), '_auth is not set in user config')
536 t.equal(sandbox.config.get(`${registry}:_auth`, 'user'), 'beef', 'user _auth was scoped')
538 t.equal(userConfig, `${registry}:_auth=beef\n`, 'user config was written')
549 t.match(await sandbox.complete('config', argv), expect, argv.join(' '))
551 allKeys = Object.keys(sandbox.config.definitions)
571 const partial = await sandbox.complete('config', 'l')