This commit is contained in:
eric sciple 2020-01-24 12:20:47 -05:00
parent a004f0ae58
commit fc725ba36b
7280 changed files with 19 additions and 1796407 deletions

View file

@ -1,22 +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.
*/
/// <reference types="node" />
import { BaseWatchPlugin } from 'jest-watcher';
declare class QuitPlugin extends BaseWatchPlugin {
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
run(): Promise<void>;
getUsageInfo(): {
key: string;
prompt: string;
};
}
export default QuitPlugin;
//# sourceMappingURL=quit.d.ts.map

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,25 +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.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import { BaseWatchPlugin, Prompt, UpdateConfigCallback } from 'jest-watcher';
declare class TestNamePatternPlugin extends BaseWatchPlugin {
_prompt: Prompt;
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
getUsageInfo(): {
key: string;
prompt: string;
};
onKey(key: string): void;
run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>;
}
export default TestNamePatternPlugin;
//# sourceMappingURL=test_name_pattern.d.ts.map

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,91 +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;
}
var _TestNamePatternPrompt = _interopRequireDefault(
require('../TestNamePatternPrompt')
);
var _active_filters_message = _interopRequireDefault(
require('../lib/active_filters_message')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
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 TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, '_prompt', void 0);
_defineProperty(this, 'isInternal', void 0);
this._prompt = new (_jestWatcher()).Prompt();
this.isInternal = true;
}
getUsageInfo() {
return {
key: 't',
prompt: 'filter by a test name regex pattern'
};
}
onKey(key) {
this._prompt.put(key);
}
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testNamePatternPrompt = new _TestNamePatternPrompt.default(
this._stdout,
this._prompt
);
testNamePatternPrompt.run(
value => {
updateConfigAndRun({
mode: 'watch',
testNamePattern: value
});
res();
},
rej,
{
header: (0, _active_filters_message.default)(globalConfig)
}
);
});
}
}
var _default = TestNamePatternPlugin;
exports.default = _default;

View file

@ -1,25 +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.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import { BaseWatchPlugin, UpdateConfigCallback } from 'jest-watcher';
declare class TestPathPatternPlugin extends BaseWatchPlugin {
private _prompt;
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
getUsageInfo(): {
key: string;
prompt: string;
};
onKey(key: string): void;
run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>;
}
export default TestPathPatternPlugin;
//# sourceMappingURL=test_path_pattern.d.ts.map

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,91 +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;
}
var _TestPathPatternPrompt = _interopRequireDefault(
require('../TestPathPatternPrompt')
);
var _active_filters_message = _interopRequireDefault(
require('../lib/active_filters_message')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
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 TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, '_prompt', void 0);
_defineProperty(this, 'isInternal', void 0);
this._prompt = new (_jestWatcher()).Prompt();
this.isInternal = true;
}
getUsageInfo() {
return {
key: 'p',
prompt: 'filter by a filename regex pattern'
};
}
onKey(key) {
this._prompt.put(key);
}
run(globalConfig, updateConfigAndRun) {
return new Promise((res, rej) => {
const testPathPatternPrompt = new _TestPathPatternPrompt.default(
this._stdout,
this._prompt
);
testPathPatternPrompt.run(
value => {
updateConfigAndRun({
mode: 'watch',
testPathPattern: value
});
res();
},
rej,
{
header: (0, _active_filters_message.default)(globalConfig)
}
);
});
}
}
var _default = TestPathPatternPlugin;
exports.default = _default;

View file

