aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@jest/core/build/plugins/UpdateSnapshots.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@jest/core/build/plugins/UpdateSnapshots.js')
-rw-r--r--node_modules/@jest/core/build/plugins/UpdateSnapshots.js70
1 files changed, 70 insertions, 0 deletions
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;