@stryker-mutator/core
Version:
The extendable JavaScript mutation testing framework
34 lines • 1.94 kB
JavaScript
import { URL } from 'url';
import { testInjector } from '@stryker-mutator/test-helpers';
import sinon from 'sinon';
import { CheckerChildProcessProxy } from '../../../src/checker/checker-child-process-proxy.js';
import { CheckerWorker } from '../../../src/checker/checker-worker.js';
import { ChildProcessProxy } from '../../../src/child-proxy/child-process-proxy.js';
import { IdGenerator } from '../../../src/child-proxy/id-generator.js';
describe(CheckerChildProcessProxy.name, () => {
let childProcessProxyCreateStub;
let loggingContext;
let fileDescriptions;
let idGeneratorStub;
beforeEach(() => {
childProcessProxyCreateStub = sinon.stub(ChildProcessProxy, 'create');
loggingContext = { port: 4200, level: "fatal" /* LogLevel.Fatal */ };
fileDescriptions = { 'foo.js': { mutate: true } };
idGeneratorStub = sinon.createStubInstance(IdGenerator);
});
function createSut() {
return new CheckerChildProcessProxy(testInjector.options, fileDescriptions, ['plugin', 'paths'], loggingContext, idGeneratorStub);
}
describe('constructor', () => {
it('should create the child process', () => {
createSut();
sinon.assert.calledWithExactly(childProcessProxyCreateStub, new URL('../../../src/checker/checker-worker.js', import.meta.url).toString(), loggingContext, testInjector.options, fileDescriptions, ['plugin', 'paths'], process.cwd(), CheckerWorker, [], idGeneratorStub);
});
it('should provide arguments', () => {
testInjector.options.checkerNodeArgs = ['foo', 'bar'];
createSut();
sinon.assert.calledOnceWithExactly(childProcessProxyCreateStub, sinon.match.any, sinon.match.any, sinon.match.any, sinon.match.any, sinon.match.any, sinon.match.any, sinon.match.any, ['foo', 'bar'], idGeneratorStub);
});
});
});
//# sourceMappingURL=checker-child-process-proxy.spec.js.map