0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

e2e: yarn publish (#3393)

* Update audit.spec.ts

* Update README.md

* chore: e2e yarn refactor

* chore: add yarn publish tests

* Update e2e-ci.yml

* Update e2e-ci.yml

* Update e2e-ci.yml

* Update e2e-ci.yml
This commit is contained in:
Juan Picado 2022-09-27 22:56:17 +02:00 committed by GitHub
parent 810bf8c40c
commit 2c0d5ceab8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 403 additions and 209 deletions

View file

@ -32,7 +32,7 @@ jobs:
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
restore-keys: | restore-keys: |
pnpm- pnpm-
build: build:
@ -49,7 +49,7 @@ jobs:
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 - uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: Install - name: Install
run: pnpm recursive install --frozen-lockfile --reporter=silence --registry http://localhost:4873 run: pnpm recursive install --frozen-lockfile --reporter=silence --registry http://localhost:4873
- name: build - name: build
@ -59,18 +59,17 @@ jobs:
id: cache-packages id: cache-packages
with: with:
path: ./packages/ path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
restore-keys: | restore-keys: |
packages- packages-
- name: Cache test # - name: Cache test
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 # uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
id: cache-test # id: cache-test
with: # with:
path: ./e2e/ # path: ./e2e/
key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} # key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
restore-keys: | # restore-keys: |
test- # test-
e2e-cli: e2e-cli:
needs: [prepare, build] needs: [prepare, build]
strategy: strategy:
@ -89,16 +88,18 @@ jobs:
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 - uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: Install - name: Install
run: pnpm recursive install --offline --frozen-lockfile --reporter=silence --ignore-scripts --registry http://localhost:4873 run: pnpm recursive install --offline --frozen-lockfile --reporter=silence --ignore-scripts --registry http://localhost:4873
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 - uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with: with:
path: ./packages/ path: ./packages/
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3 # - uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
with: # with:
path: ./e2e/ # path: ./e2e/
key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }} # key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: build e2e
run: pnpm run build --filter=./e2e
- name: Test CLI - name: Test CLI
run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}} run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}}

View file

@ -12,7 +12,7 @@
| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 | | cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- | | --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- |
| publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| audit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | audit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| install | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | install | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
@ -24,6 +24,7 @@
> notes: > notes:
> >
> - yarn search cmd exist in _modern_ but, it do not uses the search registry endpoint. > - yarn search cmd exist in _modern_ but, it do not uses the search registry endpoint.
> - yarn _modern_ has two info commands, the one used here is `yarn npm info`
❌ = no tested ❌ = no tested
✅ = tested ✅ = tested

View file

