Skip to content

Commit

Permalink
chore: move getVersion to jest-core from cli (#8706)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Jul 17, 2019
1 parent f4c6e31 commit bd76829
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
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

0 comments on commit bd76829

Please sign in to comment.