Lines Matching full:cache
14 .replace(/Cache verified and compressed (.*)/, 'Cache verified and compressed ({PATH})')
17 t.test('cache no args', async t => {
20 npm.exec('cache', []),
26 t.test('cache clean', async t => {
29 npm.exec('cache', ['clean']),
30 /the npm cache self-heals/,
35 t.test('cache clean (force)', async t => {
40 const cache = path.join(npm.cache, '_cacache') constant
41 await npm.exec('cache', ['clean'])
42 t.notOk(fs.existsSync(cache), 'cache dir was removed')
45 t.test('cache add no arg', async t => {
48 npm.exec('cache', ['add']),
57 t.test('cache add single pkg', async t => {
68 const cache = path.join(npm.cache, '_cacache') constant
75 await npm.exec('cache', ['add', pkg])
78 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
80 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
83 t.test('cache add multiple pkgs', async t => {
95 const cache = path.join(npm.cache, '_cacache') constant
106 await npm.exec('cache', ['add', pkg, pkg2])
109 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
111 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
113 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
115 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
118 t.test('cache ls', async t => {
120 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package',
122 …'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz',
125 const cache = path.join(npm.cache, '_cacache') constant
127 await cacache.put(cache, key, 'test data')
129 await npm.exec('cache', ['ls'])
130 t.matchSnapshot(joinedOutput(), 'logs cache entries')
133 t.test('cache ls pkgs', async t => {
135 'make-fetch-happen:request-cache:https://registry.npmjs.org/npm',
136 'make-fetch-happen:request-cache:https://registry.npmjs.org/npm/-/npm-1.2.0.tgz',
137 'make-fetch-happen:request-cache:https://registry.npmjs.org/webpack/-/webpack-4.47.0.tgz',
138 'make-fetch-happen:request-cache:https://registry.npmjs.org/webpack/-/webpack-4.40.0.tgz',
141 const cache = path.join(npm.cache, '_cacache') constant
143 await cacache.put(cache, key, 'test data')
145 await cacache.put(cache,
146 'make-fetch-happen:request-cache:https://registry.npmjs.org/webpack',
152 await npm.exec('cache', ['ls', 'webpack@>4.44.1', 'npm'])
153 t.matchSnapshot(joinedOutput(), 'logs cache entries for npm and webpack and one webpack tgz')
156 t.test('cache ls special', async t => {
158 const cache = path.join(npm.cache, '_cacache') constant
159 await cacache.put(cache,
160 'make-fetch-happen:request-cache:https://registry.npmjs.org/foo',
163 await cacache.put(cache,
164 'make-fetch-happen:request-cache:https://registry.npmjs.org/foo/-/foo-1.2.3-beta.tgz',
167 await npm.exec('cache', ['ls', 'foo@1.2.3-beta'])
168 t.matchSnapshot(joinedOutput(), 'logs cache entries for foo')
171 t.test('cache ls nonpublic registry', async t => {
173 const cache = path.join(npm.cache, '_cacache') constant
174 await cacache.put(cache,
175 'make-fetch-happen:request-cache:https://somerepo.github.org/extemporaneously',
180 await cacache.put(cache,
181 'make-fetch-happen:request-cache:https://somerepo.github.org/aabbcc/',
184 await npm.exec('cache', ['ls', 'extemporaneously'])
185 t.matchSnapshot(joinedOutput(), 'logs cache entry for extemporaneously and its tarball')
188 t.test('cache ls tagged', async t => {
191 npm.exec('cache', ['ls', 'webpack@latest']),
197 t.test('cache ls scoped and scoped slash', async t => {
200 …'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy/staydown/-/@fritzy/staydown-3.…
201 'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy%2fstaydown',
203 …'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar/npm-expansion/-/@gar/npm-expansio…
204 'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar%2fnpm-expansion',
207 const cache = path.join(npm.cache, '_cacache') constant
209 await cacache.put(cache, key, 'test data')
211 await npm.exec('cache', ['ls', '@fritzy/staydown', '@gar/npm-expansion'])
212 t.matchSnapshot(joinedOutput(), 'logs cache entries for @gar and @fritzy')
215 t.test('cache ls corrupted', async t => {
217 'make-fetch-happen:request-cache:https://registry.npmjs.org/corrupted',
218 'make-fetch-happen:request-cache:https://registry.npmjs.org/corrupted/-/corrupted-3.1.0.tgz',
221 const cache = path.join(npm.cache, '_cacache') constant
223 await cacache.put(cache, key, Buffer.from('<>>>}"'))
225 await npm.exec('cache', ['ls', 'corrupted'])
226 t.matchSnapshot(joinedOutput(), 'logs cache entries with bad data')
229 t.test('cache ls missing packument version not an object', async t => {
231 const cache = path.join(npm.cache, '_cacache') constant
232 await cacache.put(cache,
233 'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-version',
236 await npm.exec('cache', ['ls', 'missing-version'])
237 t.matchSnapshot(joinedOutput(), 'logs cache entry for packument')
240 t.test('cache rm', async t => {
242 const cache = path.join(npm.cache, '_cacache') constant
244 …await cacache.put(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package'…
246 …await cacache.put(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/…
248 …await npm.exec('cache', ['rm', 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pa…
251 …t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pac…
253 …t.rejects(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-pack…
256 t.test('cache rm unfound', async t => {
258 await npm.exec('cache', ['rm', 'made-up-key'])
262 t.test('cache verify', async t => {
264 await npm.exec('cache', ['verify'])
265 t.matchSnapshot(joinedOutput(), 'shows verified cache output')
268 t.test('cache verify as part of home', async t => {
272 await npm.exec('cache', ['verify'])
273 t.match(joinedOutput(), 'Cache verified and compressed (~', 'contains ~ shorthand')
276 t.test('cache verify w/ extra output', async t => {
300 await npm.exec('cache', ['verify'])
304 t.test('cache completion', async t => {
305 const { cache } = await loadMockNpm(t, { command: 'cache' })
306 const { completion } = cache
313 testComp(['npm', 'cache'], ['add', 'clean', 'verify']),
314 testComp(['npm', 'cache', 'add'], []),
315 testComp(['npm', 'cache', 'clean'], []),
316 testComp(['npm', 'cache', 'verify'], []),