mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
chore: add e2e npm 10 e2e (#4036)
This commit is contained in:
parent
fa23d81fbc
commit
2b5a15c22b
19 changed files with 725 additions and 6 deletions
2
.github/workflows/e2e-ci.yml
vendored
2
.github/workflows/e2e-ci.yml
vendored
|
@ -78,7 +78,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pkg: [npm6, npm7, npm8, npm9, pnpm6, pnpm7, pnpm8, yarn1, yarn2, yarn3, yarn4]
|
||||
pkg: [npm6, npm7, npm8, npm9, npm10, pnpm6, pnpm7, pnpm8, yarn1, yarn2, yarn3, yarn4]
|
||||
node: [16, 18, 19]
|
||||
name: ${{ matrix.pkg }}/ ubuntu-latest / ${{ matrix.node }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -3,14 +3,11 @@
|
|||
## What is included on these test?
|
||||
|
||||
- Default configuration only
|
||||
- Test with all popular package managers:
|
||||
- `yarn classic` and `yarn modern (2, 3, 4 RC)`
|
||||
- `pnpm 6, 7`
|
||||
- `npm 6, 7, 8 and 9`
|
||||
- Test with all popular package managers
|
||||
|
||||
### Commands Tested
|
||||
|
||||
| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | pnpm8 | yarn1 | yarn2 | yarn3 | yarn4 |
|
||||
| cmd | npm6 | npm7 | npm8 | npm9 | npm10 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 |
|
||||
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
|
||||
| publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
|
|
3
e2e/cli/e2e-npm10/.babelrc
Normal file
3
e2e/cli/e2e-npm10/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../../.babelrc"
|
||||
}
|
7
e2e/cli/e2e-npm10/.eslintrc
Normal file
7
e2e/cli/e2e-npm10/.eslintrc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/explicit-member-accessibility": 0
|
||||
}
|
||||
}
|
62
e2e/cli/e2e-npm10/CHANGELOG.md
Normal file
62
e2e/cli/e2e-npm10/CHANGELOG.md
Normal file
|
@ -0,0 +1,62 @@
|
|||
# @verdaccio/e2e-cli-npm9
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [351aeeaa8]
|
||||
- Updated dependencies [d167f92e1]
|
||||
- Updated dependencies [c383eb68c]
|
||||
- @verdaccio/test-cli-commons@1.1.0
|
||||
|
||||
## 1.0.1-6-next.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c383eb68]
|
||||
- @verdaccio/test-cli-commons@1.1.0-6-next.7
|
||||
|
||||
## 1.0.1-6-next.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d167f92e]
|
||||
- @verdaccio/test-cli-commons@1.1.0-6-next.6
|
||||
|
||||
## 1.0.1-6-next.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/test-cli-commons@1.0.1-6-next.5
|
||||
|
||||
## 1.0.1-6-next.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/test-cli-commons@1.0.1-6-next.4
|
||||
|
||||
## 1.0.1-6-next.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 351aeeaa: fix(deps): @verdaccio/utils should be a prod dep of local-storage
|
||||
- Updated dependencies [351aeeaa]
|
||||
- @verdaccio/test-cli-commons@1.0.1-6-next.3
|
||||
|
||||
## 1.0.1-6-next.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/test-cli-commons@1.0.1-6-next.2
|
||||
|
||||
## 1.0.1-6-next.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/test-cli-commons@1.0.1-6-next.1
|
||||
|
||||
## 1.0.1-6-next.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/test-cli-commons@1.0.1-6-next.0
|
44
e2e/cli/e2e-npm10/audit.spec.ts
Normal file
44
e2e/cli/e2e-npm10/audit.spec.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('audit a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
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();
|
||||
});
|
||||
});
|
115
e2e/cli/e2e-npm10/deprecate.spec.ts
Normal file
115
e2e/cli/e2e-npm10/deprecate.spec.ts
Normal file
|
@ -0,0 +1,115 @@
|
|||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('deprecate a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
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();
|
||||
});
|
||||
});
|
91
e2e/cli/e2e-npm10/dist-tags.spec.ts
Normal file
91
e2e/cli/e2e-npm10/dist-tags.spec.ts
Normal file
|
@ -0,0 +1,91 @@
|
|||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('publish a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
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();
|
||||
});
|
||||
});
|
31
e2e/cli/e2e-npm10/info.spec.ts
Normal file
31
e2e/cli/e2e-npm10/info.spec.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
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();
|
||||
});
|
||||
});
|
38
e2e/cli/e2e-npm10/install.spec.ts
Normal file
38
e2e/cli/e2e-npm10/install.spec.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a project packages', () => {
|
||||
jest.setTimeout(100000);
|
||||
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();
|
||||
});
|
||||
});
|
3
e2e/cli/e2e-npm10/jest.config.js
Normal file
3
e2e/cli/e2e-npm10/jest.config.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
const config = require('../jest.config');
|
||||
|
||||
module.exports = { ...config };
|
12
e2e/cli/e2e-npm10/package.json
Normal file
12
e2e/cli/e2e-npm10/package.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "@verdaccio/e2e-cli-npm9",
|
||||
"version": "1.0.1",
|
||||
"dependencies": {
|
||||
"@verdaccio/test-cli-commons": "workspace:1.1.0",
|
||||
"npm": "10.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
24
e2e/cli/e2e-npm10/ping.spec.ts
Normal file
24
e2e/cli/e2e-npm10/ping.spec.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('ping registry', () => {
|
||||
jest.setTimeout(10000);
|
||||
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();
|
||||
});
|
||||
});
|
41
e2e/cli/e2e-npm10/publish.spec.ts
Normal file
41
e2e/cli/e2e-npm10/publish.spec.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
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();
|
||||
});
|
||||
});
|
33
e2e/cli/e2e-npm10/search.spec.ts
Normal file
33
e2e/cli/e2e-npm10/search.spec.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { addRegistry, initialSetup } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('search a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
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();
|
||||
});
|
||||
});
|
85
e2e/cli/e2e-npm10/star.spec.ts
Normal file
85
e2e/cli/e2e-npm10/star.spec.ts
Normal file
|
@ -0,0 +1,85 @@
|
|||
import {
|
||||
addRegistry,
|
||||
initialSetup,
|
||||
npmUtils,
|
||||
prepareGenericEmptyProject,
|
||||
} from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { npm } from './utils';
|
||||
|
||||
describe('star a package', () => {
|
||||
jest.setTimeout(20000);
|
||||
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-npm10/tsconfig.json
Normal file
8
e2e/cli/e2e-npm10/tsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.reference.json",
|
||||
"references": [
|
||||
{
|
||||
"path": "../cli-commons"
|
||||
}
|
||||
]
|
||||
}
|
41
e2e/cli/e2e-npm10/utils.ts
Normal file
41
e2e/cli/e2e-npm10/utils.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
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');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
|
@ -379,6 +379,15 @@ importers:
|
|||
specifier: workspace:7.0.0-next.2
|
||||
version: link:../../../packages/verdaccio
|
||||
|
||||
e2e/cli/e2e-npm10:
|
||||
dependencies:
|
||||
'@verdaccio/test-cli-commons':
|
||||
specifier: workspace:1.1.0
|
||||
version: link:../cli-commons
|
||||
npm:
|
||||
specifier: 10.1.0
|
||||
version: 10.1.0
|
||||
|
||||
e2e/cli/e2e-npm6:
|
||||
dependencies:
|
||||
'@verdaccio/test-cli-commons':
|
||||
|
@ -22340,6 +22349,81 @@ packages:
|
|||
engines: {node: '>=6.0.0'}
|
||||
dev: false
|
||||
|
||||
/npm@10.1.0:
|
||||
resolution: {integrity: sha512-pZ2xybXzNGbJFZEKNbPoEXsE38Xou9VTnxxBk+B3pz0ndsGCs7iWHoUCPSsISU2hjmkWfDkJo3bYKE8RDOg4eg==}
|
||||
engines: {node: ^18.17.0 || >=20.5.0}
|
||||
hasBin: true
|
||||
dev: false
|
||||
bundledDependencies:
|
||||
- '@isaacs/string-locale-compare'
|
||||
- '@npmcli/arborist'
|
||||
- '@npmcli/config'
|
||||
- '@npmcli/fs'
|
||||
- '@npmcli/map-workspaces'
|
||||
- '@npmcli/package-json'
|
||||
- '@npmcli/promise-spawn'
|
||||
- '@npmcli/run-script'
|
||||
- '@sigstore/tuf'
|
||||
- abbrev
|
||||
- archy
|
||||
- cacache
|
||||
- chalk
|
||||
- ci-info
|
||||
- cli-columns
|
||||
- cli-table3
|
||||
- columnify
|
||||
- fastest-levenshtein
|
||||
- fs-minipass
|
||||
- glob
|
||||
- graceful-fs
|
||||
- hosted-git-info
|
||||
- ini
|
||||
- init-package-json
|
||||
- is-cidr
|
||||
- json-parse-even-better-errors
|
||||
- libnpmaccess
|
||||
- libnpmdiff
|
||||
- libnpmexec
|
||||
- libnpmfund
|
||||
- libnpmhook
|
||||
- libnpmorg
|
||||
- libnpmpack
|
||||
- libnpmpublish
|
||||
- libnpmsearch
|
||||
- libnpmteam
|
||||
- libnpmversion
|
||||
- make-fetch-happen
|
||||
- minimatch
|
||||
- minipass
|
||||
- minipass-pipeline
|
||||
- ms
|
||||
- node-gyp
|
||||
- nopt
|
||||
- npm-audit-report
|
||||
- npm-install-checks
|
||||
- npm-package-arg
|
||||
- npm-pick-manifest
|
||||
- npm-profile
|
||||
- npm-registry-fetch
|
||||
- npm-user-validate
|
||||
- npmlog
|
||||
- p-map
|
||||
- pacote
|
||||
- parse-conflict-json
|
||||
- proc-log
|
||||
- qrcode-terminal
|
||||
- read
|
||||
- semver
|
||||
- ssri
|
||||
- supports-color
|
||||
- tar
|
||||
- text-table
|
||||
- tiny-relative-date
|
||||
- treeverse
|
||||
- validate-npm-package-name
|
||||
- which
|
||||
- write-file-atomic
|
||||
|
||||
/npm@9.7.1:
|
||||
resolution: {integrity: sha512-kxMviaiLX4Lfnjy2dt7EWB87v5QdLiGpy04S2ORdKLmPqFhgy8g4cgJjQfnWob4mJIaNHjBO+hk45CvLlsZZ8g==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||
|
|
Loading…
Reference in a new issue