mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
5cbee6f57f
* fix: unpublish a package on storage package fix: unpublish a package on storage package fix unpublish e2e * Update index.ts * reuse cli e2e tests * npm 10 migrated * migrate tests * migrate tests * clean up * Create hot-crews-live.md
86 lines
2.9 KiB
TypeScript
86 lines
2.9 KiB
TypeScript
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
|
|
|
import {
|
|
addRegistry,
|
|
initialSetup,
|
|
npmUtils,
|
|
prepareGenericEmptyProject,
|
|
} from '@verdaccio/test-cli-commons';
|
|
|
|
export function runUnpublish(pnpm) {
|
|
describe('unpublish a package', () => {
|
|
let registry;
|
|
|
|
beforeAll(async () => {
|
|
const setup = await initialSetup();
|
|
registry = setup.registry;
|
|
await registry.init();
|
|
});
|
|
|
|
test.each([['@verdaccio/test1', 'super-package-do-not-exist-spam']])(
|
|
'should unpublish a full package %s',
|
|
async (pkgName) => {
|
|
const { tempFolder } = await prepareGenericEmptyProject(
|
|
pkgName,
|
|
'1.0.0-beta',
|
|
registry.port,
|
|
registry.getToken(),
|
|
registry.getRegistryUrl()
|
|
);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await npmUtils.bumpUpPackage(pnpm, tempFolder, pkgName, registry, ['minor']);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await npmUtils.bumpUpPackage(pnpm, tempFolder, pkgName, registry, ['minor']);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await npmUtils.bumpUpPackage(pnpm, tempFolder, pkgName, registry, ['major']);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
|
|
const resp2 = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'unpublish',
|
|
pkgName,
|
|
'--force',
|
|
'--loglevel=info',
|
|
'--json',
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
expect(resp2.stdout).toEqual('- @verdaccio/test1');
|
|
}
|
|
);
|
|
|
|
test.each([['@verdaccio/test1', 'super-package-do-not-exist-spam']])(
|
|
'should unpublish a package %s version',
|
|
async (pkgName) => {
|
|
const { tempFolder } = await prepareGenericEmptyProject(
|
|
pkgName,
|
|
'1.0.0-beta',
|
|
registry.port,
|
|
registry.getToken(),
|
|
registry.getRegistryUrl()
|
|
);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await npmUtils.bumpUpPackage(pnpm, tempFolder, pkgName, registry, ['minor']);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await npmUtils.bumpUpPackage(pnpm, tempFolder, pkgName, registry, ['minor']);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
await npmUtils.bumpUpPackage(pnpm, tempFolder, pkgName, registry, ['major']);
|
|
await npmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
|
|
|
const resp2 = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'unpublish',
|
|
`${pkgName}@1.0.0-beta`,
|
|
'--force',
|
|
'--loglevel=info',
|
|
'--json',
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
expect(resp2.stdout).toEqual('- @verdaccio/test1@1.0.0-beta');
|
|
}
|
|
);
|
|
|
|
afterAll(async () => {
|
|
registry.stop();
|
|
});
|
|
});
|
|
}
|