Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -4,13 +4,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Test } from 'jest-runner';
import { Config } from '@jest/types';
import { TestResult } from '@jest/test-result';
import type { TestResult } from '@jest/test-result';
import type { Config } from '@jest/types';
import type { Test } from 'jest-runner';
export default class FailedTestsCache {
private _enabledTestsMap?;
filterTests(tests: Array<Test>): Array<Test>;
setTestResults(testResults: Array<TestResult>): void;
updateConfig(globalConfig: Config.GlobalConfig): Config.GlobalConfig;
}
//# sourceMappingURL=FailedTestsCache.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"FailedTestsCache.d.ts","sourceRoot":"","sources":["../src/FailedTestsCache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAI7C,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,OAAO,CAAC,gBAAgB,CAAC,CAAU;IAEnC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IAS5C,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC;IAmB7C,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY;CAQrE"}

View File

@@ -5,24 +5,6 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
@@ -78,8 +60,7 @@ class FailedTestsCache {
return globalConfig;
}
const newConfig = _objectSpread({}, globalConfig);
const newConfig = {...globalConfig};
newConfig.enabledTestsMap = this._enabledTestsMap;
return Object.freeze(newConfig);
}

View File

@@ -4,20 +4,20 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { AggregatedResult, TestResult } from '@jest/test-result';
import { Test } from 'jest-runner';
import { Context } from 'jest-runtime';
import { Reporter, ReporterOnStartOptions } from '@jest/reporters';
import type { Reporter, ReporterOnStartOptions } from '@jest/reporters';
import type { AggregatedResult, TestCaseResult, TestResult } from '@jest/test-result';
import type { Test } from 'jest-runner';
import type { Context } from 'jest-runtime';
export default class ReporterDispatcher {
private _reporters;
constructor();
register(reporter: Reporter): void;
unregister(ReporterClass: Function): void;
onTestResult(test: Test, testResult: TestResult, results: AggregatedResult): Promise<void>;
onTestStart(test: Test): Promise<void>;
onTestFileResult(test: Test, testResult: TestResult, results: AggregatedResult): Promise<void>;
onTestFileStart(test: Test): Promise<void>;
onRunStart(results: AggregatedResult, options: ReporterOnStartOptions): Promise<void>;
onTestCaseResult(test: Test, testCaseResult: TestCaseResult): Promise<void>;
onRunComplete(contexts: Set<Context>, results: AggregatedResult): Promise<void>;
getErrors(): Array<Error>;
hasErrors(): boolean;
}
//# sourceMappingURL=ReporterDispatcher.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"ReporterDispatcher.d.ts","sourceRoot":"","sources":["../src/ReporterDispatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,OAAO,CAAC,UAAU,CAAkB;;IAMpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAIlC,UAAU,CAAC,aAAa,EAAE,QAAQ;IAM5B,YAAY,CAChB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,gBAAgB;IAarB,WAAW,CAAC,IAAI,EAAE,IAAI;IAMtB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,sBAAsB;IAMrE,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB;IAQrE,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC;IAOzB,SAAS,IAAI,OAAO;CAGrB"}

View File

