Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const _ = require('lodash'),
AsyncEmitter = require('gemini-core').events.AsyncEmitter;
module.exports = class PassthroughEmitter extends AsyncEmitter {
// Allow to pass only one argument with event
emit(type, data) {
return super.emit(type, data);
}
emitAndWait(type, data) {
return super.emitAndWait(type, data, {shouldWait: true});
}
/**
* Emit event emitted by emitter
* @param {EventEmitter} emitter
* @param {String|String[]} event or array of events to passthrough
*/
'use strict';
const proxyquire = require('proxyquire');
const {AsyncEmitter} = require('gemini-core').events;
const Hermione = require('lib/worker/hermione');
const {makeConfigStub} = require('../../utils');
describe('worker/hermione-facade', () => {
const sandbox = sinon.createSandbox();
let HermioneFacade;
let hermione;
let config;
let ipc;
beforeEach(() => {
ipc = new AsyncEmitter();
HermioneFacade = proxyquire('lib/worker/hermione-facade', {
// TODO: think about how to make it easier
'../utils/ipc': {on: ipc.on.bind(ipc), emit: ipc.emit.bind(ipc)}
});
'use strict';
const CaptureSession = require('lib/capture-session');
const {temp} = require('gemini-core');
const util = require('../../util');
const errorUtils = require('lib/errors/utils');
const proxyquire = require('proxyquire').noCallThru();
const _ = require('lodash');
const AsyncEmitter = require('gemini-core').events.AsyncEmitter;
const Promise = require('bluebird');
describe('state-processor/state-processor', () => {
const sandbox = sinon.sandbox.create();
const job = sinon.stub();
beforeEach(() => {
sandbox.stub(temp);
job.returns({});
});
afterEach(() => {
sandbox.restore();
job.reset();
});
'use strict';
const _ = require('lodash');
const Runner = require('../runner');
const RegularTestRunner = require('./regular-test-runner');
const HighPriorityBrowserAgent = require('./high-priority-browser-agent');
const Events = require('../../constants/runner-events');
const {passthroughEvent} = require('gemini-core').events.utils;
const NoRefImageError = require('../../browser/commands/assert-view/errors/no-ref-image-error');
module.exports = class InsistantTestRunner extends Runner {
constructor(test, config, browserAgent) {
super();
this._test = test;
this._config = config;
this._browserConfig = config.forBrowser(browserAgent.browserId);
this._browserAgent = browserAgent;
this._retriesPerformed = 0;
this._cancelled = false;
}
async run(workers) {
'use strict';
const eventsUtils = require('gemini-core').events.utils;
const RunnerEvents = require('./constants/runner-events');
const Runner = require('./runner');
const BaseHermione = require('../base-hermione');
module.exports = class Hermione extends BaseHermione {
constructor(configPath) {
super(configPath);
this._runner = Runner.create(this._config);
eventsUtils.passthroughEvent(this._runner, this, [
RunnerEvents.BEFORE_FILE_READ,
RunnerEvents.AFTER_FILE_READ,
RunnerEvents.AFTER_TESTS_READ,
'use strict';
const _ = require('lodash');
const eventsUtils = require('gemini-core').events.utils;
const {temp} = require('gemini-core');
const pool = require('../browser-pool');
const BrowserRunner = require('./browser-runner');
const Events = require('../constants/runner-events');
const Runner = require('./runner');
const RuntimeConfig = require('../config/runtime-config');
const WorkersRegistry = require('../utils/workers-registry');
const PromiseGroup = require('./promise-group');
const TestCollection = require('../test-collection');
const logger = require('../utils/logger');
module.exports = class MainRunner extends Runner {
constructor(config, interceptors) {
super();
'use strict';
const EventEmitter = require('events').EventEmitter;
const _ = require('lodash');
const eventsUtils = require('gemini-core').events.utils;
const RunnerEvents = require('../../constants/runner-events');
const MochaBuilder = require('./mocha-builder');
module.exports = class MochaRunner extends EventEmitter {
static prepare() {
MochaBuilder.prepare();
}
static create(browserId, config, browserPool) {
return new MochaRunner(browserId, config, browserPool);
}
constructor(browserId, config, browserPool) {
super();
'use strict';
const _ = require('lodash');
const eventsUtils = require('gemini-core').events.utils;
const {AsyncEmitter} = require('gemini-core').events;
const {EventEmitter} = require('events');
const pluginsLoader = require('plugins-loader');
const q = require('q');
const Promise = require('bluebird');
const proxyquire = require('proxyquire').noCallThru();
const Config = require('lib/config');
const RuntimeConfig = require('lib/config/runtime-config');
const Errors = require('lib/errors');
const Hermione = require('lib/hermione');
const RunnerStats = require('lib/stats');
const TestReader = require('lib/test-reader');
const TestCollection = require('lib/test-collection');
const RunnerEvents = require('lib/constants/runner-events');
const signalHandler = require('lib/signal-handler');
'use strict';
const _ = require('lodash');
const {EventEmitter} = require('events');
const {passthroughEvent} = require('gemini-core').events.utils;
const SetsBuilder = require('gemini-core').SetsBuilder;
const TestParser = require('./mocha-test-parser');
const TestSkipper = require('./test-skipper');
const Events = require('../constants/runner-events');
module.exports = class TestReader extends EventEmitter {
static create(...args) {
return new this(...args);
}
constructor(config) {
super();
this._config = config;
this._testSkipper = TestSkipper.create(this._config);
}
'use strict';
const {EventEmitter} = require('events');
const {passthroughEvent} = require('gemini-core').events.utils;
const TestParser = require('../../test-reader/mocha-test-parser');
const TestCollection = require('../../test-collection');
const RunnerEvents = require('../constants/runner-events');
module.exports = class CachingTestParser extends EventEmitter {
static create(...args) {
return new this(...args);
}
constructor(config) {
super();
this._config = config;
this._cache = {};
TestParser.prepare();