How to use the gemini-core.AsyncEmitter function in gemini-core

To help you get started, we’ve selected a few gemini-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gemini-testing / hermione / test / lib / worker / hermione-facade.js View on Github external
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)}
        });

        config = makeConfigStub();

        hermione = Object.assign(new AsyncEmitter(), {
            init: sandbox.spy().named('hermioneInit'),
            config
        });
        sandbox.stub(Hermione, 'create').returns(hermione);

        ipc.on('worker.init', () => {
            process.nextTick(() => ipc.emit('master.init'));
        });
github gemini-testing / hermione / test / lib / worker / hermione-facade.js View on Github external
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)}
        });

        config = makeConfigStub();

        hermione = Object.assign(new AsyncEmitter(), {
            init: sandbox.spy().named('hermioneInit'),
            config
        });
        sandbox.stub(Hermione, 'create').returns(hermione);

        ipc.on('worker.init', () => {
            process.nextTick(() => ipc.emit('master.init'));
        });
        ipc.on('worker.syncConfig', () => {
            process.nextTick(() => ipc.emit('master.syncConfig', {config}));
        });
    });
github gemini-testing / gemini / test / unit / browser-pool.js View on Github external
it('should emit STOP_BROWSER on quit', () => {
                const emitter = new AsyncEmitter();
                const onBrowserQuit = sinon.spy();
                emitter.on(RunnerEvents.STOP_BROWSER, onBrowserQuit);

                const browserManager = init_({emitter});

                const browser = {foo: 'bar'};
                browserManager.onQuit(browser);

                assert.calledOnce(onBrowserQuit);
                assert.calledWith(onBrowserQuit, browser);
            });
github gemini-testing / hermione / lib / signal-handler.js View on Github external
'use strict';

const {AsyncEmitter} = require('gemini-core').events;
const {log} = require('./utils/logger');
const signalHandler = new AsyncEmitter();

signalHandler.setMaxListeners(0);

module.exports = signalHandler;

process.on('SIGHUP', notifyAndExit(1));
process.on('SIGINT', notifyAndExit(2));
process.on('SIGTERM', notifyAndExit(15));

let callCount = 0;

function notifyAndExit(signalNo) {
    const exitCode = 128 + signalNo;

    return function() {
        if (callCount++ > 0) {
github gemini-testing / hermione / test / lib / hermione.js View on Github external
const mkRunnerStub_ = (runFn) => {
        const runner = new AsyncEmitter();

        runner.run = sandbox.stub(Runner.prototype, 'run').callsFake(runFn && runFn.bind(null, runner));
        runner.addTestToRun = sandbox.stub(Runner.prototype, 'addTestToRun');
        runner.init = sandbox.stub(Runner.prototype, 'init');

        sandbox.stub(Runner, 'create').returns(runner);
        return runner;
    };