From 947a9f216557875a64e2bf15d7f58022dc39e6ae Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 20 Sep 2022 13:54:49 +0200 Subject: [PATCH] cli: flip repo command help options to use --jest-help instead Signed-off-by: Patrik Oldsberg --- packages/cli/cli-report.md | 104 +------------------------ packages/cli/src/commands/index.ts | 5 +- packages/cli/src/commands/repo/test.ts | 4 +- 3 files changed, 10 insertions(+), 103 deletions(-) diff --git a/packages/cli/cli-report.md b/packages/cli/cli-report.md index b5d9421bdf..9afd12fb48 100644 --- a/packages/cli/cli-report.md +++ b/packages/cli/cli-report.md @@ -429,110 +429,12 @@ Options: ### `backstage-cli repo test` ``` -Usage: backstage-cli [--config=] [TestPathPattern] +Usage: backstage-cli repo test [options] Options: + --since + --jest-help -h, --help - --version - --all - --automock - -b, --bail - --cache - --cacheDirectory - --changedFilesWithAncestor - --changedSince - --ci - --clearCache - --clearMocks - --collectCoverage - --collectCoverageFrom - --color - --colors - -c, --config - --coverage - --coverageDirectory - --coveragePathIgnorePatterns - --coverageProvider - --coverageReporters - --coverageThreshold - --debug - --detectLeaks - --detectOpenHandles - --env - --errorOnDeprecated - -e, --expand - --filter - --findRelatedTests - --forceExit - --globalSetup - --globalTeardown - --globals - --haste - --ignoreProjects - --init - --injectGlobals - --json - --lastCommit - --listTests - --logHeapUsage - --maxConcurrency - -w, --maxWorkers - --moduleDirectories - --moduleFileExtensions - --moduleNameMapper - --modulePathIgnorePatterns - --modulePaths - --noStackTrace - --notify - --notifyMode - -o, --onlyChanged - -f, --onlyFailures - --outputFile - --passWithNoTests - --preset - --prettierPath - --projects - --reporters - --resetMocks - --resetModules - --resolver - --restoreMocks - --rootDir - --roots - -i, --runInBand - --runTestsByPath - --runner - --selectProjects - --setupFiles - --setupFilesAfterEnv - --shard - --showConfig - --silent - --skipFilter - --snapshotSerializers - --testEnvironment - --testEnvironmentOptions - --testFailureExitCode - --testLocationInResults - --testMatch - -t, --testNamePattern - --testPathIgnorePatterns - --testPathPattern - --testRegex - --testResultsProcessor - --testRunner - --testSequencer - --testTimeout - --transform - --transformIgnorePatterns - --unmockedModulePathPatterns - -u, --updateSnapshot - --useStderr - --verbose - --watch - --watchAll - --watchPathIgnorePatterns - --watchman ``` ### `backstage-cli test` diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index dfa53096bd..266b4fd9f1 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -80,7 +80,10 @@ export function registerRepoCommand(program: Command) { '--since ', 'Only test packages that changed since the specified ref', ) - .helpOption(', --backstage-cli-help') // Let Jest handle help + .option( + '--jest-help', + 'Show help for Jest CLI options, which are passed through', + ) .description('Run tests, forwarding args to Jest, defaulting to watch mode') .action(lazy(() => import('./repo/test').then(m => m.command))); } diff --git a/packages/cli/src/commands/repo/test.ts b/packages/cli/src/commands/repo/test.ts index 0726d10777..e873ac2b9b 100644 --- a/packages/cli/src/commands/repo/test.ts +++ b/packages/cli/src/commands/repo/test.ts @@ -118,7 +118,9 @@ export async function command(opts: OptionValues, cmd: Command): Promise { } // This ensures that the process doesn't exit too early before stdout is flushed - if (args.includes('--help')) { + if (args.includes('--jest-help')) { + removeOptionArg(args, '--jest-help'); + args.push('--help'); (process.stdout as any)._handle.setBlocking(true); }