Sha256: 0bb5a74ea7d7cc0702215fd446a1717915bf731efcdb23cf8a516cac4bf882ef

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

'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;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-0.27.1 packages/webpacker/node_modules/@jest/core/build/plugins/UpdateSnapshots.js
decidim-0.26.4 packages/webpacker/node_modules/@jest/core/build/plugins/UpdateSnapshots.js
decidim-0.27.0 packages/webpacker/node_modules/@jest/core/build/plugins/UpdateSnapshots.js
decidim-0.26.3 packages/webpacker/node_modules/@jest/core/build/plugins/UpdateSnapshots.js
decidim-0.27.0.rc2 packages/webpacker/node_modules/@jest/core/build/plugins/UpdateSnapshots.js
decidim-0.27.0.rc1 packages/webpacker/node_modules/@jest/core/build/plugins/UpdateSnapshots.js