"use strict";

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

function _chai() {
  const data = require("chai");

  _chai = function () {
    return data;
  };

  return data;
}

function _child_process() {
  const data = require("child_process");

  _child_process = function () {
    return data;
  };

  return data;
}

function _path() {
  const data = _interopRequireDefault(require("path"));

  _path = function () {
    return data;
  };

  return data;
}

describe('worker', () => {
  // TODO: fix this test, the worker now do a different process than before
  it.skip('should throw an error for a mismatch tester interface', done => {
    const child = (0, _child_process().fork)(_path().default.join(__dirname, '..', '..', 'dist', 'specs-runner', 'worker.js'), {
      silent: false,
      env: {
        __impl__: '',
        __specs__: '',
        __tester__: _path().default.join(__dirname, '../../', 'fixtures', 'invalid-tester.js'),
        __testerId__: 'myScope/my-component'
      }
    });
    process.on('exit', () => {
      child.kill('SIGKILL');
    });
    child.on('message', ({
      type,
      payload
    }) => {
      (0, _chai().expect)(type).to.equal('error');
      (0, _chai().expect)(payload).to.equal('"myScope/my-component" doesn\'t have a valid tester interface');
      done();
    });
  });
});