Skip to content

Commit f6b844e

Browse files
author
James Halliday
committed
remove nested test indents to pass the tests
1 parent 422bfb4 commit f6b844e

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

lib/render.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Render.prototype.begin = function () {
2424

2525
Render.prototype.push = function (t) {
2626
var self = this;
27-
this.emit('data', Array(t.indent + 1).join(' ') + '# ' + t.name + '\n');
27+
this.emit('data', '# ' + t.name + '\n');
2828

2929
t.on('result', function (res) {
3030
self.emit('data', encodeResult(res, self.count + 1));
@@ -50,7 +50,7 @@ Render.prototype.close = function () {
5050
};
5151

5252
function encodeResult (res, count) {
53-
var output = Array(res.indent + 1).join(' ');
53+
var output = '';
5454
output += (res.ok ? 'ok ' : 'not ok ') + count;
5555
output += res.name ? ' ' + res.name.replace(/\s+/g, ' ') : '';
5656

@@ -60,7 +60,7 @@ function encodeResult (res, count) {
6060
output += '\n';
6161

6262
if (!res.ok) {
63-
var outer = Array(res.indent + 3).join(' ');
63+
var outer = ' ';
6464
var inner = outer + ' ';
6565
output += outer + '---\n';
6666
output += inner + 'operator: ' + res.operator + '\n';

lib/test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function Test (name, opts) {
1212

1313
this.name = name || '(anonymous)';
1414
this.assertCount = 0;
15-
this.indent = opts.indent || 0;
1615
}
1716

1817
Test.prototype.test = function (name, cb) {
@@ -23,7 +22,7 @@ Test.prototype.test = function (name, cb) {
2322
name = '(anonymous)';
2423
}
2524

26-
var t = new Test(name, { indent : self.indent + 2 });
25+
var t = new Test(name);
2726
t.run = function () { cb(t) };
2827
self.emit('test', t);
2928
};
@@ -55,7 +54,6 @@ Test.prototype._assert = function assert (ok, opts) {
5554

5655
var res = {
5756
id : self.assertCount ++,
58-
indent : self.indent,
5957
ok : Boolean(ok),
6058
skip : defined(extra.skip, opts.skip),
6159
name : defined(extra.message, opts.message, '(unnamed assert)'),

test/nested.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ tap.test('array test', function (tt) {
2525
{ id: 3, ok: true, name: 'should be equivalent' },
2626
{ id: 4, ok: true, name: 'should be equivalent' },
2727
{ id: 5, ok: true, name: 'should be equivalent' },
28-
'# inside test',
28+
'inside test',
2929
{ id: 6, ok: true, name: '(unnamed assert)' },
3030
{ id: 7, ok: true, name: '(unnamed assert)' },
3131
'another',

0 commit comments

Comments
 (0)