mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-18 02:22:46 -05:00
chore: refactor e2e utilities (#3392)
* chore: refactor e2e utilities * chore: specific versions for pkg manager * Update e2e-ci.yml
This commit is contained in:
parent
69d0c621e7
commit
bd3ae17971
33 changed files with 413 additions and 379 deletions
11
.github/workflows/e2e-ci.yml
vendored
11
.github/workflows/e2e-ci.yml
vendored
|
@ -1,15 +1,6 @@
|
|||
name: E2E CLI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- .changeset/**
|
||||
- .github/workflows/e2e-ci.yml
|
||||
- 'packages/**'
|
||||
- 'test/**'
|
||||
- 'jest/**'
|
||||
- 'package.json'
|
||||
- 'pnpm-workspace.yaml'
|
||||
on: [pull_request]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
|
|
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -8,5 +8,6 @@
|
|||
"storage_default_storage": true,
|
||||
".yarn": true
|
||||
},
|
||||
"editor.formatOnSave": true,
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
|
|
@ -12,3 +12,5 @@ export {
|
|||
} from './utils';
|
||||
export { exec, ExecOutput } from './process';
|
||||
export { callRegistry } from './web';
|
||||
export * as npmUtils from './npm-utils';
|
||||
export * as pnpmUtils from './npm-utils';
|
||||
|
|
29
e2e/cli/cli-commons/src/npm-utils.ts
Normal file
29
e2e/cli/cli-commons/src/npm-utils.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { addRegistry } from './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(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
export async function getInfoVersions(cmd, pkgName, registry) {
|
||||
const infoResp = await cmd(
|
||||
{},
|
||||
'info',
|
||||
pkgName,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
return infoBody;
|
||||
}
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdacci
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, getInfoVersions, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -34,11 +39,11 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
|
@ -53,15 +58,15 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -77,28 +82,28 @@ describe('deprecate a package', () => {
|
|||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}@${v}`, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
const infoResp = await getInfoVersions(`${pkgName}@1.4.0`, registry);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -20,9 +25,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -41,9 +46,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -65,9 +70,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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',
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "1.0.1-6-next.5",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:1.0.1-6-next.5",
|
||||
"npm": "latest-6"
|
||||
"npm": "6.14.17"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdacci
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -2,7 +2,6 @@ import { SpawnOptions } from 'child_process';
|
|||
import { join } from 'path';
|
||||
|
||||
import { exec } from '@verdaccio/test-cli-commons';
|
||||
import { addRegistry } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function getCommand() {
|
||||
return join(__dirname, './node_modules/.bin/npm');
|
||||
|
@ -11,31 +10,3 @@ export function getCommand() {
|
|||
export function npm(options: SpawnOptions, ...args: string[]) {
|
||||
return exec(options, getCommand(), args);
|
||||
}
|
||||
|
||||
export async function bumbUp(tempFolder, registry) {
|
||||
await npm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
export async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
export async function getInfoVersions(pkgName, registry) {
|
||||
const infoResp = await npm(
|
||||
{},
|
||||
'info',
|
||||
pkgName,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
return infoBody;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, getInfoVersions, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -34,11 +39,11 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
|
@ -53,15 +58,15 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -77,28 +82,28 @@ describe('deprecate a package', () => {
|
|||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}@${v}`, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
const infoResp = await getInfoVersions(`${pkgName}@1.4.0`, registry);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -20,9 +25,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -41,9 +46,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -65,9 +70,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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',
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "1.0.1-6-next.5",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:1.0.1-6-next.5",
|
||||
"npm": "latest-7"
|
||||
"npm": "7.24.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdacci
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -2,7 +2,6 @@ import { SpawnOptions } from 'child_process';
|
|||
import { join } from 'path';
|
||||
|
||||
import { exec } from '@verdaccio/test-cli-commons';
|
||||
import { addRegistry } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function getCommand() {
|
||||
return join(__dirname, './node_modules/.bin/npm');
|
||||
|
@ -11,31 +10,3 @@ export function getCommand() {
|
|||
export function npm(options: SpawnOptions, ...args: string[]) {
|
||||
return exec(options, getCommand(), args);
|
||||
}
|
||||
|
||||
export async function bumbUp(tempFolder, registry) {
|
||||
await npm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
export async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
export async function getInfoVersions(pkgName, registry) {
|
||||
const infoResp = await npm(
|
||||
{},
|
||||
'info',
|
||||
pkgName,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
return infoBody;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdacci
|
|||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, getInfoVersions, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -34,11 +39,11 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
|
@ -53,15 +58,15 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -77,28 +82,28 @@ describe('deprecate a package', () => {
|
|||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}@${v}`, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
const infoResp = await getInfoVersions(`${pkgName}@1.4.0`, registry);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -20,9 +25,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -41,9 +46,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -65,9 +70,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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',
|
||||
|
|
|
@ -2,7 +2,6 @@ import { SpawnOptions } from 'child_process';
|
|||
import { join } from 'path';
|
||||
|
||||
import { exec } from '@verdaccio/test-cli-commons';
|
||||
import { addRegistry } from '@verdaccio/test-cli-commons';
|
||||
|
||||
export function getCommand() {
|
||||
return join(__dirname, './node_modules/.bin/npm');
|
||||
|
@ -11,31 +10,3 @@ export function getCommand() {
|
|||
export function npm(options: SpawnOptions, ...args: string[]) {
|
||||
return exec(options, getCommand(), args);
|
||||
}
|
||||
|
||||
export async function bumbUp(tempFolder, registry) {
|
||||
await npm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
export async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await npm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
export async function getInfoVersions(pkgName, registry) {
|
||||
const infoResp = await npm(
|
||||
{},
|
||||
'info',
|
||||
pkgName,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
return infoBody;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, getInfoVersions, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -34,11 +39,11 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
|
@ -53,15 +58,15 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody2 = await npmUtils.getInfoVersions(npm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -77,28 +82,28 @@ describe('deprecate a package', () => {
|
|||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await npmUtils.bumbUp(npm, tempFolder, registry);
|
||||
await npmUtils.publish(npm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}@${v}`, registry);
|
||||
const infoResp = await npmUtils.getInfoVersions(npm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
const infoResp = await getInfoVersions(`${pkgName}@1.4.0`, registry);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, npm, publish } from './utils';
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -20,9 +25,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -41,9 +46,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -65,9 +70,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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',
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, getInfoVersions, pnpm, publish } from './utils';
|
||||
import { pnpm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -34,11 +39,11 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
|
@ -53,15 +58,15 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody2 = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -77,28 +82,28 @@ describe('deprecate a package', () => {
|
|||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}@${v}`, registry);
|
||||
const infoResp = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
const infoResp = await getInfoVersions(`${pkgName}@1.4.0`, registry);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { pnpm } from './utils';
|
||||
|
||||
async function bumbUp(tempFolder, registry) {
|
||||
await pnpm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
@ -36,9 +25,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -57,9 +46,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -81,9 +70,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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',
|
||||
|
|
|
@ -2,7 +2,6 @@ import { SpawnOptions } from 'child_process';
|
|||
import { join } from 'path';
|
||||
|
||||
import { exec } from '@verdaccio/test-cli-commons';
|
||||
import { addRegistry } from '@verdaccio/test-cli-commons';
|
||||
|
||||
function getCommand() {
|
||||
return join(__dirname, './node_modules/.bin/pnpm');
|
||||
|
@ -12,32 +11,4 @@ function pnpm(options: SpawnOptions, ...args: string[]) {
|
|||
return exec(options, getCommand(), args);
|
||||
}
|
||||
|
||||
async function bumbUp(tempFolder, registry) {
|
||||
await pnpm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
async function getInfoVersions(pkgName, registry) {
|
||||
const infoResp = await pnpm(
|
||||
{},
|
||||
'info',
|
||||
pkgName,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
return infoBody;
|
||||
}
|
||||
|
||||
export { getInfoVersions, pnpm, publish, bumbUp };
|
||||
export { pnpm };
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { bumbUp, getInfoVersions, pnpm, publish } from './utils';
|
||||
import { pnpm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
@ -34,11 +39,11 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody.name).toEqual(pkgName);
|
||||
expect(infoBody.deprecated).toEqual(message);
|
||||
}
|
||||
|
@ -53,15 +58,15 @@ describe('deprecate a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
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 getInfoVersions(`${pkgName}`, registry);
|
||||
const infoBody2 = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
|
||||
expect(infoBody2.deprecated).toBeUndefined();
|
||||
});
|
||||
|
||||
|
@ -77,28 +82,28 @@ describe('deprecate a package', () => {
|
|||
registry.getRegistryUrl()
|
||||
);
|
||||
// publish 1.0.0
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.1.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.2.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
|
||||
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
|
||||
// publish 1.3.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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 getInfoVersions(`${pkgName}@${v}`, registry);
|
||||
const infoResp = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}@${v}`, registry);
|
||||
expect(infoResp.deprecated).toEqual(message);
|
||||
}
|
||||
// publish normal version
|
||||
// publish 1.4.0
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
const infoResp = await getInfoVersions(`${pkgName}@1.4.0`, registry);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
pnpmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { pnpm } from './utils';
|
||||
|
||||
async function bumbUp(tempFolder, registry) {
|
||||
await pnpm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
|
@ -36,9 +25,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -57,9 +46,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry, ['--tag', 'beta']);
|
||||
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',
|
||||
|
@ -81,9 +70,9 @@ describe('publish a package', () => {
|
|||
registry.getToken(),
|
||||
registry.getRegistryUrl()
|
||||
);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
await bumbUp(tempFolder, registry);
|
||||
await publish(tempFolder, pkgName, registry);
|
||||
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',
|
||||
|
|
|
@ -2,42 +2,11 @@ import { SpawnOptions } from 'child_process';
|
|||
import { join } from 'path';
|
||||
|
||||
import { exec } from '@verdaccio/test-cli-commons';
|
||||
import { addRegistry } from '@verdaccio/test-cli-commons';
|
||||
|
||||
function getCommand() {
|
||||
return join(__dirname, './node_modules/.bin/pnpm');
|
||||
}
|
||||
|
||||
function pnpm(options: SpawnOptions, ...args: string[]) {
|
||||
export function pnpm(options: SpawnOptions, ...args: string[]) {
|
||||
return exec(options, getCommand(), args);
|
||||
}
|
||||
|
||||
async function bumbUp(tempFolder, registry) {
|
||||
await pnpm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
||||
}
|
||||
|
||||
async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
||||
const resp = await pnpm(
|
||||
{ cwd: tempFolder },
|
||||
'publish',
|
||||
...arg,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual(pkgName);
|
||||
}
|
||||
|
||||
async function getInfoVersions(pkgName, registry) {
|
||||
const infoResp = await pnpm(
|
||||
{},
|
||||
'info',
|
||||
pkgName,
|
||||
'--json',
|
||||
...addRegistry(registry.getRegistryUrl())
|
||||
);
|
||||
const infoBody = JSON.parse(infoResp.stdout as string);
|
||||
return infoBody;
|
||||
}
|
||||
|
||||
export { getInfoVersions, pnpm, publish, bumbUp };
|
||||
|
|
|
@ -5,7 +5,7 @@ import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-comm
|
|||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
let projectFolder;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-comm
|
|||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
let projectFolder;
|
||||
|
||||
|
|
140
pnpm-lock.yaml
generated
140
pnpm-lock.yaml
generated
|
@ -206,10 +206,18 @@ importers:
|
|||
lodash: 4.17.21
|
||||
verdaccio: link:../../../packages/verdaccio
|
||||
|
||||
e2e/cli/e2e-npm5:
|
||||
specifiers:
|
||||
'@verdaccio/test-cli-commons': workspace:1.0.1-6-next.5
|
||||
npm: 5.10.0
|
||||
dependencies:
|
||||
'@verdaccio/test-cli-commons': link:../cli-commons
|
||||
npm: 5.10.0
|
||||
|
||||
e2e/cli/e2e-npm6:
|
||||
specifiers:
|
||||
'@verdaccio/test-cli-commons': workspace:1.0.1-6-next.5
|
||||
npm: latest-6
|
||||
npm: 6.14.17
|
||||
dependencies:
|
||||
'@verdaccio/test-cli-commons': link:../cli-commons
|
||||
npm: 6.14.17
|
||||
|
@ -217,7 +225,7 @@ importers:
|
|||
e2e/cli/e2e-npm7:
|
||||
specifiers:
|
||||
'@verdaccio/test-cli-commons': workspace:1.0.1-6-next.5
|
||||
npm: latest-7
|
||||
npm: 7.24.2
|
||||
dependencies:
|
||||
'@verdaccio/test-cli-commons': link:../cli-commons
|
||||
npm: 7.24.2
|
||||
|
@ -252,7 +260,7 @@ importers:
|
|||
pnpm: next-7
|
||||
dependencies:
|
||||
'@verdaccio/test-cli-commons': link:../cli-commons
|
||||
pnpm: 7.12.1
|
||||
pnpm: 7.12.2
|
||||
|
||||
e2e/cli/e2e-yarn1:
|
||||
specifiers:
|
||||
|
@ -18306,6 +18314,128 @@ packages:
|
|||
engines: {node: '>=6.0.0'}
|
||||
dev: false
|
||||
|
||||
/npm/5.10.0:
|
||||
resolution: {integrity: sha512-lvjvjgR5wG2RJ2uqak1xtZcVAWMwVOzN5HkUlUj/n8rU1f3A0fNn+7HwOzH9Lyf0Ppyu9ApgsEpHczOSnx1cwA==}
|
||||
hasBin: true
|
||||
dev: false
|
||||
bundledDependencies:
|
||||
- abbrev
|
||||
- ansi-regex
|
||||
- ansicolors
|
||||
- ansistyles
|
||||
- aproba
|
||||
- archy
|
||||
- byte-size
|
||||
- cacache
|
||||
- call-limit
|
||||
- bluebird
|
||||
- bin-links
|
||||
- chownr
|
||||
- cli-table2
|
||||
- cmd-shim
|
||||
- columnify
|
||||
- config-chain
|
||||
- debuglog
|
||||
- detect-indent
|
||||
- detect-newline
|
||||
- dezalgo
|
||||
- editor
|
||||
- find-npm-prefix
|
||||
- fs-vacuum
|
||||
- fs-write-stream-atomic
|
||||
- gentle-fs
|
||||
- glob
|
||||
- graceful-fs
|
||||
- has-unicode
|
||||
- hosted-git-info
|
||||
- iferr
|
||||
- imurmurhash
|
||||
- inflight
|
||||
- inherits
|
||||
- ini
|
||||
- init-package-json
|
||||
- is-cidr
|
||||
- json-parse-better-errors
|
||||
- JSONStream
|
||||
- lazy-property
|
||||
- libcipm
|
||||
- libnpx
|
||||
- lockfile
|
||||
- lodash._baseindexof
|
||||
- lodash._baseuniq
|
||||
- lodash._bindcallback
|
||||
- lodash._cacheindexof
|
||||
- lodash._createcache
|
||||
- lodash._getnative
|
||||
- lodash.clonedeep
|
||||
- lodash.restparam
|
||||
- lodash.union
|
||||
- lodash.uniq
|
||||
- lodash.without
|
||||
- lru-cache
|
||||
- meant
|
||||
- mkdirp
|
||||
- mississippi
|
||||
- move-concurrently
|
||||
- nopt
|
||||
- normalize-package-data
|
||||
- npm-cache-filename
|
||||
- npm-lifecycle
|
||||
- npm-install-checks
|
||||
- npm-package-arg
|
||||
- npm-packlist
|
||||
- npm-profile
|
||||
- npm-registry-client
|
||||
- npm-user-validate
|
||||
- npmlog
|
||||
- once
|
||||
- opener
|
||||
- osenv
|
||||
- pacote
|
||||
- path-is-inside
|
||||
- promise-inflight
|
||||
- query-string
|
||||
- qrcode-terminal
|
||||
- qw
|
||||
- read
|
||||
- read-cmd-shim
|
||||
- read-installed
|
||||
- read-package-json
|
||||
- read-package-tree
|
||||
- readable-stream
|
||||
- readdir-scoped-modules
|
||||
- request
|
||||
- retry
|
||||
- rimraf
|
||||
- semver
|
||||
- sha
|
||||
- slide
|
||||
- sorted-object
|
||||
- sorted-union-stream
|
||||
- ssri
|
||||
- strip-ansi
|
||||
- tar
|
||||
- text-table
|
||||
- uid-number
|
||||
- umask
|
||||
- unique-filename
|
||||
- unpipe
|
||||
- update-notifier
|
||||
- uuid
|
||||
- validate-npm-package-license
|
||||
- validate-npm-package-name
|
||||
- which
|
||||
- wrappy
|
||||
- write-file-atomic
|
||||
- safe-buffer
|
||||
- worker-farm
|
||||
- tiny-relative-date
|
||||
- cli-columns
|
||||
- node-gyp
|
||||
- npm-audit-report
|
||||
- npm-registry-fetch
|
||||
- lock-verify
|
||||
|
||||
/npm/6.14.17:
|
||||
resolution: {integrity: sha512-CxEDn1ydVRPDl4tHrlnq+WevYAhv4GF2AEHzJKQ4prZDZ96IS3Uo6t0Sy6O9kB6XzqkI+J00WfYCqqk0p6IJ1Q==}
|
||||
engines: {node: 6 >=6.2.0 || 8 || >=9.3.0}
|
||||
|
@ -19279,8 +19409,8 @@ packages:
|
|||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/pnpm/7.12.1:
|
||||
resolution: {integrity: sha512-kk60T3TKXutcEnpUNAlJBpG+PzVdYZ3e/g4eivgvmWsY4H3R/8c/nVWTS5Ji/NCPfzO2oUudkN5AyCd0eTKODQ==}
|
||||
/pnpm/7.12.2:
|
||||
resolution: {integrity: sha512-8QvnKANKN+YZXDmVYGI7zRJysdKldZI+w3AYnxu9IwtnLv1x6WuzrJr0nxMcTeuUAT908RjDqK+/6KJB9wNqxA==}
|
||||
engines: {node: '>=14.6'}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
|
Loading…
Add table
Reference in a new issue