Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move getVersion to jest-core from cli #8706

Merged
merged 2 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- `[docs]` Add information about using `jest.doMock` with ES6 imports ([#8573](https://github.com/facebook/jest/pull/8573))
- `[docs]` Fix variable name in custom-matcher-api code example ([#8582](https://github.com/facebook/jest/pull/8582))
- `[docs]` Fix example used in custom environment docs ([#8617](https://github.com/facebook/jest/pull/8617))
- `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706))

### Performance

Expand Down
3 changes: 1 addition & 2 deletions packages/jest-cli/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import {AggregatedResult} from '@jest/test-result';
import {clearLine} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
import {deprecationEntries} from 'jest-config';
import {runCLI} from '@jest/core';
import {getVersion, runCLI} from '@jest/core';
import chalk from 'chalk';
import exit from 'exit';
import yargs from 'yargs';
import {sync as realpath} from 'realpath-native';
import init from '../init';
import getVersion from '../version';
import * as args from './args';

export async function run(maybeArgv?: Array<string>, project?: Config.Path) {
Expand Down
9 changes: 7 additions & 2 deletions packages/jest-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
*/

// TODO: remove @jest/core exports for the next major
import {runCLI, SearchSource, TestScheduler, TestWatcher} from '@jest/core';
import {
getVersion,
runCLI,
SearchSource,
TestScheduler,
TestWatcher,
} from '@jest/core';
import {run} from './cli';
import {default as getVersion} from './version';

export = {
SearchSource,
Expand Down
1 change: 1 addition & 0 deletions packages/jest-core/src/jest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export {default as SearchSource} from './SearchSource';
export {default as TestScheduler} from './TestScheduler';
export {default as TestWatcher} from './TestWatcher';
export {runCLI} from './cli';
export {default as getVersion} from './version';
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

// Cannot be `import` as it's not under TS root dir
const {version: VERSION} = require('../package.json');

export default function getVersion(): string {
Expand Down