@ -4,14 +4,16 @@
"version": "1.0.1-6-next.5", "version": "1.0.1-6-next.5",
"main": "./build/index.js", "main": "./build/index.js",
"types": "./build/index.d.ts", "types": "./build/index.d.ts",
"dependencies": { "devDependencies": {
"verdaccio": "workspace:6.0.0-6-next.47",
"@verdaccio/core": "workspace:6.0.0-6-next.47",
"@verdaccio/config": "workspace:6.0.0-6-next.47",
"@verdaccio/types": "workspace:11.0.0-6-next.16",
"yaml": "2.1.1",
"debug": "4.3.4", "debug": "4.3.4",
"fs-extra": "10.1.0", "fs-extra": "10.1.0",
"got": "11.8.5", "got": "11.8.5",
"lodash": "4.17.21", "lodash": "4.17.21"
"verdaccio": "workspace:6.0.0-6-next.47",
"@verdaccio/core": "workspace:6.0.0-6-next.47",
"@verdaccio/config": "workspace:6.0.0-6-next.47"
}, },
"scripts": { "scripts": {
"test": "jest", "test": "jest",

View file

@ -14,3 +14,4 @@ export { exec, ExecOutput } from './process';
export { callRegistry } from './web'; export { callRegistry } from './web';
export * as npmUtils from './npm-utils'; export * as npmUtils from './npm-utils';
export * as pnpmUtils from './npm-utils'; export * as pnpmUtils from './npm-utils';
export * as yarnModernUtils from './yarn-modern-utils';

View file

@ -62,16 +62,12 @@ export async function prepareYarnModernProject(
return { tempFolder }; return { tempFolder };
} }
export async function prepareGenericEmptyProject( export const getPackageJSON = (
packageName: string, packageName,
version: string, version = '1.0.0',
port: number,
token: string,
registryDomain: string,
dependencies = {}, dependencies = {},
devDependencies = {} devDependencies = {}
) { ) => {
const getPackageJSON = (packageName, version = '1.0.0') => {
const json = { const json = {
name: packageName, name: packageName,
version, version,
@ -83,12 +79,13 @@ export async function prepareGenericEmptyProject(
dependencies, dependencies,
devDependencies, devDependencies,
keywords: ['foo', 'bar'], keywords: ['foo', 'bar'],
author: 'Juan Picado <jotadeveloper@gmail.com>', author: 'Yoooooo <jota@some.org>',
license: 'MIT', license: 'MIT',
}; };
return JSON.stringify(json); return JSON.stringify(json);
}; };
const getREADME = (packageName) => `
export const getREADME = (packageName) => `
# My README ${packageName} # My README ${packageName}
some text some text
@ -97,10 +94,23 @@ export async function prepareGenericEmptyProject(
more text more text
`; `;
export async function prepareGenericEmptyProject(
packageName: string,
version: string,
port: number,
token: string,
registryDomain: string,
dependencies: any = {},
devDependencies: any = {}
) {
const getNPMrc = (port, token, registry) => `//localhost:${port}/:_authToken=${token} const getNPMrc = (port, token, registry) => `//localhost:${port}/:_authToken=${token}
registry=${registry}`; registry=${registry}`;
const tempFolder = await createTempFolder('temp-folder'); const tempFolder = await createTempFolder('temp-folder');
await writeFile(join(tempFolder, 'package.json'), getPackageJSON(packageName, version)); await writeFile(
join(tempFolder, 'package.json'),
getPackageJSON(packageName, version, dependencies, devDependencies)
);
await writeFile(join(tempFolder, 'README.md'), getREADME(packageName)); await writeFile(join(tempFolder, 'README.md'), getREADME(packageName));
await writeFile(join(tempFolder, '.npmrc'), getNPMrc(port, token, registryDomain)); await writeFile(join(tempFolder, '.npmrc'), getNPMrc(port, token, registryDomain));
return { tempFolder }; return { tempFolder };

View file

@ -0,0 +1,54 @@
import { cp, writeFile } from 'fs/promises';
import { join } from 'path';
import { URL } from 'url';
import YAML from 'yaml';
import { Dependencies } from '@verdaccio/types';
import { createTempFolder, getPackageJSON, getREADME } from './utils';
export function createYamlConfig(registry: string, token?: string) {
const defaultYaml: any = {
npmRegistryServer: registry,
yarnPath: '.yarn/releases/yarn.js',
enableImmutableInstalls: false,
unsafeHttpWhitelist: ['localhost'],
};
if (typeof token === 'string') {
const url = new URL(registry);
defaultYaml.npmRegistries = {
[`//${url.hostname}:${url.port}`]: {
npmAlwaysAuth: true,
npmAuthToken: token,
},
};
}
return YAML.stringify(defaultYaml);
}
export async function prepareYarnModernProject(
projectName: string,
registryDomain: string,
yarnBinPath: string,
pkgJson: {
packageName: string;
version: string;
dependencies: Dependencies;
devDependencies: Dependencies;
},
token?: string
) {
const tempFolder = await createTempFolder(projectName);
const yamlContent = createYamlConfig(registryDomain, token);
await writeFile(join(tempFolder, '.yarnrc.yml'), yamlContent);
const { packageName, version, dependencies, devDependencies } = pkgJson;
await writeFile(
join(tempFolder, 'package.json'),
getPackageJSON(packageName, version, dependencies, devDependencies)
);
await writeFile(join(tempFolder, 'README.md'), getREADME(packageName));
await cp(yarnBinPath, join(tempFolder, '.yarn/releases/yarn.js'), { dereference: true });
return { tempFolder };
}

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,19 +11,23 @@ describe('audit a package yarn 2', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-project'),
'yarn-2', 'yarn-2',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.0.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });
test.skip('should run yarn npm audit info json body', async () => { test('should run yarn npm audit info json body', async () => {
await yarn(projectFolder, 'install'); await yarn(projectFolder, 'install');
const resp = await yarn(projectFolder, 'npm', 'audit', '--json'); const resp = await yarn(projectFolder, 'npm', 'audit', '--json');
console.log('--resp********:', resp);
const parsedBody = JSON.parse(resp.stdout as string); const parsedBody = JSON.parse(resp.stdout as string);
expect(parsedBody.advisories).toBeDefined(); expect(parsedBody.advisories).toBeDefined();
expect(parsedBody.advisories['1069969']).toBeDefined(); expect(parsedBody.advisories['1069969']).toBeDefined();

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,11 +11,16 @@ describe('install a package', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-project'),
'yarn-2', 'yarn-2',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,11 +11,16 @@ describe('install a packages', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-install'),
'yarn-2', 'yarn-2',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });

View file

@ -0,0 +1,39 @@
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils';
describe('install a packages', () => {
jest.setTimeout(20000);
let registry;
let projectFolder;
beforeAll(async () => {
const setup = await initialSetup();
registry = setup.registry;
await registry.init();
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
'yarn-2',
registry.getRegistryUrl(),
getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
},
registry.getToken()
);
projectFolder = tempFolder;
});
test('should run yarn publish', async () => {
const resp = await yarn(projectFolder, 'install');
expect(resp.stdout).toMatch(/Completed/);
const resp1 = await yarn(projectFolder, 'npm', 'publish');
expect(resp1.stdout).toMatch(/Package archive published/);
});
afterAll(async () => {
registry.stop();
});
});

View file

@ -1,9 +0,0 @@
httpRetry: 10
httpTimeout: 100000
npmRegistryServer: ${registry}
yarnPath: .yarn/releases/yarn.js
# on CI modify the lock file is not allowed
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
enableImmutableInstalls: false
unsafeHttpWhitelist:
- localhost

View file

@ -1,7 +0,0 @@
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"react": "18.2.0"
}
}

View file

@ -1,7 +0,0 @@
httpRetry: 10
httpTimeout: 100000
npmRegistryServer: ${registry}
yarnPath: .yarn/releases/yarn.js
unsafeHttpWhitelist:
- localhost

View file

@ -1,7 +0,0 @@
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"jquery": "3.0.0"
}
}

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,11 +11,16 @@ describe('audit a package yarn 3', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-project'),
'yarn-2', 'yarn-2',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.0.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,17 +11,21 @@ describe('install a package', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-project'), 'yarn-2',
'yarn-3',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });
test('should run yarn 3 info json body', async () => { test('should run yarn 2 info json body', async () => {
await yarn(projectFolder, 'install');
const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json'); const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json');
const parsedBody = JSON.parse(resp.stdout as string); const parsedBody = JSON.parse(resp.stdout as string);
expect(parsedBody.name).toEqual('react'); expect(parsedBody.name).toEqual('react');

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,11 +11,16 @@ describe('install a packages', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-install'),
'yarn-2', 'yarn-2',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });

View file

@ -0,0 +1,39 @@
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils';
describe('install a packages', () => {
jest.setTimeout(20000);
let registry;
let projectFolder;
beforeAll(async () => {
const setup = await initialSetup();
registry = setup.registry;
await registry.init();
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
'yarn-2',
registry.getRegistryUrl(),
getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
},
registry.getToken()
);
projectFolder = tempFolder;
});
test('should run yarn publish', async () => {
const resp = await yarn(projectFolder, 'install');
expect(resp.stdout).toMatch(/Completed/);
const resp1 = await yarn(projectFolder, 'npm', 'publish');
expect(resp1.stdout).toMatch(/Package archive published/);
});
afterAll(async () => {
registry.stop();
});
});

View file

@ -1,9 +0,0 @@
httpRetry: 10
httpTimeout: 100000
npmRegistryServer: ${registry}
yarnPath: .yarn/releases/yarn.js
# on CI modify the lock file is not allowed
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
enableImmutableInstalls: false
unsafeHttpWhitelist:
- localhost

View file

@ -1,7 +0,0 @@
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"react": "18.2.0"
}
}