@@ -5,38 +5,6 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
}
_next(undefined);
});
};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
@@ -57,6 +25,8 @@ function _defineProperty(obj, key, value) {
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable local/ban-types-eventually */
class ReporterDispatcher {
constructor() {
_defineProperty(this, '_reporters', void 0);
@@ -74,146 +44,50 @@ class ReporterDispatcher {
);
}
onTestResult(test, testResult, results) {
var _this = this;
return _asyncToGenerator(function*() {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (
var _iterator = _this._reporters[Symbol.iterator](), _step;
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
_iteratorNormalCompletion = true
) {
const reporter = _step.value;
reporter.onTestResult &&
(yield reporter.onTestResult(test, testResult, results));
} // Release memory if unused later.
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
async onTestFileResult(test, testResult, results) {
for (const reporter of this._reporters) {
if (reporter.onTestFileResult) {
await reporter.onTestFileResult(test, testResult, results);
} else if (reporter.onTestResult) {
await reporter.onTestResult(test, testResult, results);
}
} // Release memory if unused later.
testResult.sourceMaps = undefined;
testResult.coverage = undefined;
testResult.console = undefined;
})();
testResult.sourceMaps = undefined;
testResult.coverage = undefined;
testResult.console = undefined;
}
onTestStart(test) {
var _this2 = this;
return _asyncToGenerator(function*() {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (
var _iterator2 = _this2._reporters[Symbol.iterator](), _step2;
!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done);
_iteratorNormalCompletion2 = true
) {
const reporter = _step2.value;
reporter.onTestStart && (yield reporter.onTestStart(test));
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
async onTestFileStart(test) {
for (const reporter of this._reporters) {
if (reporter.onTestFileStart) {
await reporter.onTestFileStart(test);
} else if (reporter.onTestStart) {
await reporter.onTestStart(test);
}
})();
}
}
onRunStart(results, options) {
var _this3 = this;
return _asyncToGenerator(function*() {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (
var _iterator3 = _this3._reporters[Symbol.iterator](), _step3;
!(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done);
_iteratorNormalCompletion3 = true
) {
const reporter = _step3.value;
reporter.onRunStart && (yield reporter.onRunStart(results, options));
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
})();
async onRunStart(results, options) {
for (const reporter of this._reporters) {
reporter.onRunStart && (await reporter.onRunStart(results, options));
}
}
onRunComplete(contexts, results) {
var _this4 = this;
return _asyncToGenerator(function*() {
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (
var _iterator4 = _this4._reporters[Symbol.iterator](), _step4;
!(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done);
_iteratorNormalCompletion4 = true
) {
const reporter = _step4.value;
reporter.onRunComplete &&
(yield reporter.onRunComplete(contexts, results));
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
async onTestCaseResult(test, testCaseResult) {
for (const reporter of this._reporters) {
if (reporter.onTestCaseResult) {
await reporter.onTestCaseResult(test, testCaseResult);
}
})();
}
}
async onRunComplete(contexts, results) {
for (const reporter of this._reporters) {
if (reporter.onRunComplete) {
await reporter.onRunComplete(contexts, results);
}
}
} // Return a list of last errors for every reporter
getErrors() {

View File

@@ -4,11 +4,11 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Context } from 'jest-runtime';
import { Config } from '@jest/types';
import { Test } from 'jest-runner';
import { ChangedFiles } from 'jest-changed-files';
import { Filter, Stats } from './types';
import type { Config } from '@jest/types';
import type { ChangedFiles } from 'jest-changed-files';
import type { Test } from 'jest-runner';
import type { Context } from 'jest-runtime';
import type { Filter, Stats } from './types';
export declare type SearchResult = {
noSCM?: boolean;
stats?: Stats;
@@ -27,8 +27,10 @@ export declare type TestSelectionConfig = {
};
export default class SearchSource {
private _context;
private _dependencyResolver;
private _testPathCases;
constructor(context: Context);
private _getOrBuildDependencyResolver;
private _filterTestPathsWithStats;
private _getAllTestPaths;
isTestFilePath(path: Config.Path): boolean;
@@ -39,5 +41,5 @@ export default class SearchSource {
findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): SearchResult;
private _getTestPaths;
getTestPaths(globalConfig: Config.GlobalConfig, changedFiles: ChangedFiles | undefined, filter?: Filter): Promise<SearchResult>;
findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Array<string>;
}
//# sourceMappingURL=SearchSource.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"SearchSource.d.ts","sourceRoot":"","sources":["../src/SearchSource.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAMhD,OAAO,EAAgB,MAAM,EAAE,KAAK,EAAC,MAAM,SAAS,CAAC;AAErD,oBAAY,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAeF,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,cAAc,CAAqB;gBAE/B,OAAO,EAAE,OAAO;IAqC5B,OAAO,CAAC,yBAAyB;IA4CjC,OAAO,CAAC,gBAAgB;IAOxB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO;IAI1C,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY;IAIzD,gBAAgB,CACd,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAC1B,eAAe,EAAE,OAAO,GACvB,YAAY;IA0Df,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY;IAWzD,2BAA2B,CACzB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EACzB,eAAe,EAAE,OAAO,GACvB,YAAY;IAUf,6BAA6B,CAC3B,gBAAgB,EAAE,YAAY,EAC9B,eAAe,EAAE,OAAO;IAY1B,OAAO,CAAC,aAAa;IA6Bf,YAAY,CAChB,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC;CA4BzB"}

View File

@@ -5,10 +5,20 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require('path'));
function os() {
const data = _interopRequireWildcard(require('os'));
_path = function _path() {
os = function () {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
@@ -18,27 +28,7 @@ function _path() {
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function _micromatch() {
return data;
};
return data;
}
function _jestResolveDependencies() {
const data = _interopRequireDefault(require('jest-resolve-dependencies'));
_jestResolveDependencies = function _jestResolveDependencies() {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function _jestRegexUtil() {
_micromatch = function () {
return data;
};
@@ -48,7 +38,27 @@ function _jestRegexUtil() {
function _jestConfig() {
const data = require('jest-config');
_jestConfig = function _jestConfig() {
_jestConfig = function () {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function () {
return data;
};
return data;
}
function _jestResolveDependencies() {
const data = _interopRequireDefault(require('jest-resolve-dependencies'));
_jestResolveDependencies = function () {
return data;
};
@@ -58,7 +68,7 @@ function _jestConfig() {
function _jestSnapshot() {
const data = require('jest-snapshot');
_jestSnapshot = function _jestSnapshot() {
_jestSnapshot = function () {
return data;
};
@@ -68,7 +78,7 @@ function _jestSnapshot() {
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
_jestUtil = function () {
return data;
};
@@ -79,54 +89,46 @@ function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
}
_next(undefined);
});
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _defineProperty(obj, key, value) {
@@ -143,17 +145,16 @@ function _defineProperty(obj, key, value) {
return obj;
}
const globsToMatcher = globs => path =>
_micromatch().default.some(
(0, _jestUtil().replacePathSepForGlob)(path),
globs,
{
dot: true
}
);
const regexToMatcher = testRegex => {
const regexes = testRegex.map(testRegex => new RegExp(testRegex));
return path =>
regexes.some(regex => {
const result = regex.test(path); // prevent stateful regexes from breaking, just in case
const regexToMatcher = testRegex => path =>
testRegex.some(testRegex => new RegExp(testRegex).test(path));
regex.lastIndex = 0;
return result;
});
};
const toTests = (context, tests) =>
tests.map(path => ({
@@ -162,19 +163,27 @@ const toTests = (context, tests) =>
path
}));
const hasSCM = changedFilesInfo => {
const {repos} = changedFilesInfo; // no SCM (git/hg/...) is found in any of the roots.
const noSCM = Object.values(repos).every(scm => scm.size === 0);
return !noSCM;
};
class SearchSource {
constructor(context) {
_defineProperty(this, '_context', void 0);
_defineProperty(this, '_dependencyResolver', void 0);
_defineProperty(this, '_testPathCases', []);
const config = context.config;
const {config} = context;
this._context = context;
this._dependencyResolver = null;
const rootPattern = new RegExp(
config.roots
.map(dir =>
(0, _jestRegexUtil().escapePathForRegex)(dir + _path().default.sep)
)
.map(dir => (0, _jestRegexUtil().escapePathForRegex)(dir + path().sep))
.join('|')
);
@@ -185,7 +194,7 @@ class SearchSource {
if (config.testMatch.length) {
this._testPathCases.push({
isMatch: globsToMatcher(config.testMatch),
isMatch: (0, _jestUtil().globsToMatcher)(config.testMatch),
stat: 'testMatch'
});
}
@@ -209,6 +218,18 @@ class SearchSource {
}
}
_getOrBuildDependencyResolver() {
if (!this._dependencyResolver) {
this._dependencyResolver = new (_jestResolveDependencies().default)(
this._context.resolver,
this._context.hasteFS,
(0, _jestSnapshot().buildSnapshotResolver)(this._context.config)
);
}
return this._dependencyResolver;
}
_filterTestPathsWithStats(allPaths, testPathPattern) {
const data = {
stats: {
@@ -234,11 +255,7 @@ class SearchSource {
data.tests = allPaths.filter(test => {
let filterResult = true;
for (var _i = 0; _i < testCases.length; _i++) {
const _testCases$_i = testCases[_i],
isMatch = _testCases$_i.isMatch,
stat = _testCases$_i.stat;
for (const {isMatch, stat} of testCases) {
if (isMatch(test.path)) {
data.stats[stat]++;
} else {
@@ -267,11 +284,7 @@ class SearchSource {
}
findRelatedTests(allPaths, collectCoverage) {
const dependencyResolver = new (_jestResolveDependencies()).default(
this._context.resolver,
this._context.hasteFS,
(0, _jestSnapshot().buildSnapshotResolver)(this._context.config)
);
const dependencyResolver = this._getOrBuildDependencyResolver();
if (!collectCoverage) {
return {
@@ -295,27 +308,28 @@ class SearchSource {
skipNodeResolution: this._context.config.skipNodeResolution
}
);
const allPathsAbsolute = Array.from(allPaths).map(p =>
_path().default.resolve(p)
);
const allPathsAbsolute = Array.from(allPaths).map(p => path().resolve(p));
const collectCoverageFrom = new Set();
testModulesMap.forEach(testModule => {
if (!testModule.dependencies) {
return;
}
testModule.dependencies
.filter(p => allPathsAbsolute.includes(p))
.map(filename => {
filename = (0, _jestConfig().replaceRootDirInPath)(
this._context.config.rootDir,
filename
);
return _path().default.isAbsolute(filename)
? _path().default.relative(this._context.config.rootDir, filename)
: filename;
})
.forEach(filename => collectCoverageFrom.add(filename));
testModule.dependencies.forEach(p => {
if (!allPathsAbsolute.includes(p)) {
return;
}
const filename = (0, _jestConfig().replaceRootDirInPath)(
this._context.config.rootDir,
p
);
collectCoverageFrom.add(
path().isAbsolute(filename)
? path().relative(this._context.config.rootDir, filename)
: filename
);
});
});
return {
collectCoverageFrom,
@@ -331,7 +345,7 @@ class SearchSource {
tests: toTests(
this._context,
paths
.map(p => _path().default.resolve(this._context.config.cwd, p))
.map(p => path().resolve(this._context.config.cwd, p))
.filter(this.isTestFilePath.bind(this))
)
};
@@ -340,7 +354,7 @@ class SearchSource {
findRelatedTestsFromPattern(paths, collectCoverage) {
if (Array.isArray(paths) && paths.length) {
const resolvedPaths = paths.map(p =>
_path().default.resolve(this._context.config.cwd, p)
path().resolve(this._context.config.cwd, p)
);
return this.findRelatedTests(new Set(resolvedPaths), collectCoverage);
}
@@ -351,21 +365,18 @@ class SearchSource {
}
findTestRelatedToChangedFiles(changedFilesInfo, collectCoverage) {
const repos = changedFilesInfo.repos,
changedFiles = changedFilesInfo.changedFiles; // no SCM (git/hg/...) is found in any of the roots.
if (!hasSCM(changedFilesInfo)) {
return {
noSCM: true,
tests: []
};
}
const noSCM = Object.keys(repos).every(scm => repos[scm].size === 0);
return noSCM
? {
noSCM: true,
tests: []
}
: this.findRelatedTests(changedFiles, collectCoverage);
const {changedFiles} = changedFilesInfo;
return this.findRelatedTests(changedFiles, collectCoverage);
}
_getTestPaths(globalConfig, changedFiles) {
const paths = globalConfig.nonFlagArgs;
if (globalConfig.onlyChanged) {
if (!changedFiles) {
throw new Error('Changed files must be set when running with -o.');
@@ -375,7 +386,33 @@ class SearchSource {
changedFiles,
globalConfig.collectCoverage
);
} else if (globalConfig.runTestsByPath && paths && paths.length) {
}
let paths = globalConfig.nonFlagArgs;
if (globalConfig.findRelatedTests && 'win32' === os().platform()) {
const allFiles = this._context.hasteFS.getAllFiles();
const options = {
nocase: true,
windows: false
};
paths = paths
.map(p => {
const relativePath = path()
.resolve(this._context.config.cwd, p)
.replace(/\\/g, '\\\\');
const match = (0, _micromatch().default)(
allFiles,
relativePath,
options
);
return match[0];
})
.filter(Boolean);
}
if (globalConfig.runTestsByPath && paths && paths.length) {
return this.findTestsByPaths(paths);
} else if (globalConfig.findRelatedTests && paths && paths.length) {
return this.findRelatedTestsFromPattern(
@@ -391,34 +428,52 @@ class SearchSource {
}
}
getTestPaths(globalConfig, changedFiles, filter) {
var _this = this;
async getTestPaths(globalConfig, changedFiles, filter) {
const searchResult = this._getTestPaths(globalConfig, changedFiles);
return _asyncToGenerator(function*() {
const searchResult = _this._getTestPaths(globalConfig, changedFiles);
const filterPath = globalConfig.filter;
const filterPath = globalConfig.filter;
if (filter) {
const tests = searchResult.tests;
const filterResult = await filter(tests.map(test => test.path));
if (filter) {
const tests = searchResult.tests;
const filterResult = yield filter(tests.map(test => test.path));
if (!Array.isArray(filterResult.filtered)) {
throw new Error(
`Filter ${filterPath} did not return a valid test list`
);
}
const filteredSet = new Set(
filterResult.filtered.map(result => result.test)
if (!Array.isArray(filterResult.filtered)) {
throw new Error(
`Filter ${filterPath} did not return a valid test list`
);
return _objectSpread({}, searchResult, {
tests: tests.filter(test => filteredSet.has(test.path))
});
}
return searchResult;
})();
const filteredSet = new Set(
filterResult.filtered.map(result => result.test)
);
return {
...searchResult,
tests: tests.filter(test => filteredSet.has(test.path))
};
}
return searchResult;
}
findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo) {
if (!hasSCM(changedFilesInfo)) {
return [];
}
const {changedFiles} = changedFilesInfo;
const dependencyResolver = this._getOrBuildDependencyResolver();
const relatedSourcesSet = new Set();
changedFiles.forEach(filePath => {
if (this.isTestFilePath(filePath)) {
const sourcePaths = dependencyResolver.resolve(filePath, {
skipNodeResolution: this._context.config.skipNodeResolution
});
sourcePaths.forEach(sourcePath => relatedSourcesSet.add(sourcePath));
}
});
return Array.from(relatedSourcesSet);
}
}

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { AggregatedResult, AssertionLocation } from '@jest/test-result';
import type { AggregatedResult, AssertionLocation } from '@jest/test-result';
export default class SnapshotInteractiveMode {
private _pipe;
private _isActive;
@@ -28,4 +28,3 @@ export default class SnapshotInteractiveMode {
private _run;
run(failedSnapshotTestAssertions: Array<AssertionLocation>, onConfigChange: (assertion: AssertionLocation | null, shouldUpdateSnapshot: boolean) => unknown): void;
}
//# sourceMappingURL=SnapshotInteractiveMode.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"SnapshotInteractiveMode.d.ts","sourceRoot":"","sources":["../src/SnapshotInteractiveMode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAIH,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAMtE,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAC1C,OAAO,CAAC,KAAK,CAAwB;IACrC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,uBAAuB,CAGlB;IACb,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,WAAW,CAAS;gBAEhB,IAAI,EAAE,MAAM,CAAC,cAAc;IAMvC,QAAQ;IAIR,aAAa;IAIb,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,eAAe;IA0CvB,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,cAAc;IAYtB,GAAG,CAAC,GAAG,EAAE,MAAM;IAqCf,KAAK;IAML,OAAO;IAMP,iBAAiB,CAAC,OAAO,EAAE,gBAAgB;IAiB3C,OAAO,CAAC,IAAI;IAKZ,GAAG,CACD,4BAA4B,EAAE,KAAK,CAAC,iBAAiB,CAAC,EACtD,cAAc,EAAE,CACd,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,oBAAoB,EAAE,OAAO,KAC1B,OAAO;CAYf"}

View File

@@ -5,30 +5,20 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
return data;
};
return data;
}
function _ansiEscapes() {
const data = _interopRequireDefault(require('ansi-escapes'));
_ansiEscapes = function _ansiEscapes() {
_ansiEscapes = function () {
return data;
};
return data;
}
function _jestWatcher() {
const data = require('jest-watcher');
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_jestWatcher = function _jestWatcher() {
_chalk = function () {
return data;
};
@@ -38,7 +28,17 @@ function _jestWatcher() {
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
_jestUtil = function () {
return data;
};
return data;
}
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
@@ -63,8 +63,7 @@ function _defineProperty(obj, key, value) {
return obj;
}
const ARROW = _jestUtil().specialChars.ARROW,
CLEAR = _jestUtil().specialChars.CLEAR;
const {ARROW, CLEAR} = _jestUtil().specialChars;
class SnapshotInteractiveMode {
constructor(pipe) {

View File

@@ -5,14 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import type { TestResult } from '@jest/test-result';
import { PatternPrompt, Prompt, ScrollOptions } from 'jest-watcher';
import { TestResult } from '@jest/test-result';
export default class TestNamePatternPrompt extends PatternPrompt {
_cachedTestResults: Array<TestResult>;
constructor(pipe: NodeJS.WritableStream, prompt: Prompt);
_onChange(pattern: string, options: ScrollOptions): void;
_printPrompt(pattern: string): void;
_getMatchedTests(pattern: string): string[];
_getMatchedTests(pattern: string): Array<string>;
updateCachedTestResults(testResults?: Array<TestResult>): void;
}
//# sourceMappingURL=TestNamePatternPrompt.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"TestNamePatternPrompt.d.ts","sourceRoot":"","sources":["../src/TestNamePatternPrompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EACL,aAAa,EACb,MAAM,EACN,aAAa,EAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAG7C,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,aAAa;IAC9D,kBAAkB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;gBAE1B,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM;IAMvD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAKjD,YAAY,CAAC,OAAO,EAAE,MAAM;IAM5B,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAsBhC,uBAAuB,CAAC,WAAW,GAAE,KAAK,CAAC,UAAU,CAAM;CAG5D"}

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};
@@ -61,7 +61,7 @@ class TestNamePatternPrompt extends _jestWatcher().PatternPrompt {
try {
regex = new RegExp(pattern, 'i');
} catch (e) {
} catch {
return [];
}

View File

@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { Context } from 'jest-runtime';
import { Test } from 'jest-runner';
import type { Test } from 'jest-runner';
import type { Context } from 'jest-runtime';
import { PatternPrompt, Prompt, ScrollOptions } from 'jest-watcher';
import SearchSource from './SearchSource';
import type SearchSource from './SearchSource';
declare type SearchSources = Array<{
context: Context;
searchSource: SearchSource;
@@ -22,4 +22,3 @@ export default class TestPathPatternPrompt extends PatternPrompt {
updateSearchSources(searchSources: SearchSources): void;
}
export {};
//# sourceMappingURL=TestPathPatternPrompt.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"TestPathPatternPrompt.d.ts","sourceRoot":"","sources":["../src/TestPathPatternPrompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAEjC,OAAO,EACL,aAAa,EACb,MAAM,EACN,aAAa,EAGd,MAAM,cAAc,CAAC;AACtB,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,aAAK,aAAa,GAAG,KAAK,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC,CAAC;AAGH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,aAAa;IAC9D,cAAc,CAAC,EAAE,aAAa,CAAC;gBAEnB,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM;IAKvD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAKjD,YAAY,CAAC,OAAO,EAAE,MAAM;IAM5B,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;IAiB9C,mBAAmB,CAAC,aAAa,EAAE,aAAa;CAGjD"}

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};
@@ -60,7 +60,7 @@ class TestPathPatternPrompt extends _jestWatcher().PatternPrompt {
try {
regex = new RegExp(pattern, 'i');
} catch (e) {}
} catch {}
let tests = [];

View File

@@ -4,11 +4,11 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { Test } from 'jest-runner';
import { Reporter } from '@jest/reporters';
import { AggregatedResult } from '@jest/test-result';
import TestWatcher from './TestWatcher';
import type { Config } from '@jest/types';
import TestRunner = require('jest-runner');
import type TestWatcher from './TestWatcher';
export declare type TestSchedulerOptions = {
startRun: (globalConfig: Config.GlobalConfig) => void;
};
@@ -16,16 +16,17 @@ export declare type TestSchedulerContext = {
firstRun: boolean;
previousSuccess: boolean;
changedFiles?: Set<Config.Path>;
sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>;
};
export default class TestScheduler {
private _dispatcher;
private _globalConfig;
private _options;
private _context;
private readonly _dispatcher;
private readonly _globalConfig;
private readonly _options;
private readonly _context;
constructor(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext);
addReporter(reporter: Reporter): void;
removeReporter(ReporterClass: Function): void;
scheduleTests(tests: Array<Test>, watcher: TestWatcher): Promise<AggregatedResult>;
scheduleTests(tests: Array<TestRunner.Test>, watcher: TestWatcher): Promise<AggregatedResult>;
private _partitionTests;
private _shouldAddDefaultReporters;
private _setupReporters;
@@ -38,4 +39,3 @@ export default class TestScheduler {
private _getReporterProps;
private _bailIfNeeded;
}
//# sourceMappingURL=TestScheduler.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"TestScheduler.d.ts","sourceRoot":"","sources":["../src/TestScheduler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,OAAmB,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAE7C,OAAO,EAML,QAAQ,EACT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,gBAAgB,EAKjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,WAAW,MAAM,eAAe,CAAC;AAOxC,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC;CACvD,CAAC;AACF,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;AACF,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,QAAQ,CAAuB;gBAGrC,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,oBAAoB;IAS/B,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAI9B,cAAc,CAAC,aAAa,EAAE,QAAQ;IAIhC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,WAAW;IAsJ5D,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,0BAA0B;IAWlC,OAAO,CAAC,eAAe;IA+BvB,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,mBAAmB;IAsB3B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,aAAa;CAsBtB"}

View File

@@ -8,47 +8,7 @@ exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function _jestMessageUtil() {
return data;
};
return data;
}
function _jestSnapshot() {
const data = _interopRequireDefault(require('jest-snapshot'));
_jestSnapshot = function _jestSnapshot() {
return data;
};
return data;
}
function _jestRunner() {
const data = _interopRequireDefault(require('jest-runner'));
_jestRunner = function _jestRunner() {
return data;
};
return data;
}
function _reporters() {
const data = require('@jest/reporters');
_reporters = function _reporters() {
_chalk = function () {
return data;
};
@@ -58,7 +18,17 @@ function _reporters() {
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function _exit() {
_exit = function () {
return data;
};
return data;
}
function _reporters() {
const data = require('@jest/reporters');
_reporters = function () {
return data;
};
@@ -68,7 +38,47 @@ function _exit() {
function _testResult() {
const data = require('@jest/test-result');
_testResult = function _testResult() {
_testResult = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestRunner() {
const data = _interopRequireDefault(require('jest-runner'));
_jestRunner = function () {
return data;
};
return data;
}
function _jestSnapshot() {
const data = _interopRequireDefault(require('jest-snapshot'));
_jestSnapshot = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
@@ -85,79 +95,6 @@ function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _slicedToArray(arr, i) {
return (
_arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest()
);
}
function _nonIterableRest() {
throw new TypeError('Invalid attempt to destructure non-iterable instance');
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (
var _i = arr[Symbol.iterator](), _s;
!(_n = (_s = _i.next()).done);
_n = true
) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i['return'] != null) _i['return']();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
}
_next(undefined);
});
};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
@@ -202,189 +139,228 @@ class TestScheduler {
this._dispatcher.unregister(ReporterClass);
}
scheduleTests(tests, watcher) {
var _this = this;
async scheduleTests(tests, watcher) {
const onTestFileStart = this._dispatcher.onTestFileStart.bind(
this._dispatcher
);
return _asyncToGenerator(function*() {
const onStart = _this._dispatcher.onTestStart.bind(_this._dispatcher);
const timings = [];
const contexts = new Set();
tests.forEach(test => {
contexts.add(test.context);
const timings = [];
const contexts = new Set();
tests.forEach(test => {
contexts.add(test.context);
if (test.duration) {
timings.push(test.duration);
}
});
const aggregatedResults = createAggregatedResults(tests.length);
const estimatedTime = Math.ceil(
getEstimatedTime(timings, this._globalConfig.maxWorkers) / 1000
);
const runInBand = (0, _testSchedulerHelper.shouldRunInBand)(
tests,
timings,
this._globalConfig
);
if (test.duration) {
timings.push(test.duration);
}
});
const aggregatedResults = createAggregatedResults(tests.length);
const estimatedTime = Math.ceil(
getEstimatedTime(timings, _this._globalConfig.maxWorkers) / 1000
);
const runInBand = (0, _testSchedulerHelper.shouldRunInBand)(
tests,
timings,
_this._globalConfig
);
const onResult =
/*#__PURE__*/
(function() {
var _ref = _asyncToGenerator(function*(test, testResult) {
if (watcher.isInterrupted()) {
return Promise.resolve();
}
if (testResult.testResults.length === 0) {
const message = 'Your test suite must contain at least one test.';
return onFailure(test, {
message,
stack: new Error(message).stack
});
} // Throws when the context is leaked after executing a test.
if (testResult.leaks) {
const message =
_chalk().default.red.bold('EXPERIMENTAL FEATURE!\n') +
'Your test suite is leaking memory. Please ensure all references are cleaned.\n' +
'\n' +
'There is a number of things that can leak memory:\n' +
' - Async operations that have not finished (e.g. fs.readFile).\n' +
' - Timers not properly mocked (e.g. setInterval, setTimeout).\n' +
' - Keeping references to the global scope.';
return onFailure(test, {
message,
stack: new Error(message).stack
});
}
(0, _testResult().addResult)(aggregatedResults, testResult);
yield _this._dispatcher.onTestResult(
test,
testResult,
aggregatedResults
);
return _this._bailIfNeeded(contexts, aggregatedResults, watcher);
});
return function onResult(_x, _x2) {
return _ref.apply(this, arguments);
};
})();
const onFailure =
/*#__PURE__*/
(function() {
var _ref2 = _asyncToGenerator(function*(test, error) {
if (watcher.isInterrupted()) {
return;
}
const testResult = (0, _testResult().buildFailureTestResult)(
test.path,
error
);
testResult.failureMessage = (0, _jestMessageUtil().formatExecError)(
testResult.testExecError,
test.context.config,
_this._globalConfig,
test.path
);
(0, _testResult().addResult)(aggregatedResults, testResult);
yield _this._dispatcher.onTestResult(
test,
testResult,
aggregatedResults
);
});
return function onFailure(_x3, _x4) {
return _ref2.apply(this, arguments);
};
})();
const updateSnapshotState = () => {
contexts.forEach(context => {
const status = _jestSnapshot().default.cleanup(
context.hasteFS,
_this._globalConfig.updateSnapshot,
_jestSnapshot().default.buildSnapshotResolver(context.config),
context.config.testPathIgnorePatterns
);
aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
aggregatedResults.snapshot.filesRemovedList = (
aggregatedResults.snapshot.filesRemovedList || []
).concat(status.filesRemovedList);
});
const updateAll = _this._globalConfig.updateSnapshot === 'all';
aggregatedResults.snapshot.didUpdate = updateAll;
aggregatedResults.snapshot.failure = !!(
!updateAll &&
(aggregatedResults.snapshot.unchecked ||
aggregatedResults.snapshot.unmatched ||
aggregatedResults.snapshot.filesRemoved)
);
};
yield _this._dispatcher.onRunStart(aggregatedResults, {
estimatedTime,
showStatus: !runInBand
});
const testRunners = Object.create(null);
contexts.forEach(({config}) => {
if (!testRunners[config.runner]) {
const Runner = require(config.runner);
testRunners[config.runner] = new Runner(_this._globalConfig, {
changedFiles: _this._context && _this._context.changedFiles
});
}
});
const testsByRunner = _this._partitionTests(testRunners, tests);
if (testsByRunner) {
try {
var _arr = Object.keys(testRunners);
for (var _i = 0; _i < _arr.length; _i++) {
const runner = _arr[_i];
yield testRunners[runner].runTests(
testsByRunner[runner],
watcher,
onStart,
onResult,
onFailure,
{
serial: runInBand || Boolean(testRunners[runner].isSerial)
}
);
}
} catch (error) {
if (!watcher.isInterrupted()) {
throw error;
}
}
const onResult = async (test, testResult) => {
if (watcher.isInterrupted()) {
return Promise.resolve();
}
updateSnapshotState();
aggregatedResults.wasInterrupted = watcher.isInterrupted();
yield _this._dispatcher.onRunComplete(contexts, aggregatedResults);
const anyTestFailures = !(
aggregatedResults.numFailedTests === 0 &&
aggregatedResults.numRuntimeErrorTestSuites === 0
);
if (testResult.testResults.length === 0) {
const message = 'Your test suite must contain at least one test.';
return onFailure(test, {
message,
stack: new Error(message).stack
});
} // Throws when the context is leaked after executing a test.
const anyReporterErrors = _this._dispatcher.hasErrors();
if (testResult.leaks) {
const message =
_chalk().default.red.bold('EXPERIMENTAL FEATURE!\n') +
'Your test suite is leaking memory. Please ensure all references are cleaned.\n' +
'\n' +
'There is a number of things that can leak memory:\n' +
' - Async operations that have not finished (e.g. fs.readFile).\n' +
' - Timers not properly mocked (e.g. setInterval, setTimeout).\n' +
' - Keeping references to the global scope.';
return onFailure(test, {
message,
stack: new Error(message).stack
});
}
aggregatedResults.success = !(
anyTestFailures ||
aggregatedResults.snapshot.failure ||
anyReporterErrors
(0, _testResult().addResult)(aggregatedResults, testResult);
await this._dispatcher.onTestFileResult(
test,
testResult,
aggregatedResults
);
return aggregatedResults;
})();
return this._bailIfNeeded(contexts, aggregatedResults, watcher);
};
const onFailure = async (test, error) => {
if (watcher.isInterrupted()) {
return;
}
const testResult = (0, _testResult().buildFailureTestResult)(
test.path,
error
);
testResult.failureMessage = (0, _jestMessageUtil().formatExecError)(
testResult.testExecError,
test.context.config,
this._globalConfig,
test.path
);
(0, _testResult().addResult)(aggregatedResults, testResult);
await this._dispatcher.onTestFileResult(
test,
testResult,
aggregatedResults
);
};
const updateSnapshotState = () => {
contexts.forEach(context => {
const status = _jestSnapshot().default.cleanup(
context.hasteFS,
this._globalConfig.updateSnapshot,
_jestSnapshot().default.buildSnapshotResolver(context.config),
context.config.testPathIgnorePatterns
);
aggregatedResults.snapshot.filesRemoved += status.filesRemoved;
aggregatedResults.snapshot.filesRemovedList = (
aggregatedResults.snapshot.filesRemovedList || []
).concat(status.filesRemovedList);
});
const updateAll = this._globalConfig.updateSnapshot === 'all';
aggregatedResults.snapshot.didUpdate = updateAll;
aggregatedResults.snapshot.failure = !!(
!updateAll &&
(aggregatedResults.snapshot.unchecked ||
aggregatedResults.snapshot.unmatched ||
aggregatedResults.snapshot.filesRemoved)
);
};
await this._dispatcher.onRunStart(aggregatedResults, {
estimatedTime,
showStatus: !runInBand
});
const testRunners = Object.create(null);
const contextsByTestRunner = new WeakMap();
contexts.forEach(context => {
const {config} = context;
if (!testRunners[config.runner]) {
var _this$_context, _this$_context2;
const Runner = require(config.runner);
const runner = new Runner(this._globalConfig, {
changedFiles:
(_this$_context = this._context) === null ||
_this$_context === void 0
? void 0
: _this$_context.changedFiles,
sourcesRelatedToTestsInChangedFiles:
(_this$_context2 = this._context) === null ||
_this$_context2 === void 0
? void 0
: _this$_context2.sourcesRelatedToTestsInChangedFiles
});
testRunners[config.runner] = runner;
contextsByTestRunner.set(runner, context);
}
});
const testsByRunner = this._partitionTests(testRunners, tests);
if (testsByRunner) {
try {
for (const runner of Object.keys(testRunners)) {
const testRunner = testRunners[runner];
const context = contextsByTestRunner.get(testRunner);
invariant(context);
const tests = testsByRunner[runner];
const testRunnerOptions = {
serial: runInBand || Boolean(testRunner.isSerial)
};
/**
* Test runners with event emitters are still not supported
* for third party test runners.
*/
if (testRunner.__PRIVATE_UNSTABLE_API_supportsEventEmitters__) {
const unsubscribes = [
testRunner.on('test-file-start', ([test]) =>
onTestFileStart(test)
),
testRunner.on('test-file-success', ([test, testResult]) =>
onResult(test, testResult)
),
testRunner.on('test-file-failure', ([test, error]) =>
onFailure(test, error)
),
testRunner.on(
'test-case-result',
([testPath, testCaseResult]) => {
const test = {
context,
path: testPath
};
this._dispatcher.onTestCaseResult(test, testCaseResult);
}
)
];
await testRunner.runTests(
tests,
watcher,
undefined,
undefined,
undefined,
testRunnerOptions
);
unsubscribes.forEach(sub => sub());
} else {
await testRunner.runTests(
tests,
watcher,
onTestFileStart,
onResult,
onFailure,
testRunnerOptions
);
}
}
} catch (error) {
if (!watcher.isInterrupted()) {
throw error;
}
}
}
updateSnapshotState();
aggregatedResults.wasInterrupted = watcher.isInterrupted();
await this._dispatcher.onRunComplete(contexts, aggregatedResults);
const anyTestFailures = !(
aggregatedResults.numFailedTests === 0 &&
aggregatedResults.numRuntimeErrorTestSuites === 0
);
const anyReporterErrors = this._dispatcher.hasErrors();
aggregatedResults.success = !(
anyTestFailures ||
aggregatedResults.snapshot.failure ||
anyReporterErrors
);
return aggregatedResults;
}
_partitionTests(testRunners, tests) {
@@ -419,10 +395,7 @@ class TestScheduler {
}
_setupReporters() {
const _this$_globalConfig = this._globalConfig,
collectCoverage = _this$_globalConfig.collectCoverage,
notify = _this$_globalConfig.notify,
reporters = _this$_globalConfig.reporters;
const {collectCoverage, notify, reporters} = this._globalConfig;
const isDefault = this._shouldAddDefaultReporters(reporters);
@@ -431,16 +404,27 @@ class TestScheduler {
}
if (!isDefault && collectCoverage) {
var _this$_context3, _this$_context4;
this.addReporter(
new (_reporters()).CoverageReporter(this._globalConfig, {
changedFiles: this._context && this._context.changedFiles
new (_reporters().CoverageReporter)(this._globalConfig, {
changedFiles:
(_this$_context3 = this._context) === null ||
_this$_context3 === void 0
? void 0
: _this$_context3.changedFiles,
sourcesRelatedToTestsInChangedFiles:
(_this$_context4 = this._context) === null ||
_this$_context4 === void 0
? void 0
: _this$_context4.sourcesRelatedToTestsInChangedFiles
})
);
}
if (notify) {
this.addReporter(
new (_reporters()).NotifyReporter(
new (_reporters().NotifyReporter)(
this._globalConfig,
this._options.startRun,
this._context
@@ -456,40 +440,50 @@ class TestScheduler {
_setupDefaultReporters(collectCoverage) {
this.addReporter(
this._globalConfig.verbose
? new (_reporters()).VerboseReporter(this._globalConfig)
: new (_reporters()).DefaultReporter(this._globalConfig)
? new (_reporters().VerboseReporter)(this._globalConfig)
: new (_reporters().DefaultReporter)(this._globalConfig)
);
if (collectCoverage) {
var _this$_context5, _this$_context6;
this.addReporter(
new (_reporters()).CoverageReporter(this._globalConfig, {
changedFiles: this._context && this._context.changedFiles
new (_reporters().CoverageReporter)(this._globalConfig, {
changedFiles:
(_this$_context5 = this._context) === null ||
_this$_context5 === void 0
? void 0
: _this$_context5.changedFiles,
sourcesRelatedToTestsInChangedFiles:
(_this$_context6 = this._context) === null ||
_this$_context6 === void 0
? void 0
: _this$_context6.sourcesRelatedToTestsInChangedFiles
})
);
}
this.addReporter(new (_reporters()).SummaryReporter(this._globalConfig));
this.addReporter(new (_reporters().SummaryReporter)(this._globalConfig));
}
_addCustomReporters(reporters) {
reporters.forEach(reporter => {
const _this$_getReporterPro = this._getReporterProps(reporter),
options = _this$_getReporterPro.options,
path = _this$_getReporterPro.path;
const {options, path} = this._getReporterProps(reporter);
if (path === 'default') return;
try {
const Reporter = require(path);
// TODO: Use `requireAndTranspileModule` for Jest 26
const Reporter = (0, _jestUtil().interopRequireDefault)(require(path))
.default;
this.addReporter(new Reporter(this._globalConfig, options));
} catch (error) {
throw new Error(
error.message =
'An error occurred while adding the reporter at path "' +
path +
'".' +
error.message
);
_chalk().default.bold(path) +
'".' +
error.message;
throw error;
}
});
}
@@ -505,10 +499,7 @@ class TestScheduler {
path: reporter
};
} else if (Array.isArray(reporter)) {
const _reporter = _slicedToArray(reporter, 2),
path = _reporter[0],
options = _reporter[1];
const [path, options] = reporter;
return {
options,
path
@@ -543,6 +534,12 @@ class TestScheduler {
exports.default = TestScheduler;
function invariant(condition, message) {
if (!condition) {
throw new Error(message);
}
}
const createAggregatedResults = numTotalTestSuites => {
const result = (0, _testResult().makeEmptyAggregatedTestResult)();
result.numTotalTestSuites = numTotalTestSuites;

View File

@@ -20,4 +20,3 @@ export default class TestWatcher extends EventEmitter {
isWatchMode(): boolean;
}
export {};
//# sourceMappingURL=TestWatcher.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"TestWatcher.d.ts","sourceRoot":"","sources":["../src/TestWatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,aAAK,KAAK,GAAG;IACX,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,YAAY;IACnD,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,YAAY,CAAU;gBAElB,EAAC,WAAW,EAAC,EAAE;QAAC,WAAW,EAAE,OAAO,CAAA;KAAC;IAMjD,QAAQ,CAAC,KAAK,EAAE,KAAK;IAKrB,aAAa;IAIb,WAAW;CAGZ"}

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _events() {
const data = require('events');
_events = function _events() {
_events = function () {
return data;
};

View File

@@ -4,97 +4,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="yargs" />
import { Config } from '@jest/types';
import { AggregatedResult } from '@jest/test-result';
export declare const runCLI: (argv: import("yargs").Arguments<Partial<{
all: boolean;
automock: boolean;
bail: number | boolean;
browser: boolean;
cache: boolean;
cacheDirectory: string;
changedFilesWithAncestor: boolean;
changedSince: string;
ci: boolean;
clearCache: boolean;
clearMocks: boolean;
collectCoverage: boolean;
collectCoverageFrom: string;
collectCoverageOnlyFrom: string[];
color: boolean;
colors: boolean;
config: string;
coverage: boolean;
coverageDirectory: string;
coveragePathIgnorePatterns: string[];
coverageReporters: string[];
coverageThreshold: string;
debug: boolean;
env: string;
expand: boolean;
findRelatedTests: boolean;
forceExit: boolean;
globals: string;
globalSetup: string | null | undefined;
globalTeardown: string | null | undefined;
haste: string;
init: boolean;
json: boolean;
lastCommit: boolean;
logHeapUsage: boolean;
maxWorkers: string | number;
moduleDirectories: string[];
moduleFileExtensions: string[];
moduleNameMapper: string;
modulePathIgnorePatterns: string[];
modulePaths: string[];
noStackTrace: boolean;
notify: boolean;
notifyMode: string;
onlyChanged: boolean;
outputFile: string;
preset: string | null | undefined;
projects: string[];
prettierPath: string | null | undefined;
resetMocks: boolean;
resetModules: boolean;
resolver: string | null | undefined;
restoreMocks: boolean;
rootDir: string;
roots: string[];
runInBand: boolean;
setupFiles: string[];
setupFilesAfterEnv: string[];
showConfig: boolean;
silent: boolean;
snapshotSerializers: string[];
testEnvironment: string;
testFailureExitCode: string | null | undefined;
testMatch: string[];
testNamePattern: string;
testPathIgnorePatterns: string[];
testPathPattern: string[];
testRegex: string | string[];
testResultsProcessor: string | null | undefined;
testRunner: string;
testSequencer: string;
testURL: string;
testTimeout: number | null | undefined;
timers: string;
transform: string;
transformIgnorePatterns: string[];
unmockedModulePathPatterns: string[] | null | undefined;
updateSnapshot: boolean;
useStderr: boolean;
verbose: boolean | null | undefined;
version: boolean;
watch: boolean;
watchAll: boolean;
watchman: boolean;
watchPathIgnorePatterns: string[];
}>>, projects: string[]) => Promise<{
import type { AggregatedResult } from '@jest/test-result';
import type { Config } from '@jest/types';
export declare function runCLI(argv: Config.Argv, projects: Array<Config.Path>): Promise<{
results: AggregatedResult;
globalConfig: Config.GlobalConfig;
}>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAyBnD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8ElB,CAAC"}

View File

@@ -3,62 +3,12 @@
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.runCLI = void 0;
function _console() {
const data = require('@jest/console');
_console = function _console() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
return data;
};
return data;
}
function _jestConfig() {
const data = require('jest-config');
_jestConfig = function _jestConfig() {
return data;
};
return data;
}
function _jestRuntime() {
const data = _interopRequireDefault(require('jest-runtime'));
_jestRuntime = function _jestRuntime() {
return data;
};
return data;
}
exports.runCLI = runCLI;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
return data;
};
return data;
}
function _rimraf() {
const data = _interopRequireDefault(require('rimraf'));
_rimraf = function _rimraf() {
_chalk = function () {
return data;
};
@@ -68,346 +18,427 @@ function _rimraf() {
function _exit() {
const data = _interopRequireDefault(require('exit'));
_exit = function _exit() {
_exit = function () {
return data;
};
return data;
}
var _create_context = _interopRequireDefault(require('../lib/create_context'));
function _rimraf() {
const data = _interopRequireDefault(require('rimraf'));
var _getChangedFilesPromise = _interopRequireDefault(
require('../getChangedFilesPromise')
);
_rimraf = function () {
return data;
};
var _collectHandles = require('../collectHandles');
return data;
}
var _handle_deprecation_warnings = _interopRequireDefault(
require('../lib/handle_deprecation_warnings')
);
function _console() {
const data = require('@jest/console');
var _runJest = _interopRequireDefault(require('../runJest'));
_console = function () {
return data;
};
var _TestWatcher = _interopRequireDefault(require('../TestWatcher'));
return data;
}
var _watch = _interopRequireDefault(require('../watch'));
function _jestConfig() {
const data = require('jest-config');
var _pluralize = _interopRequireDefault(require('../pluralize'));
_jestConfig = function () {
return data;
};
var _log_debug_messages = _interopRequireDefault(
require('../lib/log_debug_messages')
);
return data;
}
function _jestHasteMap() {
const data = _interopRequireDefault(require('jest-haste-map'));
_jestHasteMap = function () {
return data;
};
return data;
}
function _jestRuntime() {
const data = _interopRequireDefault(require('jest-runtime'));
_jestRuntime = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _TestWatcher() {
const data = _interopRequireDefault(require('../TestWatcher'));
_TestWatcher = function () {
return data;
};
return data;
}
function _collectHandles() {
const data = require('../collectHandles');
_collectHandles = function () {
return data;
};
return data;
}
function _getChangedFilesPromise() {
const data = _interopRequireDefault(require('../getChangedFilesPromise'));
_getChangedFilesPromise = function () {
return data;
};
return data;
}
function _getConfigsOfProjectsToRun() {
const data = _interopRequireDefault(require('../getConfigsOfProjectsToRun'));
_getConfigsOfProjectsToRun = function () {
return data;
};
return data;
}
function _getProjectNamesMissingWarning() {
const data = _interopRequireDefault(
require('../getProjectNamesMissingWarning')
);
_getProjectNamesMissingWarning = function () {
return data;
};
return data;
}
function _getSelectProjectsMessage() {
const data = _interopRequireDefault(require('../getSelectProjectsMessage'));
_getSelectProjectsMessage = function () {
return data;
};
return data;
}
function _createContext() {
const data = _interopRequireDefault(require('../lib/createContext'));
_createContext = function () {
return data;
};
return data;
}
function _handleDeprecationWarnings() {
const data = _interopRequireDefault(
require('../lib/handleDeprecationWarnings')
);
_handleDeprecationWarnings = function () {
return data;
};
return data;
}
function _logDebugMessages() {
const data = _interopRequireDefault(require('../lib/logDebugMessages'));
_logDebugMessages = function () {
return data;
};
return data;
}
function _pluralize() {
const data = _interopRequireDefault(require('../pluralize'));
_pluralize = function () {
return data;
};
return data;
}
function _runJest() {
const data = _interopRequireDefault(require('../runJest'));
_runJest = function () {
return data;
};
return data;
}
function _watch() {
const data = _interopRequireDefault(require('../watch'));
_watch = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const {print: preRunMessagePrint} = _jestUtil().preRunMessage;
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
}
_next(undefined);
async function runCLI(argv, projects) {
let results; // If we output a JSON object, we can't write anything to stdout, since
// it'll break the JSON structure and it won't be valid.
const outputStream =
argv.json || argv.useStderr ? process.stderr : process.stdout;
const {globalConfig, configs, hasDeprecationWarnings} = await (0,
_jestConfig().readConfigs)(argv, projects);
if (argv.debug) {
(0, _logDebugMessages().default)(globalConfig, configs, outputStream);
}
if (argv.showConfig) {
(0, _logDebugMessages().default)(globalConfig, configs, process.stdout);
(0, _exit().default)(0);
}
if (argv.clearCache) {
configs.forEach(config => {
_rimraf().default.sync(config.cacheDirectory);
process.stdout.write(`Cleared ${config.cacheDirectory}\n`);
});
(0, _exit().default)(0);
}
let configsOfProjectsToRun = configs;
if (argv.selectProjects) {
const namesMissingWarning = (0, _getProjectNamesMissingWarning().default)(
configs
);
if (namesMissingWarning) {
outputStream.write(namesMissingWarning);
}
configsOfProjectsToRun = (0, _getConfigsOfProjectsToRun().default)(
argv.selectProjects,
configs
);
outputStream.write(
(0, _getSelectProjectsMessage().default)(configsOfProjectsToRun)
);
}
await _run10000(
globalConfig,
configsOfProjectsToRun,
hasDeprecationWarnings,
outputStream,
r => (results = r)
);
if (argv.watch || argv.watchAll) {
// If in watch mode, return the promise that will never resolve.
// If the watch mode is interrupted, watch should handle the process
// shutdown.
return new Promise(() => {});
}
if (!results) {
throw new Error(
'AggregatedResult must be present after test run is complete'
);
}
const {openHandles} = results;
if (openHandles && openHandles.length) {
const formatted = (0, _collectHandles().formatHandleErrors)(
openHandles,
configs[0]
);
const openHandlesString = (0, _pluralize().default)(
'open handle',
formatted.length,
's'
);
const message =
_chalk().default.red(
`\nJest has detected the following ${openHandlesString} potentially keeping Jest from exiting:\n\n`
) + formatted.join('\n\n');
console.error(message);
}
return {
globalConfig,
results
};
}
const preRunMessagePrint = _jestUtil().preRunMessage.print;
const buildContextsAndHasteMaps = async (
configs,
globalConfig,
outputStream
) => {
const hasteMapInstances = Array(configs.length);
const contexts = await Promise.all(
configs.map(async (config, index) => {
(0, _jestUtil().createDirectory)(config.cacheDirectory);
const runCLI =
/*#__PURE__*/
(function() {
var _ref = _asyncToGenerator(function*(argv, projects) {
const realFs = require('fs');
const hasteMapInstance = _jestRuntime().default.createHasteMap(config, {
console: new (_console().CustomConsole)(outputStream, outputStream),
maxWorkers: Math.max(
1,
Math.floor(globalConfig.maxWorkers / configs.length)
),
resetCache: !config.cache,
watch: globalConfig.watch || globalConfig.watchAll,
watchman: globalConfig.watchman
});
const fs = require('graceful-fs');
hasteMapInstances[index] = hasteMapInstance;
return (0, _createContext().default)(
config,
await hasteMapInstance.build()
);
})
);
return {
contexts,
hasteMapInstances
};
};
fs.gracefulify(realFs);
let results; // If we output a JSON object, we can't write anything to stdout, since
// it'll break the JSON structure and it won't be valid.
const _run10000 = async (
globalConfig,
configs,
hasDeprecationWarnings,
outputStream,
onComplete
) => {
// Queries to hg/git can take a while, so we need to start the process
// as soon as possible, so by the time we need the result it's already there.
const changedFilesPromise = (0, _getChangedFilesPromise().default)(
globalConfig,
configs
); // Filter may need to do an HTTP call or something similar to setup.
// We will wait on an async response from this before using the filter.
const outputStream =
argv.json || argv.useStderr ? process.stderr : process.stdout;
let filter;
const _readConfigs = (0, _jestConfig().readConfigs)(argv, projects),
globalConfig = _readConfigs.globalConfig,
configs = _readConfigs.configs,
hasDeprecationWarnings = _readConfigs.hasDeprecationWarnings;
if (globalConfig.filter && !globalConfig.skipFilter) {
const rawFilter = require(globalConfig.filter);
if (argv.debug) {
(0, _log_debug_messages.default)(globalConfig, configs, outputStream);
let filterSetupPromise;
if (rawFilter.setup) {
// Wrap filter setup Promise to avoid "uncaught Promise" error.
// If an error is returned, we surface it in the return value.
filterSetupPromise = (async () => {
try {
await rawFilter.setup();
} catch (err) {
return err;
}
return undefined;
})();
}
filter = async testPaths => {
if (filterSetupPromise) {
// Expect an undefined return value unless there was an error.
const err = await filterSetupPromise;
if (err) {
throw err;
}
}
if (argv.showConfig) {
(0, _log_debug_messages.default)(globalConfig, configs, process.stdout);
(0, _exit().default)(0);
}
return rawFilter(testPaths);
};
}
if (argv.clearCache) {
configs.forEach(config => {
_rimraf().default.sync(config.cacheDirectory);
process.stdout.write(`Cleared ${config.cacheDirectory}\n`);
});
(0, _exit().default)(0);
}
yield _run(
globalConfig,
const {contexts, hasteMapInstances} = await buildContextsAndHasteMaps(
configs,
globalConfig,
outputStream
);
globalConfig.watch || globalConfig.watchAll
? await runWatch(
contexts,
configs,
hasDeprecationWarnings,
globalConfig,
outputStream,
r => (results = r)
);
if (argv.watch || argv.watchAll) {
// If in watch mode, return the promise that will never resolve.
// If the watch mode is interrupted, watch should handle the process
// shutdown.
return new Promise(() => {});
}
if (!results) {
throw new Error(
'AggregatedResult must be present after test run is complete'
);
}
const _results = results,
openHandles = _results.openHandles;
if (openHandles && openHandles.length) {
const formatted = (0, _collectHandles.formatHandleErrors)(
openHandles,
configs[0]
);
const openHandlesString = (0, _pluralize.default)(
'open handle',
formatted.length,
's'
);
const message =
_chalk().default.red(
`\nJest has detected the following ${openHandlesString} potentially keeping Jest from exiting:\n\n`
) + formatted.join('\n\n');
console.error(message);
}
return {
hasteMapInstances,
filter
)
: await runWithoutWatch(
globalConfig,
results
};
});
return function runCLI(_x, _x2) {
return _ref.apply(this, arguments);
};
})();
exports.runCLI = runCLI;
const buildContextsAndHasteMaps =
/*#__PURE__*/
(function() {
var _ref2 = _asyncToGenerator(function*(
configs,
globalConfig,
outputStream
) {
const hasteMapInstances = Array(configs.length);
const contexts = yield Promise.all(
configs.map(
/*#__PURE__*/
(function() {
var _ref3 = _asyncToGenerator(function*(config, index) {
(0, _jestUtil().createDirectory)(config.cacheDirectory);
const hasteMapInstance = _jestRuntime().default.createHasteMap(
config,
{
console: new (_console()).CustomConsole(
outputStream,
outputStream
),
maxWorkers: globalConfig.maxWorkers,
resetCache: !config.cache,
watch: globalConfig.watch || globalConfig.watchAll,
watchman: globalConfig.watchman
}
);
hasteMapInstances[index] = hasteMapInstance;
return (0,
_create_context.default)(config, yield hasteMapInstance.build());
});
return function(_x6, _x7) {
return _ref3.apply(this, arguments);
};
})()
)
);
return {
contexts,
hasteMapInstances
};
});
outputStream,
onComplete,
changedFilesPromise,
filter
);
};
return function buildContextsAndHasteMaps(_x3, _x4, _x5) {
return _ref2.apply(this, arguments);
};
})();
const _run =
/*#__PURE__*/
(function() {
var _ref4 = _asyncToGenerator(function*(
globalConfig,
configs,
hasDeprecationWarnings,
outputStream,
onComplete
) {
// Queries to hg/git can take a while, so we need to start the process
// as soon as possible, so by the time we need the result it's already there.
const changedFilesPromise = (0, _getChangedFilesPromise.default)(
globalConfig,
configs
); // Filter may need to do an HTTP call or something similar to setup.
// We will wait on an async response from this before using the filter.
let filter;
if (globalConfig.filter && !globalConfig.skipFilter) {
const rawFilter = require(globalConfig.filter);
let filterSetupPromise;
if (rawFilter.setup) {
// Wrap filter setup Promise to avoid "uncaught Promise" error.
// If an error is returned, we surface it in the return value.
filterSetupPromise = _asyncToGenerator(function*() {
try {
yield rawFilter.setup();
} catch (err) {
return err;
}
return undefined;
})();
}
filter =
/*#__PURE__*/
(function() {
var _ref6 = _asyncToGenerator(function*(testPaths) {
if (filterSetupPromise) {
// Expect an undefined return value unless there was an error.
const err = yield filterSetupPromise;
if (err) {
throw err;
}
}
return rawFilter(testPaths);
});
return function filter(_x13) {
return _ref6.apply(this, arguments);
};
})();
}
const _ref7 = yield buildContextsAndHasteMaps(
configs,
globalConfig,
outputStream
),
contexts = _ref7.contexts,
hasteMapInstances = _ref7.hasteMapInstances;
globalConfig.watch || globalConfig.watchAll
? yield runWatch(
contexts,
configs,
hasDeprecationWarnings,
globalConfig,
outputStream,
hasteMapInstances,
filter
)
: yield runWithoutWatch(
globalConfig,
contexts,
outputStream,
onComplete,
changedFilesPromise,
filter
);
});
return function _run(_x8, _x9, _x10, _x11, _x12) {
return _ref4.apply(this, arguments);
};
})();
const runWatch =
/*#__PURE__*/
(function() {
var _ref8 = _asyncToGenerator(function*(
contexts,
_configs,
hasDeprecationWarnings,
globalConfig,
outputStream,
hasteMapInstances,
filter
) {
if (hasDeprecationWarnings) {
try {
yield (0, _handle_deprecation_warnings.default)(
outputStream,
process.stdin
);
return (0, _watch.default)(
globalConfig,
contexts,
outputStream,
hasteMapInstances,
undefined,
undefined,
filter
);
} catch (e) {
(0, _exit().default)(0);
}
}
return (0, _watch.default)(
const runWatch = async (
contexts,
_configs,
hasDeprecationWarnings,
globalConfig,
outputStream,
hasteMapInstances,
filter
) => {
if (hasDeprecationWarnings) {
try {
await (0, _handleDeprecationWarnings().default)(
outputStream,
process.stdin
);
return (0, _watch().default)(
globalConfig,
contexts,
outputStream,
@@ -416,56 +447,49 @@ const runWatch =
undefined,
filter
);
});
} catch {
(0, _exit().default)(0);
}
}
return function runWatch(_x14, _x15, _x16, _x17, _x18, _x19, _x20) {
return _ref8.apply(this, arguments);
};
})();
return (0, _watch().default)(
globalConfig,
contexts,
outputStream,
hasteMapInstances,
undefined,
undefined,
filter
);
};
const runWithoutWatch =
/*#__PURE__*/
(function() {
var _ref9 = _asyncToGenerator(function*(
globalConfig,
contexts,
outputStream,
onComplete,
const runWithoutWatch = async (
globalConfig,
contexts,
outputStream,
onComplete,
changedFilesPromise,
filter
) => {
const startRun = async () => {
if (!globalConfig.listTests) {
preRunMessagePrint(outputStream);
}
return (0, _runJest().default)({
changedFilesPromise,
filter
) {
const startRun =
/*#__PURE__*/
(function() {
var _ref10 = _asyncToGenerator(function*() {
if (!globalConfig.listTests) {
preRunMessagePrint(outputStream);
}
return (0, _runJest.default)({
changedFilesPromise,
contexts,
failedTestsCache: undefined,
filter,
globalConfig,
onComplete,
outputStream,
startRun,
testWatcher: new _TestWatcher.default({
isWatchMode: false
})
});
});
return function startRun() {
return _ref10.apply(this, arguments);
};
})();
return startRun();
contexts,
failedTestsCache: undefined,
filter,
globalConfig,
onComplete,
outputStream,
startRun,
testWatcher: new (_TestWatcher().default)({
isWatchMode: false
})
});
};
return function runWithoutWatch(_x21, _x22, _x23, _x24, _x25, _x26) {
return _ref9.apply(this, arguments);
};
})();
return startRun();
};

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
export default function collectHandles(): () => Array<Error>;
export declare function formatHandleErrors(errors: Array<Error>, config: Config.ProjectConfig): Array<string>;
//# sourceMappingURL=collectHandles.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"collectHandles.d.ts","sourceRoot":"","sources":["../src/collectHandles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AA+BnC,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,MAAM,KAAK,CAAC,KAAK,CAAC,CA0C3D;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EACpB,MAAM,EAAE,MAAM,CAAC,aAAa,GAC3B,KAAK,CAAC,MAAM,CAAC,CA8Bf"}

View File

@@ -6,20 +6,10 @@ Object.defineProperty(exports, '__esModule', {
exports.default = collectHandles;
exports.formatHandleErrors = formatHandleErrors;
function _jestMessageUtil() {
const data = require('jest-message-util');
function asyncHooks() {
const data = _interopRequireWildcard(require('async_hooks'));
_jestMessageUtil = function _jestMessageUtil() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
asyncHooks = function () {
return data;
};
@@ -29,7 +19,27 @@ function _jestUtil() {
function _stripAnsi() {
const data = _interopRequireDefault(require('strip-ansi'));
_stripAnsi = function _stripAnsi() {
_stripAnsi = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
@@ -40,12 +50,56 @@ function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable local/ban-types-eventually */
function stackIsFromUser(stack) {
// Either the test file, or something required by it
if (stack.includes('Runtime.requireModule')) {
@@ -64,49 +118,60 @@ function stackIsFromUser(stack) {
}
return false;
} // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js
}
const alwaysActive = () => true; // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js
// Extracted as we want to format the result ourselves
function collectHandles() {
const activeHandles = new Map();
let hook;
const hook = asyncHooks().createHook({
destroy(asyncId) {
activeHandles.delete(asyncId);
},
try {
const asyncHooks = require('async_hooks');
hook = asyncHooks.createHook({
destroy(asyncId) {
activeHandles.delete(asyncId);
},
init: function initHook(asyncId, type) {
if (type === 'PROMISE' || type === 'TIMERWRAP') {
return;
}
const error = new (_jestUtil()).ErrorWithStack(type, initHook);
if (stackIsFromUser(error.stack || '')) {
activeHandles.set(asyncId, error);
}
init: function initHook(asyncId, type, _triggerAsyncId, resource) {
if (
type === 'PROMISE' ||
type === 'TIMERWRAP' ||
type === 'ELDHISTOGRAM'
) {
return;
}
});
hook.enable();
} catch (e) {
const nodeMajor = Number(process.versions.node.split('.')[0]);
if (e.code === 'MODULE_NOT_FOUND' && nodeMajor < 8) {
throw new Error(
'You can only use --detectOpenHandles on Node 8 and newer.'
);
} else {
throw e;
const error = new (_jestUtil().ErrorWithStack)(type, initHook);
if (stackIsFromUser(error.stack || '')) {
let isActive;
if (type === 'Timeout' || type === 'Immediate') {
if ('hasRef' in resource) {
// Timer that supports hasRef (Node v11+)
// @ts-expect-error: doesn't exist in v10 typings
isActive = resource.hasRef.bind(resource);
} else {
// Timer that doesn't support hasRef
isActive = alwaysActive;
}
} else {
// Any other async resource
isActive = alwaysActive;
}
activeHandles.set(asyncId, {
error,
isActive
});
}
}
}
});
hook.enable();
return () => {
hook.disable();
const result = Array.from(activeHandles.values());
hook.disable(); // Get errors for every async resource still referenced at this moment
const result = Array.from(activeHandles.values())
.filter(({isActive}) => isActive())
.map(({error}) => error);
activeHandles.clear();
return result;
};

View File

@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
declare const _default: (globalConfig: Config.GlobalConfig, configs: Config.ProjectConfig[]) => Promise<import("jest-changed-files").ChangedFiles> | undefined;
import type { Config } from '@jest/types';
import { ChangedFilesPromise } from 'jest-changed-files';
declare const _default: (globalConfig: Config.GlobalConfig, configs: Array<Config.ProjectConfig>) => ChangedFilesPromise | undefined;
export default _default;
//# sourceMappingURL=getChangedFilesPromise.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getChangedFilesPromise.d.ts","sourceRoot":"","sources":["../src/getChangedFilesPromise.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;;AAKnC,wBA6BE"}

View File

@@ -5,10 +5,20 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestChangedFiles() {
const data = require('jest-changed-files');
_jestChangedFiles = function _jestChangedFiles() {
_jestChangedFiles = function () {
return data;
};
@@ -18,17 +28,7 @@ function _jestChangedFiles() {
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function _jestMessageUtil() {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_jestMessageUtil = function () {
return data;
};
@@ -47,10 +47,13 @@ function _interopRequireDefault(obj) {
*/
var _default = (globalConfig, configs) => {
if (globalConfig.onlyChanged) {
const allRootsForAllProjects = configs.reduce(
(roots, config) => [...roots, ...(config.roots || [])],
[]
);
const allRootsForAllProjects = configs.reduce((roots, config) => {
if (config.roots) {
roots.push(...config.roots);
}
return roots;
}, []);
return (0, _jestChangedFiles().getChangedFilesForRoots)(
allRootsForAllProjects,
{
@@ -66,9 +69,7 @@ var _default = (globalConfig, configs) => {
.filter(line => !line.includes('Command failed:'))
.join('\n');
console.error(_chalk().default.red(`\n\n${message}`));
process.exit(1); // We do process.exit, so this is dead code
return Promise.reject(e);
process.exit(1);
});
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Config } from '@jest/types';
export default function getConfigsOfProjectsToRun(namesOfProjectsToRun: Array<string>, projectConfigs: Array<Config.ProjectConfig>): Array<Config.ProjectConfig>;

View File

@@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getConfigsOfProjectsToRun;
var _getProjectDisplayName = _interopRequireDefault(
require('./getProjectDisplayName')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getConfigsOfProjectsToRun(namesOfProjectsToRun, projectConfigs) {
const setOfProjectsToRun = new Set(namesOfProjectsToRun);
return projectConfigs.filter(config => {
const name = (0, _getProjectDisplayName.default)(config);
return name && setOfProjectsToRun.has(name);
});
}

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { TestRunData } from './types';
import type { Config } from '@jest/types';
import type { TestRunData } from './types';
export default function getNoTestFound(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string;
//# sourceMappingURL=getNoTestFound.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getNoTestFound.d.ts","sourceRoot":"","sources":["../src/getNoTestFound.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAGpC,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,CAAC,YAAY,GAChC,MAAM,CAgCR"}

View File

@@ -8,7 +8,7 @@ exports.default = getNoTestFound;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};

View File

@@ -4,5 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export default function getNoTestFoundFailed(): string;
//# sourceMappingURL=getNoTestFoundFailed.d.ts.map
import type { Config } from '@jest/types';
export default function getNoTestFoundFailed(globalConfig: Config.GlobalConfig): string;

View File

@@ -1 +0,0 @@
{"version":3,"file":"getNoTestFoundFailed.d.ts","sourceRoot":"","sources":["../src/getNoTestFoundFailed.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,CAAC,OAAO,UAAU,oBAAoB,WAK3C"}

View File

@@ -8,7 +8,17 @@ exports.default = getNoTestFoundFailed;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
@@ -25,9 +35,17 @@ function _interopRequireDefault(obj) {
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getNoTestFoundFailed() {
return (
_chalk().default.bold('No failed test found.\n') +
_chalk().default.dim('Press `f` to quit "only failed tests" mode.')
);
function getNoTestFoundFailed(globalConfig) {
let msg = _chalk().default.bold('No failed test found.');
if (_jestUtil().isInteractive) {
msg += _chalk().default.dim(
'\n' +
(globalConfig.watch
? 'Press `f` to quit "only failed tests" mode.'
: 'Run Jest without `--onlyFailures` or with `--all` to run all tests.')
);
}
return msg;
}

View File

@@ -5,4 +5,3 @@
* LICENSE file in the root directory of this source tree.
*/
export default function getNoTestFoundPassWithNoTests(): string;
//# sourceMappingURL=getNoTestFoundPassWithNoTests.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getNoTestFoundPassWithNoTests.d.ts","sourceRoot":"","sources":["../src/getNoTestFoundPassWithNoTests.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,CAAC,OAAO,UAAU,6BAA6B,WAEpD"}

View File

@@ -8,7 +8,7 @@ exports.default = getNoTestFoundPassWithNoTests;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};

View File

@@ -4,6 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
export default function getNoTestFoundRelatedToChangedFiles(globalConfig: Config.GlobalConfig): string;
//# sourceMappingURL=getNoTestFoundRelatedToChangedFiles.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getNoTestFoundRelatedToChangedFiles.d.ts","sourceRoot":"","sources":["../src/getNoTestFoundRelatedToChangedFiles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,MAAM,CAAC,OAAO,UAAU,mCAAmC,CACzD,YAAY,EAAE,MAAM,CAAC,YAAY,UAiBlC"}

View File

@@ -8,7 +8,7 @@ exports.default = getNoTestFoundRelatedToChangedFiles;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -18,7 +18,7 @@ function _chalk() {
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function _jestUtil() {
_jestUtil = function () {
return data;
};

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { TestRunData } from './types';
import type { Config } from '@jest/types';
import type { TestRunData } from './types';
export default function getNoTestFoundVerbose(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string;
//# sourceMappingURL=getNoTestFoundVerbose.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getNoTestFoundVerbose.d.ts","sourceRoot":"","sources":["../src/getNoTestFoundVerbose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAQ,WAAW,EAAC,MAAM,SAAS,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,CAAC,YAAY,GAChC,MAAM,CAqDR"}

View File

@@ -8,7 +8,7 @@ exports.default = getNoTestFoundVerbose;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { TestRunData } from './types';
import type { Config } from '@jest/types';
import type { TestRunData } from './types';
export default function getNoTestsFoundMessage(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string;
//# sourceMappingURL=getNoTestsFoundMessage.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"getNoTestsFoundMessage.d.ts","sourceRoot":"","sources":["../src/getNoTestsFoundMessage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAOpC,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,CAAC,YAAY,GAChC,MAAM,CAaR"}

View File

@@ -7,14 +7,6 @@ exports.default = getNoTestsFoundMessage;
var _getNoTestFound = _interopRequireDefault(require('./getNoTestFound'));
var _getNoTestFoundRelatedToChangedFiles = _interopRequireDefault(
require('./getNoTestFoundRelatedToChangedFiles')
);
var _getNoTestFoundVerbose = _interopRequireDefault(
require('./getNoTestFoundVerbose')
);
var _getNoTestFoundFailed = _interopRequireDefault(
require('./getNoTestFoundFailed')
);
@@ -23,6 +15,14 @@ var _getNoTestFoundPassWithNoTests = _interopRequireDefault(
require('./getNoTestFoundPassWithNoTests')
);
var _getNoTestFoundRelatedToChangedFiles = _interopRequireDefault(
require('./getNoTestFoundRelatedToChangedFiles')
);
var _getNoTestFoundVerbose = _interopRequireDefault(
require('./getNoTestFoundVerbose')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
@@ -35,7 +35,7 @@ function _interopRequireDefault(obj) {
*/
function getNoTestsFoundMessage(testRunData, globalConfig) {
if (globalConfig.onlyFailures) {
return (0, _getNoTestFoundFailed.default)();
return (0, _getNoTestFoundFailed.default)(globalConfig);
}
if (globalConfig.onlyChanged) {

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Config } from '@jest/types';
export default function getProjectDisplayName(projectConfig: Config.ProjectConfig): string | undefined;

22
node_modules/@jest/core/build/getProjectDisplayName.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getProjectDisplayName;
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getProjectDisplayName(projectConfig) {
const {displayName} = projectConfig;
if (!displayName) {
return undefined;
}
return displayName.name;
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Config } from '@jest/types';
export default function getProjectNamesMissingWarning(projectConfigs: Array<Config.ProjectConfig>): string | undefined;

View File

@@ -0,0 +1,49 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getProjectNamesMissingWarning;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _getProjectDisplayName = _interopRequireDefault(
require('./getProjectDisplayName')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getProjectNamesMissingWarning(projectConfigs) {
const numberOfProjectsWithoutAName = projectConfigs.filter(
config => !(0, _getProjectDisplayName.default)(config)
).length;
if (numberOfProjectsWithoutAName === 0) {
return undefined;
}
return _chalk().default.yellow(
`You provided values for --selectProjects but ${
numberOfProjectsWithoutAName === 1
? 'a project does not have a name'
: `${numberOfProjectsWithoutAName} projects do not have a name`
}.\n` +
'Set displayName in the config of all projects in order to disable this warning.\n'
);
}

View File

@@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Config } from '@jest/types';
export default function getSelectProjectsMessage(projectConfigs: Array<Config.ProjectConfig>): string;

View File

@@ -0,0 +1,65 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = getSelectProjectsMessage;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _getProjectDisplayName = _interopRequireDefault(
require('./getProjectDisplayName')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getSelectProjectsMessage(projectConfigs) {
if (projectConfigs.length === 0) {
return getNoSelectionWarning();
}
return getProjectsRunningMessage(projectConfigs);
}
function getNoSelectionWarning() {
return _chalk().default.yellow(
'You provided values for --selectProjects but no projects were found matching the selection.\n'
);
}
function getProjectsRunningMessage(projectConfigs) {
if (projectConfigs.length === 1) {
const name = (0, _getProjectDisplayName.default)(projectConfigs[0]);
return `Running one project: ${_chalk().default.bold(name)}\n`;
}
const projectsList = projectConfigs
.map(getProjectNameListElement)
.sort()
.join('\n');
return `Running ${projectConfigs.length} projects:\n${projectsList}\n`;
}
function getProjectNameListElement(projectConfig) {
const name = (0, _getProjectDisplayName.default)(projectConfig);
const elementContent = name
? _chalk().default.bold(name)
: '<unnamed project>';
return `- ${elementContent}`;
}

View File

@@ -9,4 +9,3 @@ export { default as TestScheduler } from './TestScheduler';
export { default as TestWatcher } from './TestWatcher';
export { runCLI } from './cli';
export { default as getVersion } from './version';
//# sourceMappingURL=jest.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"jest.d.ts","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,MAAM,EAAC,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,WAAW,CAAC"}

View File

@@ -5,31 +5,31 @@ Object.defineProperty(exports, '__esModule', {
});
Object.defineProperty(exports, 'SearchSource', {
enumerable: true,
get: function get() {
get: function () {
return _SearchSource.default;
}
});
Object.defineProperty(exports, 'TestScheduler', {
enumerable: true,
get: function get() {
get: function () {
return _TestScheduler.default;
}
});
Object.defineProperty(exports, 'TestWatcher', {
enumerable: true,
get: function get() {
get: function () {
return _TestWatcher.default;
}
});
Object.defineProperty(exports, 'runCLI', {
enumerable: true,
get: function get() {
get: function () {
return _cli.runCLI;
}
});
Object.defineProperty(exports, 'getVersion', {
enumerable: true,
get: function get() {
get: function () {
return _version.default;
}
});

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
declare const activeFilters: (globalConfig: Config.GlobalConfig, delimiter?: string) => string;
export default activeFilters;
//# sourceMappingURL=active_filters_message.d.ts.map

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -26,8 +26,7 @@ function _interopRequireDefault(obj) {
* LICENSE file in the root directory of this source tree.
*/
const activeFilters = (globalConfig, delimiter = '\n') => {
const testNamePattern = globalConfig.testNamePattern,
testPathPattern = globalConfig.testPathPattern;
const {testNamePattern, testPathPattern} = globalConfig;
if (testNamePattern || testPathPattern) {
const filters = [

View File

@@ -1 +0,0 @@
{"version":3,"file":"active_filters_message.d.ts","sourceRoot":"","sources":["../../src/lib/active_filters_message.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,QAAA,MAAM,aAAa,mEAuBlB,CAAC;AAEF,eAAe,aAAa,CAAC"}

View File

@@ -4,7 +4,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
declare const _default: (config: Config.ProjectConfig, { hasteFS, moduleMap }: import("jest-haste-map/build/types").HasteMap) => import("jest-runtime/build/types").Context;
import type { Config } from '@jest/types';
import type { HasteMapObject } from 'jest-haste-map';
import Runtime = require('jest-runtime');
declare const _default: (config: Config.ProjectConfig, { hasteFS, moduleMap }: HasteMapObject) => Runtime.Context;
export default _default;
//# sourceMappingURL=create_context.d.ts.map

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _jestRuntime() {
const data = _interopRequireDefault(require('jest-runtime'));
_jestRuntime = function _jestRuntime() {
_jestRuntime = function () {
return data;
};

View File

@@ -1 +0,0 @@
{"version":3,"file":"create_context.d.ts","sourceRoot":"","sources":["../../src/lib/create_context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;;AAInC,wBAQG"}

View File

@@ -7,4 +7,3 @@
/// <reference types="node" />
declare const _default: (pipe: NodeJS.WriteStream, stdin?: NodeJS.ReadStream) => Promise<void>;
export default _default;
//# sourceMappingURL=handle_deprecation_warnings.d.ts.map

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -18,7 +18,7 @@ function _chalk() {
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};
@@ -50,7 +50,8 @@ var _default = (pipe, stdin = process.stdin) =>
pipe.write(messages.join('\n'));
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8');
stdin.setEncoding('utf8'); // this is a string since we set encoding above
stdin.on('data', key => {
if (key === _jestWatcher().KEYS.ENTER) {
resolve();

View File

@@ -1 +0,0 @@
{"version":3,"file":"handle_deprecation_warnings.d.ts","sourceRoot":"","sources":["../../src/lib/handle_deprecation_warnings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;AAKH,wBA6BK"}

View File

@@ -4,6 +4,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
export default function isValidPath(globalConfig: Config.GlobalConfig, filePath: Config.Path): boolean;
//# sourceMappingURL=is_valid_path.d.ts.map

View File

@@ -8,7 +8,7 @@ exports.default = isValidPath;
function _jestSnapshot() {
const data = require('jest-snapshot');
_jestSnapshot = function _jestSnapshot() {
_jestSnapshot = function () {
return data;
};

View File

@@ -1 +0,0 @@
{"version":3,"file":"is_valid_path.d.ts","sourceRoot":"","sources":["../../src/lib/is_valid_path.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,QAAQ,EAAE,MAAM,CAAC,IAAI,WAMtB"}

View File

@@ -5,6 +5,5 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import type { Config } from '@jest/types';
export default function logDebugMessages(globalConfig: Config.GlobalConfig, configs: Array<Config.ProjectConfig> | Config.ProjectConfig, outputStream: NodeJS.WriteStream): void;
//# sourceMappingURL=log_debug_messages.d.ts.map

View File

@@ -11,7 +11,7 @@ exports.default = logDebugMessages;
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const VERSION = require('../../package.json').version;
const VERSION = require('../../package.json').version; // if the output here changes, update `getConfig` in e2e/runJest.ts
function logDebugMessages(globalConfig, configs, outputStream) {
const output = {

View File

@@ -1 +0,0 @@
{"version":3,"file":"log_debug_messages.d.ts","sourceRoot":"","sources":["../../src/lib/log_debug_messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,aAAa,EAC3D,YAAY,EAAE,MAAM,CAAC,WAAW,GAC/B,IAAI,CAON"}

View File

@@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Config } from '@jest/types';
import type { AllowedConfigOptions } from 'jest-watcher';
declare type ExtraConfigOptions = Partial<Pick<Config.GlobalConfig, 'noSCM' | 'passWithNoTests'>>;
declare const _default: (globalConfig: Config.GlobalConfig, options?: AllowedConfigOptions & ExtraConfigOptions) => Config.GlobalConfig;
export default _default;

View File

@@ -8,47 +8,21 @@ exports.default = void 0;
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function _jestRegexUtil() {
_jestRegexUtil = function () {
return data;
};
return data;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var _default = (globalConfig, options = {}) => {
const newConfig = _objectSpread({}, globalConfig);
const newConfig = {...globalConfig};
if (options.mode === 'watch') {
newConfig.watch = true;
@@ -104,6 +78,14 @@ var _default = (globalConfig, options = {}) => {
newConfig.coverageReporters = options.coverageReporters;
}
if (options.findRelatedTests !== undefined) {
newConfig.findRelatedTests = options.findRelatedTests;
}
if (options.nonFlagArgs !== undefined) {
newConfig.nonFlagArgs = options.nonFlagArgs;
}
if (options.noSCM) {
newConfig.noSCM = true;
}

View File

@@ -1,12 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
declare const _default: (globalConfig: Config.GlobalConfig, options?: Partial<Pick<Config.GlobalConfig, "bail" | "changedSince" | "collectCoverage" | "collectCoverageFrom" | "collectCoverageOnlyFrom" | "coverageDirectory" | "coverageReporters" | "notify" | "notifyMode" | "onlyFailures" | "reporters" | "testNamePattern" | "testPathPattern" | "updateSnapshot" | "verbose"> & {
mode: "watch" | "watchAll";
}> & Partial<Pick<Config.GlobalConfig, "noSCM" | "passWithNoTests">>) => Config.GlobalConfig;
export default _default;
//# sourceMappingURL=update_global_config.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"update_global_config.d.ts","sourceRoot":"","sources":["../../src/lib/update_global_config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;;;;AAOnC,wBA4FE"}

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { Config } from '@jest/types';
import type { UsageData, WatchPlugin } from 'jest-watcher';
export declare const filterInteractivePlugins: (watchPlugins: Array<WatchPlugin>, globalConfig: Config.GlobalConfig) => Array<WatchPlugin>;
export declare const getSortedUsageRows: (watchPlugins: Array<WatchPlugin>, globalConfig: Config.GlobalConfig) => Array<UsageData>;

View File

@@ -19,7 +19,7 @@ const filterInteractivePlugins = (watchPlugins, globalConfig) => {
const usageInfo = usageInfos[i];
if (usageInfo) {
const key = usageInfo.key;
const {key} = usageInfo;
return !usageInfos.slice(i + 1).some(u => !!u && key === u.key);
}

View File

@@ -1,11 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { WatchPlugin, UsageData } from 'jest-watcher';
export declare const filterInteractivePlugins: (watchPlugins: WatchPlugin[], globalConfig: Config.GlobalConfig) => WatchPlugin[];
export declare const getSortedUsageRows: (watchPlugins: WatchPlugin[], globalConfig: Config.GlobalConfig) => UsageData[];
//# sourceMappingURL=watch_plugins_helpers.d.ts.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"watch_plugins_helpers.d.ts","sourceRoot":"","sources":["../../src/lib/watch_plugins_helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,wBAAwB,mFAiBpC,CAAC;AAMF,eAAO,MAAM,kBAAkB,iFAyBV,CAAC"}

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { BaseWatchPlugin } from 'jest-watcher';
import { BaseWatchPlugin, UsageData } from 'jest-watcher';
declare class QuitPlugin extends BaseWatchPlugin {
isInternal: true;
constructor(options: {
@@ -13,10 +13,6 @@ declare class QuitPlugin extends BaseWatchPlugin {
stdout: NodeJS.WriteStream;
});
run(): Promise<void>;
getUsageInfo(): {
key: string;
prompt: string;
};
getUsageInfo(): UsageData;
}
export default QuitPlugin;
//# sourceMappingURL=quit.d.ts.map

60
node_modules/@jest/core/build/plugins/Quit.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function () {
return data;
};
return data;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class QuitPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, 'isInternal', void 0);
this.isInternal = true;
}
async run() {
if (typeof this._stdin.setRawMode === 'function') {
this._stdin.setRawMode(false);
}
this._stdout.write('\n');
process.exit(0);
}
getUsageInfo() {
return {
key: 'q',
prompt: 'quit watch mode'
};
}
}
var _default = QuitPlugin;
exports.default = _default;

View File

@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import { BaseWatchPlugin, Prompt, UpdateConfigCallback } from 'jest-watcher';
import type { Config } from '@jest/types';
import { BaseWatchPlugin, Prompt, UpdateConfigCallback, UsageData } from 'jest-watcher';
declare class TestNamePatternPlugin extends BaseWatchPlugin {
_prompt: Prompt;
isInternal: true;
@@ -14,12 +14,8 @@ declare class TestNamePatternPlugin extends BaseWatchPlugin {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
getUsageInfo(): {
key: string;
prompt: string;
};
getUsageInfo(): UsageData;
onKey(key: string): void;
run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>;
}
export default TestNamePatternPlugin;
//# sourceMappingURL=test_name_pattern.d.ts.map

View File

@@ -8,20 +8,32 @@ exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};
return data;
}
var _TestNamePatternPrompt = _interopRequireDefault(
require('../TestNamePatternPrompt')
);
function _TestNamePatternPrompt() {
const data = _interopRequireDefault(require('../TestNamePatternPrompt'));
var _active_filters_message = _interopRequireDefault(
require('../lib/active_filters_message')
);
_TestNamePatternPrompt = function () {
return data;
};
return data;
}
function _activeFiltersMessage() {
const data = _interopRequireDefault(require('../lib/activeFiltersMessage'));
_activeFiltersMessage = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
@@ -49,7 +61,7 @@ class TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin {
_defineProperty(this, 'isInternal', void 0);
this._prompt = new (_jestWatcher()).Prompt();
this._prompt = new (_jestWatcher().Prompt)();
this.isInternal = true;
}
@@ -66,7 +78,7 @@ class TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin {
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testNamePatternPrompt = new _TestNamePatternPrompt.default(
const testNamePatternPrompt = new (_TestNamePatternPrompt().default)(
this._stdout,
this._prompt
);
@@ -80,7 +92,7 @@ class TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin {
},
rej,
{
header: (0, _active_filters_message.default)(globalConfig)
header: (0, _activeFiltersMessage().default)(globalConfig)
}
);
});

View File

@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import { BaseWatchPlugin, UpdateConfigCallback } from 'jest-watcher';
import type { Config } from '@jest/types';
import { BaseWatchPlugin, UpdateConfigCallback, UsageData } from 'jest-watcher';
declare class TestPathPatternPlugin extends BaseWatchPlugin {
private _prompt;
isInternal: true;
@@ -14,12 +14,8 @@ declare class TestPathPatternPlugin extends BaseWatchPlugin {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
getUsageInfo(): {
key: string;
prompt: string;
};
getUsageInfo(): UsageData;
onKey(key: string): void;
run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>;
}
export default TestPathPatternPlugin;
//# sourceMappingURL=test_path_pattern.d.ts.map

View File

@@ -8,20 +8,32 @@ exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};
return data;
}
var _TestPathPatternPrompt = _interopRequireDefault(
require('../TestPathPatternPrompt')
);
function _TestPathPatternPrompt() {
const data = _interopRequireDefault(require('../TestPathPatternPrompt'));
var _active_filters_message = _interopRequireDefault(
require('../lib/active_filters_message')
);
_TestPathPatternPrompt = function () {
return data;
};
return data;
}
function _activeFiltersMessage() {
const data = _interopRequireDefault(require('../lib/activeFiltersMessage'));
_activeFiltersMessage = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
@@ -49,7 +61,7 @@ class TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin {
_defineProperty(this, 'isInternal', void 0);
this._prompt = new (_jestWatcher()).Prompt();
this._prompt = new (_jestWatcher().Prompt)();
this.isInternal = true;
}
@@ -66,7 +78,7 @@ class TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin {
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testPathPatternPrompt = new _TestPathPatternPrompt.default(
const testPathPatternPrompt = new (_TestPathPatternPrompt().default)(
this._stdout,
this._prompt
);
@@ -80,7 +92,7 @@ class TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin {
},
rej,
{
header: (0, _active_filters_message.default)(globalConfig)
header: (0, _activeFiltersMessage().default)(globalConfig)
}
);
});

View File

@@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback } from 'jest-watcher';
import type { Config } from '@jest/types';
import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback, UsageData } from 'jest-watcher';
declare class UpdateSnapshotsPlugin extends BaseWatchPlugin {
private _hasSnapshotFailure;
isInternal: true;
@@ -16,10 +16,6 @@ declare class UpdateSnapshotsPlugin extends BaseWatchPlugin {
});
run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<boolean>;
apply(hooks: JestHookSubscriber): void;
getUsageInfo(): {
key: string;
prompt: string;
} | null;
getUsageInfo(): UsageData | null;
}
export default UpdateSnapshotsPlugin;
//# sourceMappingURL=update_snapshots.d.ts.map

View File

@@ -8,7 +8,7 @@ exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};

View File

@@ -4,9 +4,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { AggregatedResult, AssertionLocation } from '@jest/test-result';
import { BaseWatchPlugin, JestHookSubscriber } from 'jest-watcher';
import type { AggregatedResult, AssertionLocation } from '@jest/test-result';
import type { Config } from '@jest/types';
import { BaseWatchPlugin, JestHookSubscriber, UsageData } from 'jest-watcher';
declare class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
private _snapshotInteractiveMode;
private _failedSnapshotTestAssertions;
@@ -15,10 +15,6 @@ declare class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
apply(hooks: JestHookSubscriber): void;
onKey(key: string): void;
run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: Function): Promise<void>;
getUsageInfo(): {
key: string;
prompt: string;
} | null;
getUsageInfo(): UsageData | null;
}
export default UpdateSnapshotInteractivePlugin;
//# sourceMappingURL=update_snapshots_interactive.d.ts.map

View File

@@ -8,16 +8,22 @@ exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
_jestWatcher = function () {
return data;
};
return data;
}
var _SnapshotInteractiveMode = _interopRequireDefault(
require('../SnapshotInteractiveMode')
);
function _SnapshotInteractiveMode() {
const data = _interopRequireDefault(require('../SnapshotInteractiveMode'));
_SnapshotInteractiveMode = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
@@ -44,7 +50,7 @@ class UpdateSnapshotInteractivePlugin extends _jestWatcher().BaseWatchPlugin {
_defineProperty(
this,
'_snapshotInteractiveMode',
new _SnapshotInteractiveMode.default(this._stdout)
new (_SnapshotInteractiveMode().default)(this._stdout)
);
_defineProperty(this, '_failedSnapshotTestAssertions', []);
@@ -117,9 +123,13 @@ class UpdateSnapshotInteractivePlugin extends _jestWatcher().BaseWatchPlugin {
}
getUsageInfo() {
var _this$_failedSnapshot;
if (
this._failedSnapshotTestAssertions &&
this._failedSnapshotTestAssertions.length > 0
((_this$_failedSnapshot = this._failedSnapshotTestAssertions) === null ||
_this$_failedSnapshot === void 0
? void 0
: _this$_failedSnapshot.length) > 0
) {
return {
key: 'i',

View File

@@ -1 +0,0 @@
{"version":3,"file":"quit.d.ts","sourceRoot":"","sources":["../../src/plugins/quit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,cAAM,UAAW,SAAQ,eAAe;IACtC,UAAU,EAAE,IAAI,CAAC;gBAEL,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAA;KAAC;IAKrE,GAAG;IAQT,YAAY;;;;CAMb;AAED,eAAe,UAAU,CAAC"}

View File

@@ -1,96 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _jestWatcher() {
const data = require('jest-watcher');
_jestWatcher = function _jestWatcher() {
return data;
};
return data;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this,
args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'next', value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, 'throw', err);
}
_next(undefined);
});
};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class QuitPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, 'isInternal', void 0);
this.isInternal = true;
}
run() {
var _this = this;
return _asyncToGenerator(function*() {
if (typeof _this._stdin.setRawMode === 'function') {
_this._stdin.setRawMode(false);
}
_this._stdout.write('\n');
process.exit(0);
})();
}
getUsageInfo() {
return {
key: 'q',
prompt: 'quit watch mode'
};
}
}
var _default = QuitPlugin;
exports.default = _default;

View File

@@ -1 +0,0 @@
{"version":3,"file":"test_name_pattern.d.ts","sourceRoot":"","sources":["../../src/plugins/test_name_pattern.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,eAAe,EAAE,MAAM,EAAE,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAI3E,cAAM,qBAAsB,SAAQ,eAAe;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;gBAEL,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAA;KAAC;IAM3E,YAAY;;;;IAOZ,KAAK,CAAC,GAAG,EAAE,MAAM;IAIjB,GAAG,CACD,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,kBAAkB,EAAE,oBAAoB,GACvC,OAAO,CAAC,IAAI,CAAC;CAmBjB;AAED,eAAe,qBAAqB,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"test_path_pattern.d.ts","sourceRoot":"","sources":["../../src/plugins/test_path_pattern.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,eAAe,EAAU,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAI3E,cAAM,qBAAsB,SAAQ,eAAe;IACjD,OAAO,CAAC,OAAO,CAAS;IACxB,UAAU,EAAE,IAAI,CAAC;gBAEL,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAA;KAAC;IAM3E,YAAY;;;;IAOZ,KAAK,CAAC,GAAG,EAAE,MAAM;IAIjB,GAAG,CACD,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,kBAAkB,EAAE,oBAAoB,GACvC,OAAO,CAAC,IAAI,CAAC;CAmBjB;AAED,eAAe,qBAAqB,CAAC"}

View File

@@ -1 +0,0 @@
{"version":3,"file":"update_snapshots.d.ts","sourceRoot":"","sources":["../../src/plugins/update_snapshots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,cAAM,qBAAsB,SAAQ,eAAe;IACjD,OAAO,CAAC,mBAAmB,CAAU;IACrC,UAAU,EAAE,IAAI,CAAC;gBAEL,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAA;KAAC;IAM3E,GAAG,CACD,aAAa,EAAE,MAAM,CAAC,YAAY,EAClC,kBAAkB,EAAE,oBAAoB,GACvC,OAAO,CAAC,OAAO,CAAC;IAKnB,KAAK,CAAC,KAAK,EAAE,kBAAkB;IAM/B,YAAY;;;;CAUb;AAED,eAAe,qBAAqB,CAAC"}

Some files were not shown because too many files have changed in this diff Show More