2022-08-04 13:04:12 -05:00
|
|
|
import { join } from 'path';
|
|
|
|
|
|
|
|
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
|
|
|
|
|
|
|
import { getYarnCommand, yarn } from './utils';
|
|
|
|
|
|
|
|
describe('install a package', () => {
|
|
|
|
jest.setTimeout(10000);
|
|
|
|
let registry;
|
|
|
|
let projectFolder;
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
const setup = await initialSetup();
|
|
|
|
registry = setup.registry;
|
|
|
|
await registry.init();
|
|
|
|
const { tempFolder } = await prepareYarnModernProject(
|
|
|
|
join(__dirname, './yarn-project'),
|
|
|
|
'yarn-3',
|
|
|
|
registry.getRegistryUrl(),
|
|
|
|
getYarnCommand()
|
|
|
|
);
|
|
|
|
projectFolder = tempFolder;
|
|
|
|
});
|
|
|
|
|
|
|
|
test('should run yarn 3 info json body', async () => {
|
2022-09-16 17:33:55 -05:00
|
|
|
await yarn(projectFolder, 'install');
|
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();
|
|
|
|
});
|
|
|
|
});
|