View file

@ -1,9 +0,0 @@
httpRetry: 10
httpTimeout: 100000
npmRegistryServer: ${registry}
yarnPath: .yarn/releases/yarn.js
# on CI modify the lock file is not allowed
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
enableImmutableInstalls: false
unsafeHttpWhitelist:
- localhost

View file

@ -1,7 +0,0 @@
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"jquery": "3.0.0"
}
}

View file

@ -1,11 +1,9 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
describe('install a package', () => { describe('install a package', () => {
jest.setTimeout(10000); jest.setTimeout(20000);
let registry; let registry;
let projectFolder; let projectFolder;
@ -13,16 +11,21 @@ describe('install a package', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-project'), 'yarn-2',
'yarn-4',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });
test('should run yarn 4 info json body', async () => { test('should run yarn 2 info json body', async () => {
const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json'); const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json');
const parsedBody = JSON.parse(resp.stdout as string); const parsedBody = JSON.parse(resp.stdout as string);
expect(parsedBody.name).toEqual('react'); expect(parsedBody.name).toEqual('react');

View file

@ -1,6 +1,4 @@
import { join } from 'path'; import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils'; import { getYarnCommand, yarn } from './utils';
@ -13,11 +11,16 @@ describe('install a packages', () => {
const setup = await initialSetup(); const setup = await initialSetup();
registry = setup.registry; registry = setup.registry;
await registry.init(); await registry.init();
const { tempFolder } = await prepareYarnModernProject( const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
join(__dirname, './yarn-install'),
'yarn-2', 'yarn-2',
registry.getRegistryUrl(), registry.getRegistryUrl(),
getYarnCommand() getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
}
); );
projectFolder = tempFolder; projectFolder = tempFolder;
}); });

View file

@ -0,0 +1,39 @@
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
import { getYarnCommand, yarn } from './utils';
describe('install a packages', () => {
jest.setTimeout(20000);
let registry;
let projectFolder;
beforeAll(async () => {
const setup = await initialSetup();
registry = setup.registry;
await registry.init();
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
'yarn-2',
registry.getRegistryUrl(),
getYarnCommand(),
{
packageName: '@scope/name',
version: '1.0.0',
dependencies: { jquery: '3.6.0' },
devDependencies: {},
},
registry.getToken()
);
projectFolder = tempFolder;
});
test('should run yarn publish', async () => {
const resp = await yarn(projectFolder, 'install');
expect(resp.stdout).toMatch(/Completed/);
const resp1 = await yarn(projectFolder, 'npm', 'publish');
expect(resp1.stdout).toMatch(/Package archive published/);
});
afterAll(async () => {
registry.stop();
});
});

View file

@ -1,9 +0,0 @@
httpRetry: 10
httpTimeout: 100000
npmRegistryServer: ${registry}
yarnPath: .yarn/releases/yarn.js
# on CI modify the lock file is not allowed
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
enableImmutableInstalls: false
unsafeHttpWhitelist:
- localhost

View file

@ -1,7 +0,0 @@
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"react": "18.2.0"
}
}

