@@ -26,10 +26,10 @@ t.test('no args --force success', async t => {
26
26
authorization: 'test-auth-token',
27
27
})
28
28
const manifest = registry.manifest({ name: pkg })
29
-
await registry.package({ manifest, query: { write: true } })
29
+
await registry.package({ manifest, query: { write: true }, times: 2 })
30
30
registry.unpublish({ manifest })
31
31
await npm.exec('unpublish', [])
32
-
t.equal(joinedOutput(), '- test-package@1.0.0')
32
+
t.equal(joinedOutput(), '- test-package')
33
33
})
34
34
35
35
t.test('no args --force missing package.json', async t => {
@@ -63,11 +63,11 @@ t.test('no args --force error reading package.json', async t => {
63
63
)
64
64
})
65
65
66
-
t.test('no args entire project', async t => {
66
+
t.test('no force entire project', async t => {
67
67
const { npm } = await loadMockNpm(t)
68
68
69
69
await t.rejects(
70
-
npm.exec('unpublish', []),
70
+
npm.exec('unpublish', ['@npmcli/unpublish-test']),
71
71
/Refusing to delete entire project/
72
72
)
73
73
})
@@ -82,6 +82,26 @@ t.test('too many args', async t => {
82
82
)
83
83
})
84
84
85
+
t.test('range', async t => {
86
+
const { npm } = await loadMockNpm(t)
87
+
88
+
await t.rejects(
89
+
npm.exec('unpublish', ['a@>1.0.0']),
90
+
{ code: 'EUSAGE' },
91
+
/single version/
92
+
)
93
+
})
94
+
95
+
t.test('tag', async t => {
96
+
const { npm } = await loadMockNpm(t)
97
+
98
+
await t.rejects(
99
+
npm.exec('unpublish', ['a@>1.0.0']),
100
+
{ code: 'EUSAGE' },
101
+
/single version/
102
+
)
103
+
})
104
+
85
105
t.test('unpublish <pkg>@version not the last version', async t => {
86
106
const { joinedOutput, npm } = await loadMockNpm(t, {
87
107
config: {
@@ -129,7 +149,24 @@ t.test('unpublish <pkg>@version last version', async t => {
129
149
)
130
150
})
131
151
132
-
t.test('no version found in package.json', async t => {
152
+
t.test('no version found in package.json no force', async t => {
153
+
const { npm } = await loadMockNpm(t, {
154
+
config: {
155
+
...auth,
156
+
},
157
+
prefixDir: {
158
+
'package.json': JSON.stringify({
159
+
name: pkg,
160
+
}, null, 2),
161
+
},
162
+
})
163
+
await t.rejects(
164
+
npm.exec('unpublish', []),
165
+
/Refusing to delete entire project/
166
+
)
167
+
})
168
+
169
+
t.test('no version found in package.json with force', async t => {
133
170
const { joinedOutput, npm } = await loadMockNpm(t, {
134
171
config: {
135
172
force: true,
@@ -147,7 +184,7 @@ t.test('no version found in package.json', async t => {
147
184
authorization: 'test-auth-token',
148
185
})
149
186
const manifest = registry.manifest({ name: pkg })
150
-
await registry.package({ manifest, query: { write: true } })
187
+
await registry.package({ manifest, query: { write: true }, times: 2 })
151
188
registry.unpublish({ manifest })
152
189
153
190
await npm.exec('unpublish', [])
@@ -219,7 +256,7 @@ t.test('workspaces', async t => {
219
256
'workspace-b': {
220
257
'package.json': JSON.stringify({
221
258
name: 'workspace-b',
222
-
version: '1.2.3-n',
259
+
version: '1.2.3-b',
223
260
repository: 'https://github.com/npm/workspace-b',
224
261
}),
225
262
},
@@ -231,20 +268,20 @@ t.test('workspaces', async t => {
231
268
},
232
269
}
233
270
234
-
t.test('no force', async t => {
271
+
t.test('with package name no force', async t => {
235
272
const { npm } = await loadMockNpm(t, {
236
273
config: {
237
-
workspaces: true,
274
+
workspace: ['workspace-a'],
238
275
},
239
276
prefixDir,
240
277
})
241
278
await t.rejects(
242
-
npm.exec('unpublish', []),
279
+
npm.exec('unpublish', ['workspace-a']),
243
280
/Refusing to delete entire project/
244
281
)
245
282
})
246
283
247
-
t.test('all workspaces --force', async t => {
284
+
t.test('all workspaces last version --force', async t => {
248
285
const { joinedOutput, npm } = await loadMockNpm(t, {
249
286
config: {
250
287
workspaces: true,
@@ -258,9 +295,9 @@ t.test('workspaces', async t => {
258
295
registry: npm.config.get('registry'),
259
296
authorization: 'test-auth-token',
260
297
})
261
-
const manifestA = registry.manifest({ name: 'workspace-a' })
262
-
const manifestB = registry.manifest({ name: 'workspace-b' })
263
-
const manifestN = registry.manifest({ name: 'workspace-n' })
298
+
const manifestA = registry.manifest({ name: 'workspace-a', versions: ['1.2.3-a'] })
299
+
const manifestB = registry.manifest({ name: 'workspace-b', versions: ['1.2.3-b'] })
300
+
const manifestN = registry.manifest({ name: 'workspace-n', versions: ['1.2.3-n'] })
264
301
await registry.package({ manifest: manifestA, query: { write: true }, times: 2 })
265
302
await registry.package({ manifest: manifestB, query: { write: true }, times: 2 })
266
303
await registry.package({ manifest: manifestN, query: { write: true }, times: 2 })
@@ -271,28 +308,6 @@ t.test('workspaces', async t => {
271
308
await npm.exec('unpublish', [])
272
309
t.equal(joinedOutput(), '- workspace-a\n- workspace-b\n- workspace-n')
273
310
})
274
-
275
-
t.test('one workspace --force', async t => {
276
-
const { joinedOutput, npm } = await loadMockNpm(t, {
277
-
config: {
278
-
workspace: ['workspace-a'],
279
-
force: true,
280
-
...auth,
281
-
},
282
-
prefixDir,
283
-
})
284
-
const registry = new MockRegistry({
285
-
tap: t,
286
-
registry: npm.config.get('registry'),
287
-
authorization: 'test-auth-token',
288
-
})
289
-
const manifestA = registry.manifest({ name: 'workspace-a' })
290
-
await registry.package({ manifest: manifestA, query: { write: true }, times: 2 })
291
-
registry.nock.delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201)
292
-
293
-
await npm.exec('unpublish', [])
294
-
t.equal(joinedOutput(), '- workspace-a')
295
-
})
296
311
})
297
312
298
313
t.test('dryRun with spec', async t => {
@@ -331,6 +346,16 @@ t.test('dryRun with no args', async t => {
331
346
}, null, 2),
332
347
},
333
348
})
349
+
const registry = new MockRegistry({
350
+
tap: t,
351
+
registry: npm.config.get('registry'),
352
+
authorization: 'test-auth-token',
353
+
})
354
+
const manifest = registry.manifest({
355
+
name: pkg,
356
+
packuments: ['1.0.0', '1.0.1'],
357
+
})
358
+
await registry.package({ manifest, query: { write: true } })
334
359
335
360
await npm.exec('unpublish', [])
336
361
t.equal(joinedOutput(), '- test-package@1.0.0')
@@ -360,10 +385,10 @@ t.test('publishConfig no spec', async t => {
360
385
authorization: 'test-other-token',
361
386
})
362
387
const manifest = registry.manifest({ name: pkg })
363
-
await registry.package({ manifest, query: { write: true } })
388
+
await registry.package({ manifest, query: { write: true }, times: 2 })
364
389
registry.unpublish({ manifest })
365
390
await npm.exec('unpublish', [])
366
-
t.equal(joinedOutput(), '- test-package@1.0.0')
391
+
t.equal(joinedOutput(), '- test-package')
367
392
})
368
393
369
394
t.test('publishConfig with spec', async t => {
@@ -421,7 +446,7 @@ t.test('scoped registry config', async t => {
421
446
authorization: 'test-other-token',
422
447
})
423
448
const manifest = registry.manifest({ name: scopedPkg })
424
-
await registry.package({ manifest, query: { write: true } })
449
+
await registry.package({ manifest, query: { write: true }, times: 2 })
425
450
registry.unpublish({ manifest })
426
451
await npm.exec('unpublish', [scopedPkg])
427
452
})
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4