Skip to content

Commit

Permalink
fix yargs in repl as well
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 10, 2022
1 parent ba92531 commit 7d5e255
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/jest-repl/src/__tests__/jest_repl.test.js
Expand Up @@ -9,7 +9,7 @@
import {spawnSync} from 'child_process';
import path from 'path';

const JEST_RUNTIME = path.resolve(__dirname, '../../bin/jest-repl.js');
const JEST_RUNTIME = require.resolve('../../bin/jest-repl.js');

describe('Repl', () => {
describe('cli', () => {
Expand Down
7 changes: 1 addition & 6 deletions packages/jest-repl/src/cli/args.ts
Expand Up @@ -11,7 +11,7 @@ import type {Options} from 'yargs';
export const usage = 'Usage: $0 [--config=<pathToConfigFile>]';

const runtimeCLIOptions: Record<
'cache' | 'config' | 'debug' | 'version' | 'watchman',
'cache' | 'config' | 'debug' | 'watchman',
Options
> = {
cache: {
Expand All @@ -30,11 +30,6 @@ const runtimeCLIOptions: Record<
description: 'Print debugging info about your jest config.',
type: 'boolean',
},
version: {
alias: 'v',
description: 'Print the version and exit',
type: 'boolean',
},
watchman: {
default: true,
description:
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-repl/src/cli/index.ts
Expand Up @@ -15,15 +15,15 @@ import * as args from './args';
import {run as runtimeCLI} from './runtime-cli';
import {VERSION} from './version';

const REPL_SCRIPT = require.resolve('./repl.js');
const REPL_SCRIPT = require.resolve('./repl');

export function run(): void {
export function run(): Promise<void> {
const argv = yargs.usage(args.usage).options(args.options)
.argv as Config.Argv;

validateCLIOptions(argv, {...args.options, deprecationEntries});

argv._ = [REPL_SCRIPT];

runtimeCLI(argv, [`Jest REPL v${VERSION}`]);
return runtimeCLI(argv, [`Jest REPL v${VERSION}`]);
}

0 comments on commit 7d5e255

Please sign in to comment.