Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Removed multiProcess option, always run subprocesses
Browse files Browse the repository at this point in the history
  • Loading branch information
j0tunn committed Dec 4, 2015
1 parent a6b4c9e commit f28a7e8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 56 deletions.
4 changes: 0 additions & 4 deletions doc/config.md
Expand Up @@ -56,7 +56,6 @@ system:
parallelLimit: 3
diffColor: '#ff0000'
referenceImageAbsence: 'error'
multiProcess: true
coverage:
enabled: true
exclude:
Expand Down Expand Up @@ -108,9 +107,6 @@ settings. These settings can not be set per-browser.
* `referenceImageAbsence` – treat the cases when a reference image does not
exist as `error` or `warning`. Default value is `error`.

* `multiProcess` - if `true` gemini will make few child processes for heavy
operations like image comparison and creating diff images. `true` by default

* `coverage` - `gemini` can gather and report CSS tests coverage. It supports
source maps, so you can get the report even if you are using preprocessor or
minifier. The JSON and html reports are saved to `gemini-coverage`
Expand Down
5 changes: 0 additions & 5 deletions doc/config.ru.md
Expand Up @@ -58,7 +58,6 @@ system:
parallelLimit: 3
diffColor: '#ff0000'
referenceImageAbsence: 'error'
multiProcess: true
coverage:
enabled: true
exclude:
Expand Down Expand Up @@ -108,10 +107,6 @@ system:
предупреждением (`warning`) или ошибкой (`error`). По-умолчанию ошибка
(`error`).

* `multiProcess` - если `true`, то gemini создаст несколько вспомогательных
процессов для выполнения "тяжелых" операций, таких как сравнение изображений
и создание diff-оф. По-умолчанию `true`

* `coverage` - `gemini` может собирать статистику покрытия CSS-кода тестами.
Вы можете получить отчет о покрытии даже если используете препроцессоры и
минификаторы, поскольку инструмен поддерживает source maps. В этой секции
Expand Down
1 change: 0 additions & 1 deletion lib/config/options.js
Expand Up @@ -36,7 +36,6 @@ module.exports = root(
plugins: anyObject(),

debug: booleanOption(false),
multiProcess: booleanOption(true),

parallelLimit: positiveIntegerOption(Infinity),

Expand Down
23 changes: 9 additions & 14 deletions lib/image-processor/index.js
Expand Up @@ -3,31 +3,26 @@
var q = require('q'),
_ = require('lodash'),
inherit = require('inherit'),
compareAdapter = require('./compare-adapter'),
ParallelComporator = require('./parallel-comparator');
workerFarm = require('worker-farm'),
RunnerEvents = require('../constants/runner-events');

var ImageProcessor = inherit({
__constructor: function(comparator) {
this._comparator = _.bindAll(comparator);
__constructor: function(emitter) {
this._workers = workerFarm(require.resolve('./compare-adapter'), ['compare', 'buildDiff']);
emitter.on(RunnerEvents.END, function() {
workerFarm.end(this._workers);
}.bind(this));
},

compare: function(path1, path2, opts) {
return q.nfcall(this._comparator.compare, _.extend(opts || {}, {
return q.nfcall(this._workers.compare, _.extend(opts || {}, {
path1: path1,
path2: path2
}));
},

buildDiff: function(opts) {
return q.nfcall(this._comparator.buildDiff, opts);
}
}, {
create: function(config, emitter) {
var comparator = _.get(config, 'system.multiProcess')
? new ParallelComporator(emitter)
: compareAdapter;

return new ImageProcessor(comparator);
return q.nfcall(this._workers.buildDiff, opts);
}
});

Expand Down
24 changes: 0 additions & 24 deletions lib/image-processor/parallel-comparator.js

This file was deleted.

12 changes: 10 additions & 2 deletions test/functional/image-processor.test.js
@@ -1,9 +1,17 @@
'use strict';

var util = require('./util');
var EventEmitter = require('events').EventEmitter,
util = require('./util'),
ImageProcessor = require('../../lib/image-processor'),
RunnerEvents = require('../../lib/constants/runner-events');

describe('image', function() {
var imageProcessor = require('../../lib/image-processor').create();
var emitter = new EventEmitter(),
imageProcessor = new ImageProcessor(emitter);

after(function() {
emitter.emit(RunnerEvents.END);
});

describe('compare', function() {
it('should resolve to `true` for equal images', function() {
Expand Down
16 changes: 10 additions & 6 deletions test/functional/util.js
@@ -1,9 +1,10 @@
'use strict';

var fs = require('fs'),
var q = require('q'),
fs = require('fs'),
path = require('path'),
temp = require('temp'),
imageProcessor = require('../../lib/image-processor').create();
compareAdapter = require('../../lib/image-processor/compare-adapter');

function imagePath(name) {
return path.join(__dirname, 'data', 'image', name);
Expand All @@ -21,8 +22,11 @@ exports.withTempFile = function(func) {
};

exports.assertSameImages = function(refName, filePath) {
return assert.eventually.isTrue(imageProcessor.compare(
imagePath(refName),
filePath
), 'expected image to be equal to ' + refName);
return assert.eventually.isTrue(
q.nfcall(compareAdapter.compare, {
path1: imagePath(refName),
path2:filePath
}),
'expected image to be equal to ' + refName
);
};

0 comments on commit f28a7e8

Please sign in to comment.