• Home
  • Raw
  • Download

Lines Matching +full:local +full:- +full:dir

4 const { load: loadMockNpm } = require('../fixtures/mock-npm.js')
5 const mockGlobals = require('@npmcli/mock-globals')
6 const { commands } = require('../../lib/utils/cmd-list.js')
50 const { npm, logs, prefix: dir, cache, other } = await loadMockNpm(t, {
66 ['npm:load', /Completed in [0-9.]+ms/],
75 t.equal(npm.prefix, npm.localPrefix, 'prefix is local prefix')
79 npm.localPrefix = dir + '/extra/prefix'
80 t.equal(npm.prefix, npm.localPrefix, 'prefix is local prefix after localPrefix setter')
83 npm.prefix = dir + '/some/prefix'
84 t.equal(npm.prefix, npm.localPrefix, 'prefix is local prefix after prefix setter')
86 t.equal(npm.bin, npm.localBin, 'bin is local bin after prefix setter')
88 t.equal(npm.dir, npm.localDir, 'dir is local dir after prefix setter')
89 t.not(npm.dir, npm.globalDir, 'dir is not global dir after prefix setter')
93 t.not(npm.prefix, npm.localPrefix, 'prefix is not local prefix after setting global')
95 t.not(npm.bin, npm.localBin, 'bin is not local bin after setting global')
96 t.equal(npm.dir, npm.globalDir, 'dir is global dir after setting global')
97 t.not(npm.dir, npm.localDir, 'dir is not local dir after setting global')
99 npm.prefix = dir + '/new/global/prefix'
101 t.not(npm.prefix, npm.localPrefix, 'prefix is not local prefix after prefix setter')
103 t.not(npm.bin, npm.localBin, 'bin is not local bin after prefix setter')
107 t.equal(npm.dir, npm.globalDir, 'dir is global dir in windows mode')
113 'process.argv': [...process.argv, '--force', '--color', 'always'],
118 'using --force',
135 '--usage',
136 '--scope=foo',
150 ['npm:load:whichnode', /Completed in [0-9.]+ms/],
153 ['argv', '"--usage" "--scope" "foo" "token" "revoke" "blergggg"'],
154 ['logfile', /logs-max:\d+ dir:.*/],
155 ['logfile', /.*-debug-0.log/],
156 ['npm:load', /Completed in [0-9.]+ms/],
173 await npm.exec('get', ['scope', '\u2010not-a-dash'])
182 'Argument starts with non-ascii dash, this is probably invalid:',
183 '\u2010not-a-dash',
188 /Completed in [0-9.]+ms/,
193 /Completed in [0-9.]+ms/,
196 t.same(outputs, [['scope=@foo\n\u2010not-a-dash=undefined']])
199 await t.test('--no-workspaces with --workspace', async t => {
221 '--color', 'false',
222 '--workspaces', 'false',
223 '--workspace', 'a',
229 /Can not use --no-workspaces and --workspace at the same time/
233 await t.test('workspace-aware configs and commands', async t => {
262 '--color', 'false',
263 '--workspaces', 'true',
270 t.equal(npm.command, 'run-script', 'npm.command set to canonical name')
315 '--color',
317 '--workspaces',
318 '--global',
338 '--usage',
339 '--scope=foo',
354 '--usage',
355 '--scope=foo',
372 '--usage',
373 '--scope=foo',
405 t.test('can load with bad dir', async t => {
409 'logs-dir': join(dirs.testdir, 'my_logs_dir'),
414 // make logs dir a file before load so it files
416 await t.resolves(npm.load(), 'loads with invalid logs dir')
419 t.strictSame(fs.readFileSync(logsDir, 'utf-8'), 'A_TEXT_FILE')
423 t.test('cache dir', async t => {
424 t.test('creates a cache dir', async t => {
427 t.ok(fs.existsSync(npm.cache), 'cache dir exists')
430 t.test('can load with a bad cache dir', async t => {
438 await t.resolves(npm.load(), 'loads with cache dir as a file')
440 t.equal(fs.readFileSync(cache, 'utf-8'), 'A_TEXT_FILE')
457 ['foo', /Completed in [0-9]+ms/],
458 ['bar', /Completed in [0-9]+ms/],
459 ['npm', /Completed in [0-9]+ms/],
480 t.match(npm.timingFile, /-timing.json$/)
559 t.match(Npm.cmd('it').name, 'install-test')
560 t.match(Npm.cmd('installTe').name, 'install-test')
587 '--color', 'false',
588 '--workspace', './packages/a',
621 '--color', 'false',
622 '--workspace', './packages/a',
655 '--color', 'false',
687 const lastCmd = commands[commands.length - 1]