2022-09-27 15:56:17 -05:00
|
|
|
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
2022-08-04 13:04:12 -05:00
|
|
|
|
|
|
|
import { getYarnCommand, yarn } from './utils';
|
|
|
|
|
|
|
|
describe('install a package', () => {
|
2022-09-24 04:30:16 -05:00
|
|
|
jest.setTimeout(20000);
|
2022-08-04 13:04:12 -05:00
|
|
|
let registry;
|
|
|
|
let projectFolder;
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
const setup = await initialSetup();
|
|
|
|
registry = setup.registry;
|
|
|
|
await registry.init();
|
2022-09-27 15:56:17 -05:00
|
|
|
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
|
|
|
'yarn-2',
|
2022-08-04 13:04:12 -05:00
|
|
|
registry.getRegistryUrl(),
|
2022-09-27 15:56:17 -05:00
|
|
|
getYarnCommand(),
|
|
|
|
{
|
|
|
|
packageName: '@scope/name',
|
|
|
|
version: '1.0.0',
|
|
|
|
dependencies: { jquery: '3.6.0' },
|
|
|
|
devDependencies: {},
|
|
|
|
}
|
2022-08-04 13:04:12 -05:00
|
|
|
);
|
|
|
|
projectFolder = tempFolder;
|
|
|
|
});
|
|
|
|
|
2022-09-27 15:56:17 -05:00
|
|
|
test('should run yarn 2 info json body', async () => {
|
2022-09-18 14:47:23 -05:00
|
|
|
const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json');
|
2022-08-04 13:04:12 -05:00
|
|
|
const parsedBody = JSON.parse(resp.stdout as string);
|
2022-09-18 14:47:23 -05:00
|
|
|
expect(parsedBody.name).toEqual('react');
|
2022-08-04 13:04:12 -05:00
|
|
|
expect(parsedBody.dependencies).toBeDefined();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
registry.stop();
|
|
|
|
});
|
|
|
|
});
|