Skip to content
Mickael Daniel edited this page Jan 30, 2013 · 2 revisions

test-conflicter

conflicter

is an event emitter.

assert.ok(conflicter instanceof events.EventEmitter);

conflicter#colors.

assert.deepEqual(conflicter.colors, {
  'diff added': 42,
  'diff removed': 41
});

conflicter#add(conflict)`.

conflicter.add(__filename);
var conflict = conflicter.conflicts.pop();
assert.deepEqual(conflict.file, __filename);
assert.deepEqual(conflict.content, fs.readFileSync(__filename, 'utf8'));

conflicter#diff(actual, expected).

var diff = conflicter.diff('var', 'let');
assert.equal(diff, '\n\u001b[41mremoved\u001b[0m \u001b[42madded\u001b[0m\n\n\u001b[42mlet\u001b[0m\u001b[41mvar\u001b[0m\n');

conflicter#resolve(cb)

wihout conflict.

conflicter.resolve(done);

with at least one.

conflicter.add(__filename);
conflicter.add({
  file: 'foo.js',
  content: 'var foo = "foo";\n'
});

conflicter.resolve(done);

conflicter#collision(filepath, content, cb)

Clone this wiki locally