2024-09-29 05:47:10 -05:00
|
|
|
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
|
|
|
|
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', () => {
|
|
|
|
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(
|
2022-08-04 13:04:12 -05:00
|
|
|
'yarn-2',
|
|
|
|
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;
|
|
|
|
});
|
|
|
|
|
|
|
|
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');
|
2024-12-07 15:48:32 -05:00
|
|
|
expect(parsedBody.versions).toBeDefined();
|
2022-08-04 13:04:12 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
registry.stop();
|
|
|
|
});
|
|
|
|
});
|