"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

require("core-js/modules/es.promise");

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");

_Object$defineProperty(exports, "__esModule", {
  value: true
});

exports.default = void 0;

var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));

var _plugin = _interopRequireDefault(require("@start/plugin"));

var _default = (options, open, loadData, locale) => (0, _plugin.default)('CYPRESS', ({
  reporter
}) =>
/*#__PURE__*/
(0, _asyncToGenerator2.default)(function* () {
  const cypress = require('cypress');

  try {
    const func = open ? cypress.open : cypress.run;
    func({
      config: options,
      env: {
        LOAD_DATA: loadData,
        LOCALE: locale
      }
    });
    return _promise.default.resolve();
  } catch (e) {
    return _promise.default.reject(e);
  }
}));

exports.default = _default;
module.exports = exports.default;