@ -1,25 +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.
*/
/// <reference types="node" />
import { Config } from '@jest/types';
import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback } from 'jest-watcher';
declare class UpdateSnapshotsPlugin extends BaseWatchPlugin {
private _hasSnapshotFailure;
isInternal: true;
constructor(options: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<boolean>;
apply(hooks: JestHookSubscriber): void;
getUsageInfo(): {
key: string;
prompt: string;
} | null;
}
export default UpdateSnapshotsPlugin;
//# sourceMappingURL=update_snapshots.d.ts.map

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"}

View file

@ -1,70 +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 _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 UpdateSnapshotsPlugin extends _jestWatcher().BaseWatchPlugin {
constructor(options) {
super(options);
_defineProperty(this, '_hasSnapshotFailure', void 0);
_defineProperty(this, 'isInternal', void 0);
this.isInternal = true;
this._hasSnapshotFailure = false;
}
run(_globalConfig, updateConfigAndRun) {
updateConfigAndRun({
updateSnapshot: 'all'
});
return Promise.resolve(false);
}
apply(hooks) {
hooks.onTestRunComplete(results => {
this._hasSnapshotFailure = results.snapshot.failure;
});
}
getUsageInfo() {
if (this._hasSnapshotFailure) {
return {
key: 'u',
prompt: 'update failing snapshots'
};
}
return null;
}
}
var _default = UpdateSnapshotsPlugin;
exports.default = _default;

View file

@ -1,24 +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 { AggregatedResult, AssertionLocation } from '@jest/test-result';
import { BaseWatchPlugin, JestHookSubscriber } from 'jest-watcher';
declare class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
private _snapshotInteractiveMode;
private _failedSnapshotTestAssertions;
isInternal: true;
getFailedSnapshotTestAssertions(testResults: AggregatedResult): Array<AssertionLocation>;
apply(hooks: JestHookSubscriber): void;
onKey(key: string): void;
run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: Function): Promise<void>;
getUsageInfo(): {
key: string;
prompt: string;
} | null;
}
export default UpdateSnapshotInteractivePlugin;
//# sourceMappingURL=update_snapshots_interactive.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"update_snapshots_interactive.d.ts","sourceRoot":"","sources":["../../src/plugins/update_snapshots_interactive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAGjE,cAAM,+BAAgC,SAAQ,eAAe;IAC3D,OAAO,CAAC,wBAAwB,CAE9B;IACF,OAAO,CAAC,6BAA6B,CAAgC;IACrE,UAAU,EAAE,IAAI,CAAQ;IAExB,+BAA+B,CAC7B,WAAW,EAAE,gBAAgB,GAC5B,KAAK,CAAC,iBAAiB,CAAC;IAsB3B,KAAK,CAAC,KAAK,EAAE,kBAAkB;IAW/B,KAAK,CAAC,GAAG,EAAE,MAAM;IAMjB,GAAG,CACD,aAAa,EAAE,MAAM,CAAC,YAAY,EAClC,kBAAkB,EAAE,QAAQ,GAC3B,OAAO,CAAC,IAAI,CAAC;IAwBhB,YAAY;;;;CAab;AAED,eAAe,+BAA+B,CAAC"}

View file

@ -1,135 +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;
}
var _SnapshotInteractiveMode = _interopRequireDefault(
require('../SnapshotInteractiveMode')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
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 UpdateSnapshotInteractivePlugin extends _jestWatcher().BaseWatchPlugin {
constructor(...args) {
super(...args);
_defineProperty(
this,
'_snapshotInteractiveMode',
new _SnapshotInteractiveMode.default(this._stdout)
);
_defineProperty(this, '_failedSnapshotTestAssertions', []);
_defineProperty(this, 'isInternal', true);
}
getFailedSnapshotTestAssertions(testResults) {
const failedTestPaths = [];
if (testResults.numFailedTests === 0 || !testResults.testResults) {
return failedTestPaths;
}
testResults.testResults.forEach(testResult => {
if (testResult.snapshot && testResult.snapshot.unmatched) {
testResult.testResults.forEach(result => {
if (result.status === 'failed') {
failedTestPaths.push({
fullName: result.fullName,
path: testResult.testFilePath
});
}
});
}
});
return failedTestPaths;
}
apply(hooks) {
hooks.onTestRunComplete(results => {
this._failedSnapshotTestAssertions = this.getFailedSnapshotTestAssertions(
results
);
if (this._snapshotInteractiveMode.isActive()) {
this._snapshotInteractiveMode.updateWithResults(results);
}
});
}
onKey(key) {
if (this._snapshotInteractiveMode.isActive()) {
this._snapshotInteractiveMode.put(key);
}
}
run(_globalConfig, updateConfigAndRun) {
if (this._failedSnapshotTestAssertions.length) {
return new Promise(res => {
this._snapshotInteractiveMode.run(
this._failedSnapshotTestAssertions,
(assertion, shouldUpdateSnapshot) => {
updateConfigAndRun({
mode: 'watch',
testNamePattern: assertion ? `^${assertion.fullName}$` : '',
testPathPattern: assertion ? assertion.path : '',
updateSnapshot: shouldUpdateSnapshot ? 'all' : 'none'
});
if (!this._snapshotInteractiveMode.isActive()) {
res();
}
}
);
});
} else {
return Promise.resolve();
}
}
getUsageInfo() {
if (
this._failedSnapshotTestAssertions &&
this._failedSnapshotTestAssertions.length > 0
) {
return {
key: 'i',
prompt: 'update failing snapshots interactively'
};
}
return null;
}
}
var _default = UpdateSnapshotInteractivePlugin;
exports.default = _default;