diff options
author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
commit | 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch) | |
tree | 360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/@jest/core/build/plugins | |
parent | b500a50f1b97d93c98b36ed9a980f8188d648147 (diff) | |
download | LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip |
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/@jest/core/build/plugins')
12 files changed, 703 insertions, 0 deletions
diff --git a/node_modules/@jest/core/build/plugins/FailedTestsInteractive.d.ts b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.d.ts new file mode 100644 index 0000000..d696181 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.d.ts @@ -0,0 +1,17 @@ +/** + * 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 { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback, UsageData } from 'jest-watcher'; +export default class FailedTestsInteractivePlugin extends BaseWatchPlugin { + private _failedTestAssertions?; + private readonly _manager; + apply(hooks: JestHookSubscriber): void; + getUsageInfo(): UsageData | null; + onKey(key: string): void; + run(_: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>; + private getFailedTestAssertions; +} diff --git a/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js new file mode 100644 index 0000000..a830abe --- /dev/null +++ b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js @@ -0,0 +1,135 @@ +'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; +} + +var _FailedTestsInteractiveMode = _interopRequireDefault( + require('../FailedTestsInteractiveMode') +); + +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 FailedTestsInteractivePlugin extends _jestWatcher().BaseWatchPlugin { + constructor(...args) { + super(...args); + + _defineProperty(this, '_failedTestAssertions', void 0); + + _defineProperty( + this, + '_manager', + new _FailedTestsInteractiveMode.default(this._stdout) + ); + } + + apply(hooks) { + hooks.onTestRunComplete(results => { + this._failedTestAssertions = this.getFailedTestAssertions(results); + if (this._manager.isActive()) this._manager.updateWithResults(results); + }); + } + + getUsageInfo() { + var _this$_failedTestAsse; + + if ( + (_this$_failedTestAsse = this._failedTestAssertions) !== null && + _this$_failedTestAsse !== void 0 && + _this$_failedTestAsse.length + ) { + return { + key: 'i', + prompt: 'run failing tests interactively' + }; + } + + return null; + } + + onKey(key) { + if (this._manager.isActive()) { + this._manager.put(key); + } + } + + run(_, updateConfigAndRun) { + return new Promise(resolve => { + if ( + !this._failedTestAssertions || + this._failedTestAssertions.length === 0 + ) { + resolve(); + return; + } + + this._manager.run(this._failedTestAssertions, failure => { + updateConfigAndRun({ + mode: 'watch', + testNamePattern: failure ? `^${failure.fullName}$` : '', + testPathPattern: + (failure === null || failure === void 0 ? void 0 : failure.path) || + '' + }); + + if (!this._manager.isActive()) { + resolve(); + } + }); + }); + } + + getFailedTestAssertions(results) { + const failedTestPaths = []; + + if ( + // skip if no failed tests + results.numFailedTests === 0 || // skip if missing test results + !results.testResults || // skip if unmatched snapshots are present + results.snapshot.unmatched + ) { + return failedTestPaths; + } + + results.testResults.forEach(testResult => { + testResult.testResults.forEach(result => { + if (result.status === 'failed') { + failedTestPaths.push({ + fullName: result.fullName, + path: testResult.testFilePath + }); + } + }); + }); + return failedTestPaths; + } +} + +exports.default = FailedTestsInteractivePlugin; diff --git a/node_modules/@jest/core/build/plugins/Quit.d.ts b/node_modules/@jest/core/build/plugins/Quit.d.ts new file mode 100644 index 0000000..e865612 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/Quit.d.ts @@ -0,0 +1,18 @@ +/** + * 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, UsageData } from 'jest-watcher'; +declare class QuitPlugin extends BaseWatchPlugin { + isInternal: true; + constructor(options: { + stdin: NodeJS.ReadStream; + stdout: NodeJS.WriteStream; + }); + run(): Promise<void>; + getUsageInfo(): UsageData; +} +export default QuitPlugin; diff --git a/node_modules/@jest/core/build/plugins/Quit.js b/node_modules/@jest/core/build/plugins/Quit.js new file mode 100644 index 0000000..e643a2b --- /dev/null +++ b/node_modules/@jest/core/build/plugins/Quit.js @@ -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; diff --git a/node_modules/@jest/core/build/plugins/TestNamePattern.d.ts b/node_modules/@jest/core/build/plugins/TestNamePattern.d.ts new file mode 100644 index 0000000..dc0409a --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestNamePattern.d.ts @@ -0,0 +1,21 @@ +/** + * 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 type { Config } from '@jest/types'; +import { BaseWatchPlugin, Prompt, UpdateConfigCallback, UsageData } from 'jest-watcher'; +declare class TestNamePatternPlugin extends BaseWatchPlugin { + _prompt: Prompt; + isInternal: true; + constructor(options: { + stdin: NodeJS.ReadStream; + stdout: NodeJS.WriteStream; + }); + getUsageInfo(): UsageData; + onKey(key: string): void; + run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>; +} +export default TestNamePatternPlugin; diff --git a/node_modules/@jest/core/build/plugins/TestNamePattern.js b/node_modules/@jest/core/build/plugins/TestNamePattern.js new file mode 100644 index 0000000..ac60851 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestNamePattern.js @@ -0,0 +1,91 @@ +'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; +} + +var _TestNamePatternPrompt = _interopRequireDefault( + require('../TestNamePatternPrompt') +); + +var _activeFiltersMessage = _interopRequireDefault( + require('../lib/activeFiltersMessage') +); + +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, _activeFiltersMessage.default)(globalConfig) + } + ); + }); + } +} + +var _default = TestNamePatternPlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/TestPathPattern.d.ts b/node_modules/@jest/core/build/plugins/TestPathPattern.d.ts new file mode 100644 index 0000000..9eefab9 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestPathPattern.d.ts @@ -0,0 +1,21 @@ +/** + * 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 type { Config } from '@jest/types'; +import { BaseWatchPlugin, UpdateConfigCallback, UsageData } from 'jest-watcher'; +declare class TestPathPatternPlugin extends BaseWatchPlugin { + private _prompt; + isInternal: true; + constructor(options: { + stdin: NodeJS.ReadStream; + stdout: NodeJS.WriteStream; + }); + getUsageInfo(): UsageData; + onKey(key: string): void; + run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>; +} +export default TestPathPatternPlugin; diff --git a/node_modules/@jest/core/build/plugins/TestPathPattern.js b/node_modules/@jest/core/build/plugins/TestPathPattern.js new file mode 100644 index 0000000..5c5c4b7 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestPathPattern.js @@ -0,0 +1,91 @@ +'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; +} + +var _TestPathPatternPrompt = _interopRequireDefault( + require('../TestPathPatternPrompt') +); + +var _activeFiltersMessage = _interopRequireDefault( + require('../lib/activeFiltersMessage') +); + +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, _activeFiltersMessage.default)(globalConfig) + } + ); + }); + } +} + +var _default = TestPathPatternPlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshots.d.ts b/node_modules/@jest/core/build/plugins/UpdateSnapshots.d.ts new file mode 100644 index 0000000..3eff4c2 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshots.d.ts @@ -0,0 +1,21 @@ +/** + * 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 type { Config } from '@jest/types'; +import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback, UsageData } 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(): UsageData | null; +} +export default UpdateSnapshotsPlugin; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshots.js b/node_modules/@jest/core/build/plugins/UpdateSnapshots.js new file mode 100644 index 0000000..c2a9de7 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshots.js @@ -0,0 +1,70 @@ +'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 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; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.d.ts b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.d.ts new file mode 100644 index 0000000..c6a60e6 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.d.ts @@ -0,0 +1,20 @@ +/** + * 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 { 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; + isInternal: true; + getFailedSnapshotTestAssertions(testResults: AggregatedResult): Array<AssertionLocation>; + apply(hooks: JestHookSubscriber): void; + onKey(key: string): void; + run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: Function): Promise<void>; + getUsageInfo(): UsageData | null; +} +export default UpdateSnapshotInteractivePlugin; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js new file mode 100644 index 0000000..5346bc3 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js @@ -0,0 +1,138 @@ +'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; +} + +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() { + var _this$_failedSnapshot; + + if ( + ((_this$_failedSnapshot = this._failedSnapshotTestAssertions) === null || + _this$_failedSnapshot === void 0 + ? void 0 + : _this$_failedSnapshot.length) > 0 + ) { + return { + key: 'i', + prompt: 'update failing snapshots interactively' + }; + } + + return null; + } +} + +var _default = UpdateSnapshotInteractivePlugin; +exports.default = _default; |