console/integration-tests/testkit/cli.ts
renovate[bot] 1afe0ec73a
Update dependency @theguild/prettier-config to v1 (#676)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
2022-11-24 10:00:41 +00:00

28 lines
782 B
TypeScript

import * as utils from '@n1ru4l/dockest/test-helper';
import { execa } from '@n1ru4l/dockest';
import { resolve } from 'path';
const registryAddress = utils.getServiceAddress('server', 3001);
const cliDevLocation = resolve(__dirname, '../../packages/libraries/cli/bin/run');
async function exec(cmd: string) {
const result = execa(`${cliDevLocation} ${cmd}`);
if (result.failed) {
throw result.stderr;
}
return result.stdout;
}
export async function schemaPublish(args: string[]) {
return exec(
['schema:publish', `--registry`, `http://${registryAddress}/graphql`, ...args].join(' '),
);
}
export async function schemaCheck(args: string[]) {
return exec(
['schema:check', `--registry`, `http://${registryAddress}/graphql`, ...args].join(' '),
);
}