0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00
verdaccio/test/cli/README.md
Juan Picado a249ab7b5a
chore: re-stablished deprecated support (#3385)
* chore: re-stablished deprecated support

* chore: add e2e

* chore: add more tests

* chore: improve setup

* chore: improve buildcache

* Update e2e-ci.yml

* Update e2e-ci.yml

* Update e2e-ci.yml

* Update e2e-ci.yml

* chore: add more steps

* chore: improve speed

* chore: fix ci

* chore: improve cache

* Update ci.yml

* Update registry.ts

* Update ci.yml

* Update ci.yml
2022-09-18 21:47:23 +02:00

67 lines
2.2 KiB
Markdown

# E2E CLI Testing
## What is included on these test?
- Default configuration only
- Test with all popular package managers (`yarn classic` and `yarn modern (2,3, 4)`, `pnpm 6,7` and `npm 6, 7 and 8`)
### Commands Tested
| cmd | npm6 | npm7 | npm8 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- |
| publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| audit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| install | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| deprecate | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ⛔ | ⛔ | ⛔ |
❌ = no tested
✅ = tested
⛔ = no supported
## How it works?
Every package manager + version is a package in the monorepo.
The package `@verdaccio/test-cli-commons` contains helpers used for each package manager.
```ts
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';
```
The registry can be executed with the following commands, the port is automatically assigned.
```ts
// setup
const setup = await initialSetup();
registry = setup.registry;
await registry.init();
// teardown
registry.stop();
```
The full url can be get from `registry.getRegistryUrl()`. The yarn modern does not allows the `--registry` so need a more complex step, while others is just enough adding the following to every command.
```ts
await yarn({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
```
The most of the command allow return output in JSON format which helps with the expects.
```ts
const resp = await yarn(
{ cwd: tempFolder },
'audit',
'--json',
...addRegistry(registry.getRegistryUrl())
);
const parsedBody = JSON.parse(resp.stdout as string);
expect(parsedBody.type).toEqual('auditSummary');
```
Every command should test either console output or in special cases look up the storage manually.
### What should not included on these tests?
- Anything is unrelated with client commands usage, eg: (auth permissions, third party integrations,
hooks, plugins)