mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
fix: unpublish a package on storage package (#4937)
* 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
This commit is contained in:
parent
b6ea32c435
commit
5cbee6f57f
153 changed files with 2866 additions and 3349 deletions
|
@ -12,6 +12,22 @@
|
|||
"@verdaccio/ui-theme"
|
||||
]
|
||||
],
|
||||
"ignoredPackages": [
|
||||
"@verdaccio/test-cli-commons",
|
||||
"@verdaccio/e2e-cli-npm6",
|
||||
"@verdaccio/e2e-cli-npm7",
|
||||
"@verdaccio/e2e-cli-npm8",
|
||||
"@verdaccio/e2e-cli-npm9",
|
||||
"@verdaccio/e2e-cli-npm10",
|
||||
"@verdaccio/e2e-cli-npm-common",
|
||||
"@verdaccio/e2e-cli-yarn1",
|
||||
"@verdaccio/e2e-cli-yarn2",
|
||||
"@verdaccio/e2e-cli-yarn3",
|
||||
"@verdaccio/e2e-cli-yarn4",
|
||||
"@verdaccio/e2e-cli-pnpm8",
|
||||
"@verdaccio/e2e-cli-pnpm9",
|
||||
"@verdaccio/e2e-cli-pnpm10"
|
||||
],
|
||||
"access": "public",
|
||||
"baseBranch": "master",
|
||||
"updateInternalDependencies": "patch"
|
||||
|
|
9
.changeset/hot-crews-live.md
Normal file
9
.changeset/hot-crews-live.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
'@verdaccio/types': patch
|
||||
'@verdaccio/core': patch
|
||||
'verdaccio': patch
|
||||
'@verdaccio/store': patch
|
||||
'@verdaccio/api': patch
|
||||
---
|
||||
|
||||
fix: unpublish a package on storage package
|
23
.github/workflows/e2e-ci.yml
vendored
23
.github/workflows/e2e-ci.yml
vendored
|
@ -26,7 +26,7 @@ jobs:
|
|||
- name: Install pnpm
|
||||
run: |
|
||||
corepack enable
|
||||
corepack prepare
|
||||
corepack prepare
|
||||
- name: set store
|
||||
run: |
|
||||
mkdir ~/.pnpm-store
|
||||
|
@ -45,14 +45,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Use Node
|
||||
- name: Use Node
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- name: Install pnpm
|
||||
run: |
|
||||
corepack enable
|
||||
corepack prepare
|
||||
corepack prepare
|
||||
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
|
@ -83,7 +83,7 @@ jobs:
|
|||
e2e-cli-npm:
|
||||
needs: [prepare, build]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pkg:
|
||||
[
|
||||
|
@ -93,7 +93,7 @@ jobs:
|
|||
npm9,
|
||||
npm10
|
||||
]
|
||||
node: [20, 21]
|
||||
node: [20, 22]
|
||||
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -104,7 +104,7 @@ jobs:
|
|||
- name: Install pnpm
|
||||
run: |
|
||||
corepack enable
|
||||
corepack prepare
|
||||
corepack prepare
|
||||
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
|
@ -136,8 +136,9 @@ jobs:
|
|||
[
|
||||
pnpm8,
|
||||
pnpm9,
|
||||
pnpm10,
|
||||
]
|
||||
node: [20, 21]
|
||||
node: [20, 22]
|
||||
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -176,13 +177,13 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
pkg:
|
||||
[
|
||||
[
|
||||
yarn1,
|
||||
yarn2,
|
||||
yarn3,
|
||||
yarn4
|
||||
]
|
||||
node: [20, 21]
|
||||
node: [20, 22]
|
||||
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -193,7 +194,7 @@ jobs:
|
|||
- name: Install pnpm
|
||||
run: |
|
||||
corepack enable
|
||||
corepack prepare
|
||||
corepack prepare
|
||||
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.0.2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
|
@ -215,4 +216,4 @@ jobs:
|
|||
run: pnpm --filter @verdaccio/test-cli-commons build
|
||||
- name: Test CLI
|
||||
run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}}
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
"private": true,
|
||||
"name": "@verdaccio/test-cli-commons",
|
||||
"version": "2.0.0-next-8.0",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"main": "src/index.ts",
|
||||
"devDependencies": {
|
||||
"@verdaccio/config": "workspace:8.0.0-next-8.4",
|
||||
"@verdaccio/core": "workspace:8.0.0-next-8.4",
|
||||
|
@ -18,9 +17,6 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "echo no test",
|
||||
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
||||
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
||||
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
|
||||
"build": "pnpm run build:js && pnpm run build:types"
|
||||
"build": "echo no build"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,31 @@
|
|||
import { deepEqual } from 'assert';
|
||||
import buildDebug from 'debug';
|
||||
|
||||
import { addRegistry } from './utils';
|
||||
|
||||
const debug = buildDebug('verdaccio:e2e:npm-utils');
|
||||
export async function bumbUp(cmd, tempFolder, registry) {
|
||||
await cmd({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
export async function publish(cmd, tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await cmd(
|
||||
export async function bumpUpPackage(cmd, tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
debug('bump up package %o', pkgName);
|
||||
await cmd(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'version',
|
||||
...arg,
|
||||
'--json',
|
||||
'--no--git-tag-version',
|
||||
'--loglevel=info',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
deepEqual(parsedBody.name, pkgName);
|
||||
}
|
||||
|
||||
export async function publish(cmd, tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
debug('publishing %o', pkgName);
|
||||
await cmd({ cwd: tempFolder }, 'publish', ...arg, ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
export async function getInfoVersions(cmd, pkgName, registry) {
|
||||
debug('getting info %o', pkgName);
|
||||
const infoResp = await cmd(
|
||||
{},
|
||||
'info',
|
||||
|
@ -27,5 +34,6 @@ export async function getInfoVersions(cmd, pkgName, registry) {
|
|||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
debug('info %o', infoBody);
|
||||
return infoBody;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import buildDebug from 'debug';
|
|||
import { createInterface } from 'readline';
|
||||
|
||||
const debug = buildDebug('verdaccio:e2e:process');
|
||||
const debugRead = buildDebug('verdaccio:e2e:line');
|
||||
|
||||
export type ExecOutput = {
|
||||
stdout: string;
|
||||
|
@ -11,7 +12,7 @@ export type ExecOutput = {
|
|||
};
|
||||
|
||||
export async function exec(options: SpawnOptions, cmd, args): Promise<ExecOutput> {
|
||||
debug('start _exec %o %o %o', options, cmd, args);
|
||||
debug('start _exec %o %o %o', options, cmd, args ? args.join(' ') : '');
|
||||
let stdout = '';
|
||||
let stderr;
|
||||
const env = options.env;
|
||||
|
@ -32,9 +33,17 @@ export async function exec(options: SpawnOptions, cmd, args): Promise<ExecOutput
|
|||
|
||||
const childProcess = spawn(cmd, args, spawnOptions);
|
||||
if (childProcess.stdout) {
|
||||
const rl = createInterface({ input: childProcess.stdout });
|
||||
childProcess.stdout.on('data', (data) => {
|
||||
debugRead('data %o', data.toString());
|
||||
});
|
||||
const rl = createInterface({
|
||||
input: childProcess.stdout,
|
||||
output: process.stdout,
|
||||
terminal: false,
|
||||
});
|
||||
|
||||
rl.on('line', function (line) {
|
||||
debugRead('line %o', line);
|
||||
stdout += line;
|
||||
});
|
||||
}
|
||||
|
@ -42,6 +51,7 @@ export async function exec(options: SpawnOptions, cmd, args): Promise<ExecOutput
|
|||
const err = new Error(`Running "${cmd} ${args.join(' ')}" returned error code `);
|
||||
return new Promise((resolve, reject) => {
|
||||
childProcess.on('exit', (error) => {
|
||||
debugRead('exit %o', error);
|
||||
if (!error) {
|
||||
resolve({ stdout, stderr });
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ export type Setup = {
|
|||
const log =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? { type: 'stdout', format: 'json', level: 'warn' }
|
||||
: { type: 'stdout', format: 'pretty', level: 'info' };
|
||||
: { type: 'stdout', format: 'pretty', level: 'debug' };
|
||||
|
||||
const defaultConfig = {
|
||||
...getDefaultConfig(),
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import buildDebug from 'debug';
|
||||
import fs from 'fs-extra';
|
||||
import { cp, readFile, writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
|
||||
import { fileUtils } from '@verdaccio/core';
|
||||
|
||||
const debug = buildDebug('verdaccio:e2e:utils');
|
||||
|
||||
export function createProject(projectName: string) {
|
||||
const tempRootFolder = global.__namespace.getItem('dir-suite-root');
|
||||
const verdaccioInstall = join(tempRootFolder, projectName);
|
||||
|
@ -13,12 +16,14 @@ export function createProject(projectName: string) {
|
|||
}
|
||||
export function copyConfigFile(rootFolder, configTemplate): string {
|
||||
const configPath = join(rootFolder, 'config.yaml');
|
||||
debug('copying config file %o', configPath);
|
||||
copyTo(join(__dirname, configTemplate), configPath);
|
||||
|
||||
return configPath;
|
||||
}
|
||||
|
||||
export async function createTempFolder(prefix: string) {
|
||||
debug('creating temp folder %o', prefix);
|
||||
return fileUtils.createTempFolder(prefix);
|
||||
}
|
||||
|
||||
|
@ -31,10 +36,12 @@ export function cleanUpTemp(tmpFolder) {
|
|||
}
|
||||
|
||||
export function addRegistry(registryUrl) {
|
||||
debug('adding registry %o', registryUrl);
|
||||
return ['--registry', registryUrl];
|
||||
}
|
||||
|
||||
export function addNpmPrefix(installFolder) {
|
||||
debug('adding prefix %o', installFolder);
|
||||
return ['--prefix', installFolder];
|
||||
}
|
||||
|
||||
|
@ -50,6 +57,7 @@ export async function prepareYarnModernProject(
|
|||
registryDomain: string,
|
||||
yarnPath: string
|
||||
) {
|
||||
debug('preparing yarn project %o', projectName);
|
||||
const tempFolder = await createTempFolder(projectName);
|
||||
// FUTURE: native copy folder instead fs-extra
|
||||
fs.copySync(templatePath, tempFolder);
|
||||
|
@ -67,6 +75,7 @@ export const getPackageJSON = (
|
|||
dependencies = {},
|
||||
devDependencies = {}
|
||||
) => {
|
||||
debug('creating package.json %o', packageName);
|
||||
const json = {
|
||||
name: packageName,
|
||||
version,
|
||||
|
@ -103,6 +112,7 @@ export async function prepareGenericEmptyProject(
|
|||
dependencies: any = {},
|
||||
devDependencies: any = {}
|
||||
) {
|
||||
debug('preparing generic project %o', packageName);
|
||||
const getNPMrc = (port, token, registry) => `//localhost:${port}/:_authToken=${token}
|
||||
registry=${registry}`;
|
||||
const tempFolder = await createTempFolder('temp-folder');
|
||||
|
|
3
e2e/cli/e2e-npm-commons/.babelrc
Normal file
3
e2e/cli/e2e-npm-commons/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../../.babelrc"
|
||||
}
|
7
e2e/cli/e2e-npm-commons/.eslintrc
Normal file
7
e2e/cli/e2e-npm-commons/.eslintrc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/explicit-member-accessibility": 0
|
||||
}
|
||||
}
|
45
e2e/cli/e2e-npm-commons/audit.ts
Normal file
45
e2e/cli/e2e-npm-commons/audit.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runAudit(npm) {
|
||||
describe('audit a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', '@verdaccio/cli']])(
|
||||
'should audit a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ jquery: '3.6.1' }
|
||||
);
|
||||
// install is required to create package lock file
|
||||
await npm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'audit',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.metadata).toBeDefined();
|
||||
expect(parsedBody.auditReportVersion).toBeDefined();
|
||||
expect(parsedBody.vulnerabilities).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
119
e2e/cli/e2e-npm-commons/deprecate.ts
Normal file
119
e2e/cli/e2e-npm-commons/deprecate.ts
Normal file
|
@ -0,0 +1,119 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runDeprecate(npm) {
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await npm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])(
|
||||
'should un-deprecate a package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
92
e2e/cli/e2e-npm-commons/dist-tags.ts
Normal file
92
e2e/cli/e2e-npm-commons/dist-tags.ts
Normal file
|
@ -0,0 +1,92 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runDistTag(npm) {
|
||||
describe('dist-tag a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
10
e2e/cli/e2e-npm-commons/index.ts
Normal file
10
e2e/cli/e2e-npm-commons/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
export { runAudit } from './audit';
|
||||
export { runDeprecate } from './deprecate';
|
||||
export { runInstall } from './install';
|
||||
export { runInfo } from './info';
|
||||
export { runPing } from './ping';
|
||||
export { runPublish } from './publish';
|
||||
export { runSearch } from './search';
|
||||
export { runStar } from './star';
|
||||
export { runUnpublish } from './unpublish';
|
||||
export { runDistTag } from './dist-tags';
|
32
e2e/cli/e2e-npm-commons/info.ts
Normal file
32
e2e/cli/e2e-npm-commons/info.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runInfo(npm) {
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm info json body', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
39
e2e/cli/e2e-npm-commons/install.ts
Normal file
39
e2e/cli/e2e-npm-commons/install.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runInstall(npm) {
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.added).toBeDefined();
|
||||
expect(parsedBody.audit).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
11
e2e/cli/e2e-npm-commons/package.json
Normal file
11
e2e/cli/e2e-npm-commons/package.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "@verdaccio/e2e-cli-npm-common",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo no test"
|
||||
}
|
||||
}
|
25
e2e/cli/e2e-npm-commons/ping.ts
Normal file
25
e2e/cli/e2e-npm-commons/ping.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runPing(npm) {
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await npm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
42
e2e/cli/e2e-npm-commons/publish.ts
Normal file
42
e2e/cli/e2e-npm-commons/publish.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runPublish(npm) {
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
34
e2e/cli/e2e-npm-commons/search.ts
Normal file
34
e2e/cli/e2e-npm-commons/search.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runSearch(npm) {
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
90
e2e/cli/e2e-npm-commons/star.ts
Normal file
90
e2e/cli/e2e-npm-commons/star.ts
Normal file
|
@ -0,0 +1,90 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runStar(npm) {
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'stars',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
8
e2e/cli/e2e-npm-commons/tsconfig.json
Normal file
8
e2e/cli/e2e-npm-commons/tsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.reference.json",
|
||||
"references": [
|
||||
{
|
||||
"path": "../cli-commons"
|
||||
}
|
||||
]
|
||||
}
|
86
e2e/cli/e2e-npm-commons/unpublish.ts
Normal file
86
e2e/cli/e2e-npm-commons/unpublish.ts
Normal file
|
@ -0,0 +1,86 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runUnpublish(npm) {
|
||||
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(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumpUpPackage(npm, tempFolder, pkgName, registry, ['minor']);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumpUpPackage(npm, tempFolder, pkgName, registry, ['minor']);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumpUpPackage(npm, tempFolder, pkgName, registry, ['major']);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
|
||||
const resp2 = await npm(
|
||||
{ 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(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumpUpPackage(npm, tempFolder, pkgName, registry, ['minor']);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumpUpPackage(npm, tempFolder, pkgName, registry, ['minor']);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumpUpPackage(npm, tempFolder, pkgName, registry, ['major']);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
|
||||
const resp2 = await npm(
|
||||
{ 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();
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,45 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runAudit } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', '@verdaccio/cli']])(
|
||||
'should audit a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ jquery: '3.6.1' }
|
||||
);
|
||||
// install is required to create package lock file
|
||||
await npm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'audit',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.metadata).toBeDefined();
|
||||
expect(parsedBody.auditReportVersion).toBeDefined();
|
||||
expect(parsedBody.vulnerabilities).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runAudit(npm);
|
||||
});
|
||||
|
|
|
@ -1,116 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDeprecate } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await npm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])('should un-deprecate a package %s', async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runDeprecate(npm);
|
||||
});
|
||||
|
|
|
@ -1,92 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDistTag } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('dist-tags a package', () => {
|
||||
runDistTag(npm);
|
||||
});
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runInfo } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm info json body', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('info a package', () => {
|
||||
runInfo(npm);
|
||||
});
|
||||
|
|
|
@ -1,39 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runInstall } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.added).toBeDefined();
|
||||
expect(parsedBody.audit).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runInstall(npm);
|
||||
});
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"version": "1.0.1",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0",
|
||||
"npm": "10.8.2"
|
||||
"@verdaccio/e2e-cli-npm-common": "workspace:*",
|
||||
"npm": "10.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run --testTimeout 50000"
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runPing } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await npm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runPing(npm);
|
||||
});
|
||||
|
|
|
@ -1,42 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runPublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('publish a package', () => {
|
||||
runPublish(npm);
|
||||
});
|
||||
|
|
|
@ -1,34 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runSearch } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runSearch(npm);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runStar } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm({ cwd: tempFolder }, 'stars', ...addRegistry(registry.getRegistryUrl()));
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runStar(npm);
|
||||
});
|
||||
|
|
9
e2e/cli/e2e-npm10/unpublish.spec.ts
Normal file
9
e2e/cli/e2e-npm10/unpublish.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runUnpublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('unpublish a package', () => {
|
||||
runUnpublish(npm);
|
||||
});
|
|
@ -1,116 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDeprecate } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await npm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])('should un-deprecate a package %s', async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runDeprecate(npm);
|
||||
});
|
||||
|
|
|
@ -1,92 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDistTag } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('dist-tags a package', () => {
|
||||
runDistTag(npm);
|
||||
});
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runInfo } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm info json body', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('info a package', () => {
|
||||
runInfo(npm);
|
||||
});
|
||||
|
|
|
@ -1,39 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runInstall } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.added).toBeDefined();
|
||||
expect(parsedBody.audit).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runInstall(npm);
|
||||
});
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"version": "1.0.2-next-8.0",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0",
|
||||
"npm": "9.9.3"
|
||||
"@verdaccio/e2e-cli-npm-common": "workspace:*",
|
||||
"npm": "6.14.18"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run --testTimeout 20000"
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runPing } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await npm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runPing(npm);
|
||||
});
|
||||
|
|
|
@ -1,43 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runPublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runPublish(npm);
|
||||
});
|
||||
|
|
|
@ -1,34 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runSearch } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runSearch(npm);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runStar } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm({ cwd: tempFolder }, 'stars', ...addRegistry(registry.getRegistryUrl()));
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runStar(npm);
|
||||
});
|
||||
|
|
9
e2e/cli/e2e-npm6/unpublish.spec.ts
Normal file
9
e2e/cli/e2e-npm6/unpublish.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runUnpublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('unpublish a package', () => {
|
||||
runUnpublish(npm);
|
||||
});
|
|
@ -1,45 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runAudit } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', '@verdaccio/cli']])(
|
||||
'should audit a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ jquery: '3.6.1' }
|
||||
);
|
||||
// install is required to create package lock file
|
||||
await npm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'audit',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.metadata).toBeDefined();
|
||||
expect(parsedBody.auditReportVersion).toBeDefined();
|
||||
expect(parsedBody.vulnerabilities).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runAudit(npm);
|
||||
});
|
||||
|
|
|
@ -1,116 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDeprecate } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await npm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])('should un-deprecate a package %s', async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runDeprecate(npm);
|
||||
});
|
||||
|
|
|
@ -1,92 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDistTag } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('dist-tags a package', () => {
|
||||
runDistTag(npm);
|
||||
});
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runInfo } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm info json body', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('info a package', () => {
|
||||
runInfo(npm);
|
||||
});
|
||||
|
|
|
@ -1,39 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runInstall } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.added).toBeDefined();
|
||||
expect(parsedBody.audit).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runInstall(npm);
|
||||
});
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"version": "1.0.2-next-8.0",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0",
|
||||
"npm": "9.9.3"
|
||||
"@verdaccio/e2e-cli-npm-common": "workspace:*",
|
||||
"npm": "7.24.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run --testTimeout 50000"
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runPing } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await npm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runPing(npm);
|
||||
});
|
||||
|
|
|
@ -1,42 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runPublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('publish a package', () => {
|
||||
runPublish(npm);
|
||||
});
|
||||
|
|
|
@ -1,34 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runSearch } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runSearch(npm);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runStar } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm({ cwd: tempFolder }, 'stars', ...addRegistry(registry.getRegistryUrl()));
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runStar(npm);
|
||||
});
|
||||
|
|
9
e2e/cli/e2e-npm7/unpublish.spec.ts
Normal file
9
e2e/cli/e2e-npm7/unpublish.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runUnpublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('unpublish a package', () => {
|
||||
runUnpublish(npm);
|
||||
});
|
|
@ -1,45 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runAudit } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', '@verdaccio/cli']])(
|
||||
'should audit a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ jquery: '3.6.1' }
|
||||
);
|
||||
// install is required to create package lock file
|
||||
await npm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'audit',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.metadata).toBeDefined();
|
||||
expect(parsedBody.auditReportVersion).toBeDefined();
|
||||
expect(parsedBody.vulnerabilities).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runAudit(npm);
|
||||
});
|
||||
|
|
|
@ -1,116 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDeprecate } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await npm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])('should un-deprecate a package %s', async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runDeprecate(npm);
|
||||
});
|
||||
|
|
|
@ -1,92 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDistTag } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('dist-tags a package', () => {
|
||||
runDistTag(npm);
|
||||
});
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runInfo } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm info json body', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('info a package', () => {
|
||||
runInfo(npm);
|
||||
});
|
||||
|
|
|
@ -1,39 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runInstall } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.added).toBeDefined();
|
||||
expect(parsedBody.audit).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runInstall(npm);
|
||||
});
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"version": "1.0.2-next-8.0",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0",
|
||||
"npm": "9.9.3"
|
||||
"@verdaccio/e2e-cli-npm-common": "workspace:*",
|
||||
"npm": "8.19.4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run --testTimeout 50000"
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runPing } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await npm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runPing(npm);
|
||||
});
|
||||
|
|
|
@ -1,42 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runPublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('publish a package', () => {
|
||||
runPublish(npm);
|
||||
});
|
||||
|
|
|
@ -1,34 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runSearch } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runSearch(npm);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runStar } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm({ cwd: tempFolder }, 'stars', ...addRegistry(registry.getRegistryUrl()));
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runStar(npm);
|
||||
});
|
||||
|
|
9
e2e/cli/e2e-npm8/unpublish.spec.ts
Normal file
9
e2e/cli/e2e-npm8/unpublish.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runUnpublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('unpublish a package', () => {
|
||||
runUnpublish(npm);
|
||||
});
|
|
@ -1,45 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runAudit } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', '@verdaccio/cli']])(
|
||||
'should audit a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ jquery: '3.6.1' }
|
||||
);
|
||||
// install is required to create package lock file
|
||||
await npm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'audit',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.metadata).toBeDefined();
|
||||
expect(parsedBody.auditReportVersion).toBeDefined();
|
||||
expect(parsedBody.vulnerabilities).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runAudit(npm);
|
||||
});
|
||||
|
|
|
@ -1,116 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDeprecate } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await npm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])('should un-deprecate a package %s', async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runDeprecate(npm);
|
||||
});
|
||||
|
|
|
@ -1,92 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runDistTag } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp2 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('dist-tags a package', () => {
|
||||
runDistTag(npm);
|
||||
});
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runInfo } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm info json body', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('info a package', () => {
|
||||
runInfo(npm);
|
||||
});
|
||||
|
|
|
@ -1,39 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runInstall } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.added).toBeDefined();
|
||||
expect(parsedBody.audit).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runInstall(npm);
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"version": "1.0.2-next-8.0",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0",
|
||||
"@verdaccio/e2e-cli-npm-common": "workspace:*",
|
||||
"npm": "9.9.3"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runPing } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await npm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runPing(npm);
|
||||
});
|
||||
|
|
|
@ -1,42 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import { runPublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
describe('publish a package', () => {
|
||||
runPublish(npm);
|
||||
});
|
||||
|
|
|
@ -1,34 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
import { runSearch } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await npm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runSearch(npm);
|
||||
});
|
||||
|
|
|
@ -1,86 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
import { runStar } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
await npm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await npm({ cwd: tempFolder }, 'stars', ...addRegistry(registry.getRegistryUrl()));
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
runStar(npm);
|
||||
});
|
||||
|
|
9
e2e/cli/e2e-npm9/unpublish.spec.ts
Normal file
9
e2e/cli/e2e-npm9/unpublish.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runUnpublish } from '@verdaccio/e2e-cli-npm-common';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('unpublish a package', () => {
|
||||
runUnpublish(npm);
|
||||
});
|
3
e2e/cli/e2e-pnpm-commons/.babelrc
Normal file
3
e2e/cli/e2e-pnpm-commons/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../../.babelrc"
|
||||
}
|
7
e2e/cli/e2e-pnpm-commons/.eslintrc
Normal file
7
e2e/cli/e2e-pnpm-commons/.eslintrc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/explicit-member-accessibility": 0
|
||||
}
|
||||
}
|
8
e2e/cli/e2e-pnpm-commons/CHANGELOG.md
Normal file
8
e2e/cli/e2e-pnpm-commons/CHANGELOG.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# @verdaccio/e2e-cli-pnpm9
|
||||
|
||||
## 1.0.2-next-8.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @verdaccio/test-cli-commons@2.0.0-next-8.0
|
46
e2e/cli/e2e-pnpm-commons/audit.ts
Normal file
46
e2e/cli/e2e-pnpm-commons/audit.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runAudit(pnpm) {
|
||||
describe('audit a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', '@verdaccio/cli']])(
|
||||
'should audit a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ jquery: '3.6.1' }
|
||||
);
|
||||
// install is required to create package lock file
|
||||
await pnpm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'audit',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.metadata).toBeDefined();
|
||||
expect(parsedBody.actions).toBeDefined();
|
||||
expect(parsedBody.advisories).toBeDefined();
|
||||
expect(parsedBody.muted).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
119
e2e/cli/e2e-pnpm-commons/deprecate.ts
Normal file
119
e2e/cli/e2e-pnpm-commons/deprecate.ts
Normal file
|
@ -0,0 +1,119 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runDeprecate(pnpm) {
|
||||
describe('deprecate a package', () => {
|
||||
let registry;
|
||||
|
||||
async function deprecate(tempFolder, packageVersion, registry, message) {
|
||||
await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'deprecate',
|
||||
packageVersion,
|
||||
message,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/deprecated-1']])(
|
||||
'should deprecate a single package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-2']])(
|
||||
'should un-deprecate a package %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// deprecate one version
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
|
||||
// verify is deprecated
|
||||
const infoBody = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
// empty string is same as undeprecate
|
||||
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
|
||||
const infoBody2 = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
test.each([['@verdaccio/deprecated-3']])(
|
||||
'should deprecate a multiple packages %s',
|
||||
async (pkgName) => {
|
||||
const message = 'some message';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// // deprecate all version
|
||||
await deprecate(tempFolder, pkgName, registry, message);
|
||||
// verify is deprecated
|
||||
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
|
||||
const infoResp = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
const infoResp = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}@1.4.0`, registry);
|
||||
// must be not deprecated
|
||||
expect(infoResp.deprecated).toBeUndefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
92
e2e/cli/e2e-pnpm-commons/dist-tags.ts
Normal file
92
e2e/cli/e2e-pnpm-commons/dist-tags.ts
Normal file
|
@ -0,0 +1,92 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runDistTag(pnpm) {
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@foo/foo', 'foo']])('should list dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'ls',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('beta: 1.1.0latest: 1.0.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should remove tag with dist-tags for %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
const resp2 = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'rm',
|
||||
`${pkgName}@1.1.0`,
|
||||
'beta',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual('-beta: @verdaccio/bar@1.1.0');
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/five']])(
|
||||
'should add tag to package and version with dist-tags for %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
const resp2 = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'dist-tag',
|
||||
'add',
|
||||
`${pkgName}@1.1.0`,
|
||||
'alfa',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp2.stdout).toEqual(`+alfa: ${pkgName}@1.1.0`);
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
10
e2e/cli/e2e-pnpm-commons/index.ts
Normal file
10
e2e/cli/e2e-pnpm-commons/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
export { runAudit } from './audit';
|
||||
export { runDeprecate } from './deprecate';
|
||||
export { runInstall } from './install';
|
||||
export { runInfo } from './info';
|
||||
export { runPing } from './ping';
|
||||
export { runPublish } from './publish';
|
||||
export { runSearch } from './search';
|
||||
export { runStar } from './star';
|
||||
export { runUnpublish } from './unpublish';
|
||||
export { runDistTag } from './dist-tags';
|
32
e2e/cli/e2e-pnpm-commons/info.ts
Normal file
32
e2e/cli/e2e-pnpm-commons/info.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runInfo(pnpm) {
|
||||
describe('info a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run pnpm info json body', async () => {
|
||||
const resp = await pnpm(
|
||||
{},
|
||||
'info',
|
||||
'verdaccio',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('verdaccio');
|
||||
expect(parsedBody.dependencies).toBeDefined();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
37
e2e/cli/e2e-pnpm-commons/install.ts
Normal file
37
e2e/cli/e2e-pnpm-commons/install.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runInstall(pnpm) {
|
||||
describe('install a project packages', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should run npm install json body', async () => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
'something',
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl(),
|
||||
{ react: '18.2.0' }
|
||||
);
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'install',
|
||||
'--reporter=default',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toMatch(/react/);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
13
e2e/cli/e2e-pnpm-commons/package.json
Normal file
13
e2e/cli/e2e-pnpm-commons/package.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "@verdaccio/e2e-cli-pnpm-common",
|
||||
"version": "1.0.2-next-8.0",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:2.0.0-next-8.0",
|
||||
"pnpm": "9.0.0-alpha.10"
|
||||
},
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"test": "vitest run --testTimeout 50000"
|
||||
}
|
||||
}
|
25
e2e/cli/e2e-pnpm-commons/ping.ts
Normal file
25
e2e/cli/e2e-pnpm-commons/ping.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runPing(pnpm) {
|
||||
describe('ping registry', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should ping registry', async () => {
|
||||
const resp = await pnpm({}, 'ping', '--json', ...addRegistry(registry.getRegistryUrl()));
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.registry).toEqual(registry.getRegistryUrl() + '/');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
42
e2e/cli/e2e-pnpm-commons/publish.ts
Normal file
42
e2e/cli/e2e-pnpm-commons/publish.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runPublish(pnpm) {
|
||||
describe('publish a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['verdaccio-memory', 'verdaccio', '@verdaccio/foo', '@verdaccio/some-foo']])(
|
||||
'should publish a package %s',
|
||||
async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
expect(parsedBody.files).toBeDefined();
|
||||
}
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
34
e2e/cli/e2e-pnpm-commons/search.ts
Normal file
34
e2e/cli/e2e-pnpm-commons/search.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runSearch(pnpm) {
|
||||
describe('search a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test('should search a package', async () => {
|
||||
const resp = await pnpm(
|
||||
{},
|
||||
'search',
|
||||
'@verdaccio/cli',
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
const pkgFind = parsedBody.find((item) => {
|
||||
return item.name === '@verdaccio/cli';
|
||||
});
|
||||
expect(pkgFind.name).toEqual('@verdaccio/cli');
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
90
e2e/cli/e2e-pnpm-commons/star.ts
Normal file
90
e2e/cli/e2e-pnpm-commons/star.ts
Normal file
|
@ -0,0 +1,90 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function runStar(pnpm) {
|
||||
describe('star a package', () => {
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/foo']])('should star a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
});
|
||||
|
||||
test.each([['@verdaccio/bar']])('should unstar a package %s', async (pkgName) => {
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'star',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp.stdout).toEqual(`★ ${pkgName}`);
|
||||
|
||||
const resp1 = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'unstar',
|
||||
pkgName,
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
expect(resp1.stdout).toEqual(`☆ ${pkgName}`);
|
||||
});
|
||||
|
||||
test('should list stars of a user %s', async () => {
|
||||
const pkgName = '@verdaccio/stars';
|
||||
const { tempFolder } = await prepareGenericEmptyProject(
|
||||
pkgName,
|
||||
'1.0.0-patch',
|
||||
registry.port,
|
||||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
await pnpm({ cwd: tempFolder }, 'star', pkgName, ...addRegistry(registry.getRegistryUrl()));
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'stars',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
// side effects: this result is affected the the package published in the previous step
|
||||
expect(resp.stdout).toEqual(`@verdaccio/foo@verdaccio/stars`);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
||||
}
|
8
e2e/cli/e2e-pnpm-commons/tsconfig.json
Normal file
8
e2e/cli/e2e-pnpm-commons/tsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.reference.json",
|
||||
"references": [
|
||||
{
|
||||
"path": "../cli-commons"
|
||||
}
|
||||
]
|
||||
}
|
86
e2e/cli/e2e-pnpm-commons/unpublish.ts
Normal file
86
e2e/cli/e2e-pnpm-commons/unpublish.ts
Normal file
|
@ -0,0 +1,86 @@
|
|||
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();
|
||||
});
|
||||
});
|
||||
}
|
3
e2e/cli/e2e-pnpm10/.babelrc
Normal file
3
e2e/cli/e2e-pnpm10/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../../.babelrc"
|
||||
}
|
7
e2e/cli/e2e-pnpm10/.eslintrc
Normal file
7
e2e/cli/e2e-pnpm10/.eslintrc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/explicit-member-accessibility": 0
|
||||
}
|
||||
}
|
8
e2e/cli/e2e-pnpm10/CHANGELOG.md
Normal file
8
e2e/cli/e2e-pnpm10/CHANGELOG.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# @verdaccio/e2e-cli-pnpm9
|
||||
|
||||
## 1.0.2-next-8.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @verdaccio/test-cli-commons@2.0.0-next-8.0
|
9
e2e/cli/e2e-pnpm10/audit.spec.ts
Normal file
9
e2e/cli/e2e-pnpm10/audit.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runAudit } from '@verdaccio/e2e-cli-pnpm-common';
|
||||
|
||||
import { pnpm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
runAudit(pnpm);
|
||||
});
|
9
e2e/cli/e2e-pnpm10/deprecate.spec.ts
Normal file
9
e2e/cli/e2e-pnpm10/deprecate.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runDeprecate } from '@verdaccio/e2e-cli-pnpm-common';
|
||||
|
||||
import { pnpm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
runDeprecate(pnpm);
|
||||
});
|
9
e2e/cli/e2e-pnpm10/dist-tags.spec.ts
Normal file
9
e2e/cli/e2e-pnpm10/dist-tags.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runDistTag } from '@verdaccio/e2e-cli-pnpm-common';
|
||||
|
||||
import { pnpm } from './utils';
|
||||
|
||||
describe('dist-tags a package', () => {
|
||||
runDistTag(pnpm);
|
||||
});
|
9
e2e/cli/e2e-pnpm10/info.spec.ts
Normal file
9
e2e/cli/e2e-pnpm10/info.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { describe } from 'vitest';
|
||||
|
||||
import { runInfo } from '@verdaccio/e2e-cli-pnpm-common';
|
||||
|
||||
import { pnpm } from './utils';
|
||||
|
||||
describe('info a package', () => {
|
||||
runInfo(pnpm);
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue