Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade cli-color to 1.2.0 #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/data/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var clc = require('cli-color');
var counter = 0;
var tab = 3;
var tabs = function(depth) {
return clc.right(depth * tab + 1);
return clc.move.right(depth * tab + 1);
};

var errorHighlightingEnabled = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/util/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function DrawUtil(numOfLines) {
};

this.cursorUp = function(n) {
write(clc.up(n));
write(clc.move.up(n));
};

this.fillWithNewlines = function(startFrom) {
Expand Down
8 changes: 4 additions & 4 deletions lib/util/printers.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ exports.printStats =
function printStats(stats) {
var inc = 3;

write(clc.right(inc + 2));
write(clc.move.right(inc + 2));
write( clc.yellow(stats.total + ' total') );

write(clc.right(inc));
write(clc.move.right(inc));
write(clc.green(stats.success + ' passed'));

write(clc.right(inc));
write(clc.move.right(inc));
write(clc.red(stats.failed + ' failed'));

write(clc.right(inc));
write(clc.move.right(inc));
write(clc.cyan(stats.skipped + ' skipped'));

write('\n');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"url": "https://github.com/dgarlitt/karma-nyan-reporter/issues"
},
"dependencies": {
"cli-color": "^0.3.2"
"cli-color": "^1.2.0"
},
"description": "Karma reporter with Nyan Cat style logging.",
"devDependencies": {
Expand Down
24 changes: 13 additions & 11 deletions test/data.types.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ describe('data/types.js test suite', function() {
right = 'right>';

clcFake = {
'right': sinon.stub(),
'move': {
'right': sinon.stub()
},
'white': sinon.stub(),
'red': sinon.stub(),
'yellow': sinon.stub(),
Expand All @@ -31,7 +33,7 @@ describe('data/types.js test suite', function() {
}
};

clcFake.right.returns(right);
clcFake.move.right.returns(right);

dt = rewire('../lib/data/types');
dt.__set__('clc', clcFake);
Expand Down Expand Up @@ -107,8 +109,8 @@ describe('data/types.js test suite', function() {
actual = sut.toString();

eq(expected, actual);
ok(clcFake.right.calledOnce);
ok(clcFake.right.calledWithExactly(sut.depth * tab + 1));
ok(clcFake.move.right.calledOnce);
ok(clcFake.move.right.calledWithExactly(sut.depth * tab + 1));
ok(clcFake.white.calledOnce);
ok(clcFake.white.calledWithExactly(name));
});
Expand Down Expand Up @@ -154,8 +156,8 @@ describe('data/types.js test suite', function() {
actual = sut.toString();

eq(expected, actual);
ok(clcFake.right.calledOnce);
ok(clcFake.right.calledWithExactly(depth * tab + 1));
ok(clcFake.move.right.calledOnce);
ok(clcFake.move.right.calledWithExactly(depth * tab + 1));
ok(clcFake.red.calledOnce);
ok(clcFake.red.calledWithExactly(name));
});
Expand Down Expand Up @@ -189,11 +191,11 @@ describe('data/types.js test suite', function() {
it('should call clc.right as expected when toString is called', function() {
sut.toString();

eq(4, clcFake.right.callCount);
ok(clcFake.right.getCall(0).calledWithExactly(depth * tab + 1));
ok(clcFake.right.getCall(1).calledWithExactly((depth + 1) * tab + 1));
ok(clcFake.right.getCall(2).calledWithExactly((depth + 2) * tab + 1));
ok(clcFake.right.getCall(3).calledWithExactly((depth + 2) * tab + 1));
eq(4, clcFake.move.right.callCount);
ok(clcFake.move.right.getCall(0).calledWithExactly(depth * tab + 1));
ok(clcFake.move.right.getCall(1).calledWithExactly((depth + 1) * tab + 1));
ok(clcFake.move.right.getCall(2).calledWithExactly((depth + 2) * tab + 1));
ok(clcFake.move.right.getCall(3).calledWithExactly((depth + 2) * tab + 1));
});

it('should call the color methods on clc as expected when toString is called', function() {
Expand Down
14 changes: 8 additions & 6 deletions test/printers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ describe('printers.js test suite', function() {
'redBright': sinon.stub(),
'cyan': sinon.stub(),
'green': sinon.stub(),
'right': sinon.stub(),
'move': {
'right': sinon.stub()
},
'blackBright': sinon.stub(),
'white': sinon.stub(),
'yellow': sinon.stub()
Expand Down Expand Up @@ -209,7 +211,7 @@ describe('printers.js test suite', function() {
'skipped': 99
};

clcFake.right.returns(tab);
clcFake.move.right.returns(tab);
clcFake.yellow.withArgs(stats.total + ' total').returns('yellow>' + stats.total);
clcFake.green.withArgs(stats.success + ' passed').returns('green>' + stats.success);
clcFake.red.withArgs(stats.failed + ' failed').returns('red>' + stats.failed);
Expand All @@ -233,10 +235,10 @@ describe('printers.js test suite', function() {
});

it('should call clc.right as expected', function() {
eq(4, clcFake.right.callCount);
ok(clcFake.right.firstCall.calledWithExactly(5));
ok(clcFake.right.secondCall.calledWithExactly(3));
ok(clcFake.right.thirdCall.calledWithExactly(3));
eq(4, clcFake.move.right.callCount);
ok(clcFake.move.right.firstCall.calledWithExactly(5));
ok(clcFake.move.right.secondCall.calledWithExactly(3));
ok(clcFake.move.right.thirdCall.calledWithExactly(3));
});

it('should call write with the expected arguments', function() {
Expand Down
6 changes: 4 additions & 2 deletions test/util.draw.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ describe('util/draw.js test suite', function() {
shellFake.getHeight.returns(shellHeight);

clcFake = {
up: sinon.stub(),
move: {
up: sinon.stub(),
},
yellow: sinon.stub(),
green: sinon.stub(),
red: sinon.stub(),
Expand Down Expand Up @@ -326,7 +328,7 @@ describe('util/draw.js test suite', function() {
it('should call write with the expected values', function() {
var arg = 'blah';

clcFake.up.returns('up');
clcFake.move.up.returns('up');

sut.cursorUp(arg);

Expand Down