2022-08-04 13:04:12 -05:00
# E2E CLI Testing
## What is included on these test?
- Default configuration only
2022-09-24 01:53:03 -05:00
- Test with all popular package managers:
- `yarn classic` and `yarn modern (2, 3, 4 RC)`
- `pnpm 6, 7`
- `npm 6, 7, 8 and 9`
2022-08-04 13:04:12 -05:00
2022-09-16 17:33:55 -05:00
### Commands Tested
2022-09-24 01:53:03 -05:00
| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- |
2022-09-27 15:56:17 -05:00
| publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
2022-09-24 01:53:03 -05:00
| info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| audit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| install | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| deprecate | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ⛔ | ⛔ | ⛔ |
| ping | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ⛔ | ⛔ | ⛔ |
| search | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⛔ | ⛔ | ⛔ | ⛔ |
| dist-tag | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
2022-09-19 16:10:38 -05:00
> notes:
>
2022-09-24 01:53:03 -05:00
> - yarn search cmd exist in _modern_ but, it do not uses the search registry endpoint.
2022-09-27 15:56:17 -05:00
> - yarn _modern_ has two info commands, the one used here is `yarn npm info`
2022-09-18 14:47:23 -05:00
❌ = no tested
✅ = tested
⛔ = no supported
2022-09-16 17:33:55 -05:00
2022-08-04 13:04:12 -05:00
## How it works?
2022-09-17 04:35:10 -05:00
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.
2022-08-04 13:04:12 -05:00
### What should not included on these tests?
- Anything is unrelated with client commands usage, eg: (auth permissions, third party integrations,
hooks, plugins)