'use strict';

var _chai;

function _load_chai() {
  return _chai = require('chai');
}

var _child_process;

function _load_child_process() {
  return _child_process = require('child_process');
}

var _path;

function _load_path() {
  return _path = _interopRequireDefault(require('path'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

describe('worker', function () {
  // TODO: fix this test, the worker now do a different process than before
  it.skip('should throw an error for a mismatch tester interface', function (done) {
    var child = (0, (_child_process || _load_child_process()).fork)((_path || _load_path()).default.join(__dirname, '..', '..', 'dist', 'specs-runner', 'worker.js'), {
      silent: false,
      env: {
        __impl__: '',
        __specs__: '',
        __tester__: (_path || _load_path()).default.join(__dirname, 'fixtures', 'invalid-tester.js'),
        __testerId__: 'myScope/box/my-component'
      }
    });

    process.on('exit', function () {
      child.kill('SIGKILL');
    });

    child.on('message', function (_ref) {
      var type = _ref.type,
          payload = _ref.payload;

      (0, (_chai || _load_chai()).expect)(type).to.equal('error');
      (0, (_chai || _load_chai()).expect)(payload).to.equal('"myScope/box/my-component" doesn\'t have a valid tester interface');
      done();
    });
  });
});