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

Make jest-runner a standalone package. #4236

Merged
merged 1 commit into from
Aug 10, 2017
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
5 changes: 1 addition & 4 deletions packages/jest-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "build/jest.js",
"dependencies": {
"ansi-escapes": "^2.0.0",
"callsites": "^2.0.0",
"chalk": "^2.0.1",
"graceful-fs": "^4.1.11",
"is-ci": "^1.0.10",
Expand All @@ -15,13 +14,12 @@
"istanbul-lib-source-maps": "^1.1.0",
"jest-changed-files": "^20.0.3",
"jest-config": "^20.0.4",
"jest-docblock": "^20.0.3",
"jest-environment-jsdom": "^20.0.3",
"jest-haste-map": "^20.0.4",
"jest-jasmine2": "^20.0.4",
"jest-message-util": "^20.0.3",
"jest-regex-util": "^20.0.3",
"jest-resolve-dependencies": "^20.0.3",
"jest-runner": "^20.0.4",
"jest-runtime": "^20.0.4",
"jest-snapshot": "^20.0.3",
"jest-util": "^20.0.3",
Expand All @@ -31,7 +29,6 @@
"slash": "^1.0.0",
"string-length": "^1.0.1",
"strip-ansi": "^4.0.0",
"throat": "^3.0.0",
"which": "^1.2.12",
"worker-farm": "^1.3.1",
"yargs": "^7.0.2"
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-cli/src/reporters/default_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import type {GlobalConfig, Path, ProjectConfig} from 'types/Config';
import type {Test} from 'types/TestRunner';
import type {ReporterOnStartOptions} from 'types/Reporters';

import {clearLine} from 'jest-util';
import {clearLine, getConsoleOutput} from 'jest-util';
import chalk from 'chalk';
import isCI from 'is-ci';
import BaseReporter from './base_reporter';
import Status from './Status';
import getConsoleOutput from './get_console_output';
import getResultHeader from './get_result_header';

type write = (chunk: string, enc?: any, cb?: () => void) => boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/test_scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import NotifyReporter from './reporters/notify_reporter';
import ReporterDispatcher from './reporter_dispatcher';
import snapshot from 'jest-snapshot';
import SummaryReporter from './reporters/summary_reporter';
import TestRunner from './test_runner';
import TestRunner from 'jest-runner';
import TestWatcher from './test_watcher';
import VerboseReporter from './reporters/verbose_reporter';

Expand Down
4 changes: 4 additions & 0 deletions packages/jest-runner/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/__mocks__/**
**/__tests__/**
src
yarn.lock
22 changes: 22 additions & 0 deletions packages/jest-runner/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "jest-runner",
"version": "20.0.4",
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest.git"
},
"license": "BSD-3-Clause",
"main": "build/index.js",
"dependencies": {
"jest-config": "^20.0.4",
"jest-docblock": "^20.0.3",
"jest-haste-map": "^20.0.4",
"jest-jasmine2": "^20.0.4",
"jest-message-util": "^20.0.3",
"jest-runtime": "^20.0.4",
"jest-util": "^20.0.3",
"pify": "^2.3.0",
"throat": "^3.0.0",
"worker-farm": "^1.3.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

'use strict';

const TestRunner = require('../test_runner');
const TestWatcher = require('../test_watcher');
const TestRunner = require('../index');
const {TestWatcher} = require('jest-cli');

let workerFarmMock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
*/

import type {GlobalConfig} from 'types/Config';
import type TestWatcher from './test_watcher';
import type {
OnTestFailure,
OnTestStart,
OnTestSuccess,
Test,
TestRunnerOptions,
TestWatcher,
} from 'types/TestRunner';

import pify from 'pify';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ import type {TestResult} from 'types/TestResult';
import type RuntimeClass from 'jest-runtime';

import fs from 'fs';
import {Console, NullConsole, setGlobal} from 'jest-util';
import {
BufferedConsole,
Console,
NullConsole,
getConsoleOutput,
setGlobal,
} from 'jest-util';
import {getTestEnvironment} from 'jest-config';
import docblock from 'jest-docblock';
import BufferedConsole from './lib/buffered_console';
import getConsoleOutput from './reporters/get_console_output';

function runTest(
path: Path,
Expand Down
1 change: 1 addition & 0 deletions packages/jest-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "BSD-3-Clause",
"main": "build/index.js",
"dependencies": {
"callsites": "^2.0.0",
"chalk": "^2.0.1",
"graceful-fs": "^4.1.11",
"jest-message-util": "^20.0.3",
Expand Down
8 changes: 6 additions & 2 deletions packages/jest-util/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

import mkdirp from 'mkdirp';

import BufferedConsole from './buffered_console';
import clearLine from './clear_line';
import Console from './Console';
import FakeTimers from './fake_timers';
import NullConsole from './null_console';
import clearLine from './clear_line';
import formatTestResults from './format_test_results';
import getConsoleOutput from './get_console_output';
import installCommonGlobals from './install_common_globals';
import NullConsole from './null_console';
import setGlobal from './set_global';
import validateCLIOptions from './validate_cli_options';

Expand All @@ -30,12 +32,14 @@ const createDirectory = (path: string) => {
};

module.exports = {
BufferedConsole,
Console,
FakeTimers,
NullConsole,
clearLine,
createDirectory,
formatTestResults,
getConsoleOutput,
installCommonGlobals,
setGlobal,
validateCLIOptions,
Expand Down
4 changes: 3 additions & 1 deletion types/TestRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ import type {
TestResult,
} from 'types/TestResult';
import type Runtime from 'jest-runtime';
import type TestWatcher from 'jest-cli/src/test_watcher';
import type {TestWatcher as _TestWatcher} from 'jest-cli';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just keep it with the standard name? I don't see any place where it could collide.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required in this file to be exported under the same name, that way I get around making jest-runner depend on jest-cli, which would be a circular dependency just to include the type information. export type TestWatcher = TestWatcher doesn't work in Flow.


export type Test = {|
context: Context,
duration: ?number,
path: Path,
|};

export type TestWatcher = _TestWatcher;

export type OnTestStart = Test => Promise<void>;
export type OnTestFailure = (Test, SerializableError) => Promise<*>;
export type OnTestSuccess = (Test, TestResult) => Promise<*>;
Expand Down
40 changes: 29 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

create-react-class@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.0.tgz#ab448497c26566e1e29413e883207d57cfe7bed4"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.3.1"
object-assign "^4.1.1"

cross-spawn@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
Expand Down Expand Up @@ -2607,7 +2615,7 @@ fb-watchman@^2.0.0:
dependencies:
bser "^2.0.0"

fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.9:
fbjs@^0.8.4, fbjs@^0.8.9:
version "0.8.12"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
dependencies:
Expand Down Expand Up @@ -4104,7 +4112,7 @@ longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"

loose-envify@^1.0.0, loose-envify@^1.1.0:
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
Expand Down Expand Up @@ -4449,7 +4457,7 @@ object-assign@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"

object-assign@^4.0.1, object-assign@^4.1.0:
object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"

Expand Down Expand Up @@ -4814,6 +4822,13 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"

prop-types@^15.5.10:
version "15.5.10"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.3.1"

prop-types@^15.5.4:
version "15.5.8"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394"
Expand Down Expand Up @@ -4911,13 +4926,14 @@ react-deep-force-update@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.0.1.tgz#f911b5be1d2a6fe387507dd6e9a767aa2924b4c7"

react-dom@15.4.2:
version "15.4.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f"
react-dom@^15.6.1:
version "15.6.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.1.tgz#2cb0ed4191038e53c209eb3a79a23e2a4cf99470"
dependencies:
fbjs "^0.8.1"
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.10"

react-proxy@^1.1.7:
version "1.1.8"
Expand All @@ -4940,13 +4956,15 @@ react-transform-hmr@^1.0.4:
global "^4.3.0"
react-proxy "^1.1.7"

react@15.4.2:
version "15.4.2"
resolved "https://registry.yarnpkg.com/react/-/react-15.4.2.tgz#41f7991b26185392ba9bae96c8889e7e018397ef"
react@^15.4.2:
version "15.6.1"
resolved "https://registry.yarnpkg.com/react/-/react-15.6.1.tgz#baa8434ec6780bde997cdc380b79cd33b96393df"
dependencies:
fbjs "^0.8.4"
create-react-class "^15.6.0"
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.10"

read-cmd-shim@^1.0.1:
version "1.0.1"
Expand Down