From 0e8ed24a527b951efe11ed49da46e0bd8c0ebef9 Mon Sep 17 00:00:00 2001 From: William Cai Date: Fri, 3 Mar 2023 02:24:45 +0800 Subject: [PATCH] feat(jest-cli): Export yargsOptions (#13970) --- CHANGELOG.md | 1 + packages/jest-cli/__typetests__/index.test.ts | 13 +++++++++++++ packages/jest-cli/__typetests__/tsconfig.json | 4 ++++ packages/jest-cli/package.json | 3 ++- packages/jest-cli/src/index.ts | 1 + yarn.lock | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 packages/jest-cli/__typetests__/index.test.ts create mode 100644 packages/jest-cli/__typetests__/tsconfig.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e4dd61ba875..d64019f12e40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - `[jest-changed-files]` Support Sapling ([#13941](https://github.com/facebook/jest/pull/13941)) - `[jest-circus, @jest/cli, jest-config]` Add feature to randomize order of tests via CLI flag or through the config file([#12922](https://github.com/facebook/jest/pull/12922)) - `[jest-cli, jest-config, @jest/core, jest-haste-map, @jest/reporters, jest-runner, jest-runtime, @jest/types]` Add `workerThreads` configuration option to allow using [worker threads](https://nodejs.org/dist/latest/docs/api/worker_threads.html) for parallelization ([#13939](https://github.com/facebook/jest/pull/13939)) +- `[jest-cli]` Export `yargsOptions` ([#13970](https://github.com/facebook/jest/pull/13970)) - `[jest-config]` Add `openHandlesTimeout` option to configure possible open handles warning. ([#13875](https://github.com/facebook/jest/pull/13875)) - `[@jest/create-cache-key-function]` Allow passing `length` argument to `createCacheKey()` function and set its default value to `16` on Windows ([#13827](https://github.com/facebook/jest/pull/13827)) - `[jest-message-util]` Add support for [AggregateError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError) ([#13946](https://github.com/facebook/jest/pull/13946) & [#13947](https://github.com/facebook/jest/pull/13947)) diff --git a/packages/jest-cli/__typetests__/index.test.ts b/packages/jest-cli/__typetests__/index.test.ts new file mode 100644 index 000000000000..f89e48a16669 --- /dev/null +++ b/packages/jest-cli/__typetests__/index.test.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +import {expectType} from 'tsd-lite'; +import type {Options} from 'yargs'; +import {yargsOptions} from 'jest-cli'; + +expectType<{[key: string]: Options}>(yargsOptions); diff --git a/packages/jest-cli/__typetests__/tsconfig.json b/packages/jest-cli/__typetests__/tsconfig.json new file mode 100644 index 000000000000..c40dd08441df --- /dev/null +++ b/packages/jest-cli/__typetests__/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../tsconfig.typetest.json", + "include": ["./**/*"] +} diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index 2ed572f2a095..83d3bfc1956f 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -30,7 +30,8 @@ "@types/exit": "^0.1.30", "@types/graceful-fs": "^4.1.3", "@types/prompts": "^2.0.1", - "@types/yargs": "^17.0.8" + "@types/yargs": "^17.0.8", + "tsd-lite": "^0.6.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" diff --git a/packages/jest-cli/src/index.ts b/packages/jest-cli/src/index.ts index b22aa69237ac..573dac6cabaa 100644 --- a/packages/jest-cli/src/index.ts +++ b/packages/jest-cli/src/index.ts @@ -6,3 +6,4 @@ */ export {run} from './run'; +export {options as yargsOptions} from './args'; diff --git a/yarn.lock b/yarn.lock index e31b46e5a082..6da6a81a7522 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12629,6 +12629,7 @@ __metadata: jest-util: "workspace:^" jest-validate: "workspace:^" prompts: ^2.0.1 + tsd-lite: ^0.6.0 yargs: ^17.3.1 peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0