View file

@ -1,7 +0,0 @@
httpRetry: 10
httpTimeout: 100000
npmRegistryServer: ${registry}
yarnPath: .yarn/releases/yarn.js
unsafeHttpWhitelist:
- localhost

View file

@ -1,7 +0,0 @@
{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"jquery": "3.0.0"
}
}

View file

@ -192,19 +192,23 @@ importers:
specifiers: specifiers:
'@verdaccio/config': workspace:6.0.0-6-next.47 '@verdaccio/config': workspace:6.0.0-6-next.47
'@verdaccio/core': workspace:6.0.0-6-next.47 '@verdaccio/core': workspace:6.0.0-6-next.47
'@verdaccio/types': workspace:11.0.0-6-next.16
debug: 4.3.4 debug: 4.3.4
fs-extra: 10.1.0 fs-extra: 10.1.0
got: 11.8.5 got: 11.8.5
lodash: 4.17.21 lodash: 4.17.21
verdaccio: workspace:6.0.0-6-next.47 verdaccio: workspace:6.0.0-6-next.47
dependencies: yaml: 2.1.1
devDependencies:
'@verdaccio/config': link:../../../packages/config '@verdaccio/config': link:../../../packages/config
'@verdaccio/core': link:../../../packages/core/core '@verdaccio/core': link:../../../packages/core/core
'@verdaccio/types': link:../../../packages/core/types
debug: 4.3.4 debug: 4.3.4
fs-extra: 10.1.0 fs-extra: 10.1.0
got: 11.8.5 got: 11.8.5
lodash: 4.17.21 lodash: 4.17.21
verdaccio: link:../../../packages/verdaccio verdaccio: link:../../../packages/verdaccio
yaml: 2.1.1
e2e/cli/e2e-npm6: e2e/cli/e2e-npm6:
specifiers: specifiers:
@ -906,7 +910,7 @@ importers:
react-i18next: 11.18.6_ad209b3ec0793904285d43906e66750b react-i18next: 11.18.6_ad209b3ec0793904285d43906e66750b
react-json-view: 1.21.3_3a28dae5d20d968467088dcb8f1d3843 react-json-view: 1.21.3_3a28dae5d20d968467088dcb8f1d3843
react-markdown: 8.0.3_7df2e632d193aca1f14601bd0dc974c3 react-markdown: 8.0.3_7df2e632d193aca1f14601bd0dc974c3
react-redux: 7.2.9_react@17.0.2 react-redux: 7.2.9_react-dom@17.0.2+react@17.0.2
react-router: 5.3.3_react@17.0.2 react-router: 5.3.3_react@17.0.2
react-router-dom: 5.3.3_react@17.0.2 react-router-dom: 5.3.3_react@17.0.2
react-virtualized: 9.22.3_react-dom@17.0.2+react@17.0.2 react-virtualized: 9.22.3_react-dom@17.0.2+react@17.0.2
@ -7648,6 +7652,9 @@ packages:
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0 react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/is-prop-valid': 1.2.0 '@emotion/is-prop-valid': 1.2.0
@ -7669,6 +7676,9 @@ packages:
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0 react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/is-prop-valid': 1.2.0 '@emotion/is-prop-valid': 1.2.0
@ -7692,6 +7702,9 @@ packages:
'@mui/material': ^5.0.0 '@mui/material': ^5.0.0
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@mui/material': 5.10.6_17a1432779ecebed8795c1bcaeaaf2fe '@mui/material': 5.10.6_17a1432779ecebed8795c1bcaeaaf2fe
@ -7706,6 +7719,9 @@ packages:
'@mui/material': ^5.0.0 '@mui/material': ^5.0.0
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@mui/material': 5.10.6_react-dom@17.0.2+react@17.0.2 '@mui/material': 5.10.6_react-dom@17.0.2+react@17.0.2
@ -7721,6 +7737,13 @@ packages:
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0 react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/react': 11.10.4_934231c287e6ee895010b95c7785347a '@emotion/react': 11.10.4_934231c287e6ee895010b95c7785347a
@ -7750,6 +7773,13 @@ packages:
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0 react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@mui/base': 5.0.0-alpha.98_react-dom@17.0.2+react@17.0.2 '@mui/base': 5.0.0-alpha.98_react-dom@17.0.2+react@17.0.2
@ -7773,6 +7803,9 @@ packages:
peerDependencies: peerDependencies:
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@mui/utils': 5.10.6_react@17.0.2 '@mui/utils': 5.10.6_react@17.0.2
@ -7787,6 +7820,9 @@ packages:
peerDependencies: peerDependencies:
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@mui/utils': 5.10.6_react@17.0.2 '@mui/utils': 5.10.6_react@17.0.2
@ -7801,6 +7837,11 @@ packages:
'@emotion/react': ^11.4.1 '@emotion/react': ^11.4.1
'@emotion/styled': ^11.3.0 '@emotion/styled': ^11.3.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/cache': 11.10.3 '@emotion/cache': 11.10.3
@ -7818,6 +7859,11 @@ packages:
'@emotion/react': ^11.4.1 '@emotion/react': ^11.4.1
'@emotion/styled': ^11.3.0 '@emotion/styled': ^11.3.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/cache': 11.10.3 '@emotion/cache': 11.10.3
@ -7832,6 +7878,9 @@ packages:
peerDependencies: peerDependencies:
'@types/react': ^17.0.0 '@types/react': ^17.0.0
react: ^17.0.0 react: ^17.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/hash': 0.9.0 '@emotion/hash': 0.9.0
@ -7860,6 +7909,9 @@ packages:
peerDependencies: peerDependencies:
'@types/react': ^17.0.0 '@types/react': ^17.0.0
react: ^17.0.0 react: ^17.0.0
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/hash': 0.9.0 '@emotion/hash': 0.9.0
@ -7889,6 +7941,13 @@ packages:
'@emotion/styled': ^11.3.0 '@emotion/styled': ^11.3.0
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@emotion/react': 11.10.4_934231c287e6ee895010b95c7785347a '@emotion/react': 11.10.4_934231c287e6ee895010b95c7785347a
@ -7912,6 +7971,13 @@ packages:
'@emotion/styled': ^11.3.0 '@emotion/styled': ^11.3.0
'@types/react': ^17.0.0 || ^18.0.0 '@types/react': ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0 react: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@types/react':
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@mui/private-theming': 5.10.6_react@17.0.2 '@mui/private-theming': 5.10.6_react@17.0.2
@ -7928,12 +7994,18 @@ packages:
resolution: {integrity: sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==} resolution: {integrity: sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==}
peerDependencies: peerDependencies:
'@types/react': '*' '@types/react': '*'
peerDependenciesMeta:
'@types/react':
optional: true
dev: false dev: false
/@mui/types/7.2.0_@types+react@17.0.50: /@mui/types/7.2.0_@types+react@17.0.50:
resolution: {integrity: sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==} resolution: {integrity: sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==}
peerDependencies: peerDependencies:
'@types/react': '*' '@types/react': '*'
peerDependenciesMeta:
'@types/react':
optional: true
dependencies: dependencies:
'@types/react': 17.0.50 '@types/react': 17.0.50
dev: true dev: true
@ -9810,6 +9882,9 @@ packages:
/ajv-formats/2.1.1: /ajv-formats/2.1.1:
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependenciesMeta:
ajv:
optional: true
dependencies: dependencies:
ajv: 8.11.0 ajv: 8.11.0
@ -18007,6 +18082,9 @@ packages:
requiresBuild: true requiresBuild: true
peerDependencies: peerDependencies:
typescript: '>= 4.2.x <= 4.8.x' typescript: '>= 4.2.x <= 4.8.x'
peerDependenciesMeta:
typescript:
optional: true
dependencies: dependencies:
'@mswjs/cookies': 0.2.2 '@mswjs/cookies': 0.2.2
'@mswjs/interceptors': 0.17.5 '@mswjs/interceptors': 0.17.5
@ -20705,10 +20783,17 @@ packages:
react-fast-compare: 3.2.0 react-fast-compare: 3.2.0
dev: false dev: false
/react-redux/7.2.9_react@17.0.2: /react-redux/7.2.9_react-dom@17.0.2+react@17.0.2:
resolution: {integrity: sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==} resolution: {integrity: sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==}
peerDependencies: peerDependencies:
react: ^16.8.3 || ^17 || ^18 react: ^16.8.3 || ^17 || ^18
react-dom: '*'
react-native: '*'
peerDependenciesMeta:
react-dom:
optional: true
react-native:
optional: true
dependencies: dependencies:
'@babel/runtime': 7.19.0 '@babel/runtime': 7.19.0
'@types/react-redux': 7.1.20 '@types/react-redux': 7.1.20
@ -20716,6 +20801,7 @@ packages:
loose-envify: 1.4.0 loose-envify: 1.4.0
prop-types: 15.8.1 prop-types: 15.8.1
react: 17.0.2 react: 17.0.2
react-dom: 17.0.2_react@17.0.2
react-is: 17.0.2 react-is: 17.0.2
dev: true dev: true

View file

@ -1,15 +1,7 @@
{ {
"extends": ["config:base", "schedule:earlyMondays", "helpers:pinGitHubActionDigests"], "extends": ["config:base", "schedule:earlyMondays", "helpers:pinGitHubActionDigests"],
"prConcurrentLimit": 1, "prConcurrentLimit": 1,
"ignorePaths": [ "ignorePaths": ["docker-examples/**"],
"docker-examples/**",
"e2e/cli/e2e-yarn2/yarn-project/**",
"e2e/cli/e2e-yarn3/yarn-project/**",
"e2e/cli/e2e-yarn4/yarn-project/**",
"e2e/cli/e2e-yarn2/yarn-install/**",
"e2e/cli/e2e-yarn3/yarn-install/**",
"e2e/cli/e2e-yarn4/yarn-install/**"
],
"ignoreDeps": [ "ignoreDeps": [
"eslint-plugin-verdaccio", "eslint-plugin-verdaccio",
"@verdaccio/test-helper", "@verdaccio/test-helper",