Skip to content

Commit 0743333

Browse files
committedJan 3, 2021
[Tests] make stripFullStack output an array of lines, for better failure messages
1 parent d505cdf commit 0743333

27 files changed

+814
-792
lines changed
 

‎test/anonymous-fn.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ tap.test('inside anonymous functions', function (tt) {
3232
'1..1',
3333
'# tests 1',
3434
'# pass 0',
35-
'# fail 1'
36-
].join('\n') + '\n');
35+
'# fail 1',
36+
''
37+
]);
3738
};
3839

3940
test.createStream().pipe(concat(tc));

‎test/async-await.js

+19-15
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ tap.test('async1', function (t) {
3535
tap.test('async2', function (t) {
3636
runProgram('async-await', 'async2.js', function (r) {
3737
var stdout = r.stdout.toString('utf8');
38-
var lines = stdout.split('\n');
39-
lines = lines.filter(function (line) {
38+
var lines = stdout.split('\n').filter(function (line) {
4039
return !/^(\s+)at(\s+)<anonymous>$/.test(line);
4140
});
42-
stdout = lines.join('\n');
4341

44-
t.same(stripFullStack(stdout), [
42+
t.same(stripFullStack(lines.join('\n')), [
4543
'TAP version 13',
4644
'# async2',
4745
'ok 1 before await',
@@ -60,8 +58,10 @@ tap.test('async2', function (t) {
6058
'1..2',
6159
'# tests 2',
6260
'# pass 1',
63-
'# fail 1'
64-
].join('\n') + '\n\n');
61+
'# fail 1',
62+
'',
63+
''
64+
]);
6565
t.same(r.exitCode, 1);
6666
t.same(r.stderr.toString('utf8'), '');
6767
t.end();
@@ -107,8 +107,10 @@ tap.test('async4', function (t) {
107107
'1..2',
108108
'# tests 2',
109109
'# pass 1',
110-
'# fail 1'
111-
].join('\n') + '\n\n');
110+
'# fail 1',
111+
'',
112+
''
113+
]);
112114
t.same(r.exitCode, 1);
113115
t.same(r.stderr.toString('utf8'), '');
114116
t.end();
@@ -159,8 +161,10 @@ tap.test('async5', function (t) {
159161
'1..8',
160162
'# tests 8',
161163
'# pass 5',
162-
'# fail 3'
163-
].join('\n') + '\n\n');
164+
'# fail 3',
165+
'',
166+
''
167+
]);
164168
t.same(r.exitCode, 1);
165169
t.same(r.stderr.toString('utf8'), '');
166170
t.end();
@@ -174,7 +178,7 @@ tap.test('sync-error', function (t) {
174178
'# sync-error',
175179
'ok 1 before throw',
176180
''
177-
].join('\n'));
181+
]);
178182
t.same(r.exitCode, 1);
179183

180184
var stderr = r.stderr.toString('utf8');
@@ -197,7 +201,7 @@ tap.test('sync-error', function (t) {
197201
' at Test.run ($TAPE/lib/test.js:$LINE:$COL)',
198202
' at Test.bound [as run] ($TAPE/lib/test.js:$LINE:$COL)',
199203
''
200-
].join('\n'));
204+
]);
201205
t.end();
202206
});
203207
});
@@ -211,7 +215,7 @@ tap.test('async-error', function (t) {
211215
});
212216
stdout = lines.join('\n');
213217

214-
t.same(stripFullStack(stdout.toString('utf8')), [
218+
t.same(stripFullStack(stdout), [
215219
'TAP version 13',
216220
'# async-error',
217221
'ok 1 before throw',
@@ -230,7 +234,7 @@ tap.test('async-error', function (t) {
230234
'# fail 1',
231235
'',
232236
'',
233-
].join('\n'));
237+
]);
234238
t.same(r.exitCode, 1);
235239

236240
var stderr = r.stderr.toString('utf8');
@@ -276,7 +280,7 @@ tap.test('async-bug', function (t) {
276280
'# fail 1',
277281
'',
278282
'',
279-
].join('\n'));
283+
]);
280284
t.same(r.exitCode, 1);
281285

282286
var stderr = r.stderr.toString('utf8');

‎test/circular-things.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@ tap.test('circular test', function (assert) {
1111
assert.plan(1);
1212

1313
test.createStream().pipe(concat(function (body) {
14-
assert.equal(
15-
stripFullStack(body.toString('utf8')),
16-
'TAP version 13\n'
17-
+ '# circular\n'
18-
+ 'not ok 1 should be strictly equal\n'
19-
+ ' ---\n'
20-
+ ' operator: equal\n'
21-
+ ' expected: |-\n'
22-
+ ' {}\n'
23-
+ ' actual: |-\n'
24-
+ ' { circular: [Circular] }\n'
25-
+ ' at: Test.<anonymous> ($TEST/circular-things.js:$LINE:$COL)\n'
26-
+ ' stack: |-\n'
27-
+ ' Error: should be strictly equal\n'
28-
+ ' [... stack stripped ...]\n'
29-
+ ' at Test.<anonymous> ($TEST/circular-things.js:$LINE:$COL)\n'
30-
+ ' [... stack stripped ...]\n'
31-
+ ' ...\n'
32-
+ '\n'
33-
+ '1..1\n'
34-
+ '# tests 1\n'
35-
+ '# pass 0\n'
36-
+ '# fail 1\n'
37-
);
14+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
15+
'TAP version 13',
16+
'# circular',
17+
'not ok 1 should be strictly equal',
18+
' ---',
19+
' operator: equal',
20+
' expected: |-',
21+
' {}',
22+
' actual: |-',
23+
' { circular: [Circular] }',
24+
' at: Test.<anonymous> ($TEST/circular-things.js:$LINE:$COL)',
25+
' stack: |-',
26+
' Error: should be strictly equal',
27+
' [... stack stripped ...]',
28+
' at Test.<anonymous> ($TEST/circular-things.js:$LINE:$COL)',
29+
' [... stack stripped ...]',
30+
' ...',
31+
'',
32+
'1..1',
33+
'# tests 1',
34+
'# pass 0',
35+
'# fail 1',
36+
''
37+
]);
3838
}));
3939

4040
test('circular', function (t) {

‎test/common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports.stripFullStack = function (output) {
6969
// Handle stack trace variation in Node v0.8
7070
/at(:?) Test\.(?:module\.exports|tap\.test\.err\.code)/g,
7171
'at$1 Test.<anonymous>'
72-
);
72+
).split('\n');
7373
};
7474

7575
module.exports.runProgram = function (folderName, fileName, cb) {

‎test/deep-equal-failure.js

+72-72
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ tap.test('deep equal failure', function (assert) {
1717

1818
stream.pipe(parser);
1919
stream.pipe(concat(function (body) {
20-
assert.equal(
21-
stripFullStack(body.toString('utf8')),
22-
'TAP version 13\n'
23-
+ '# deep equal\n'
24-
+ 'not ok 1 should be strictly equal\n'
25-
+ ' ---\n'
26-
+ ' operator: equal\n'
27-
+ ' expected: |-\n'
28-
+ ' { b: 2 }\n'
29-
+ ' actual: |-\n'
30-
+ ' { a: 1 }\n'
31-
+ ' at: Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)\n'
32-
+ ' stack: |-\n'
33-
+ ' Error: should be strictly equal\n'
34-
+ ' [... stack stripped ...]\n'
35-
+ ' at Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)\n'
36-
+ ' [... stack stripped ...]\n'
37-
+ ' ...\n'
38-
+ '\n'
39-
+ '1..1\n'
40-
+ '# tests 1\n'
41-
+ '# pass 0\n'
42-
+ '# fail 1\n'
43-
);
20+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
21+
'TAP version 13',
22+
'# deep equal',
23+
'not ok 1 should be strictly equal',
24+
' ---',
25+
' operator: equal',
26+
' expected: |-',
27+
' { b: 2 }',
28+
' actual: |-',
29+
' { a: 1 }',
30+
' at: Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)',
31+
' stack: |-',
32+
' Error: should be strictly equal',
33+
' [... stack stripped ...]',
34+
' at Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)',
35+
' [... stack stripped ...]',
36+
' ...',
37+
'',
38+
'1..1',
39+
'# tests 1',
40+
'# pass 0',
41+
'# fail 1',
42+
''
43+
]);
4444

4545
assert.deepEqual(getDiag(body), {
4646
operator: 'equal',
@@ -78,30 +78,30 @@ tap.test('deep equal failure, depth 6, with option', function (assert) {
7878

7979
stream.pipe(parser);
8080
stream.pipe(concat(function (body) {
81-
assert.equal(
82-
stripFullStack(body.toString('utf8')),
83-
'TAP version 13\n'
84-
+ '# deep equal\n'
85-
+ 'not ok 1 should be strictly equal\n'
86-
+ ' ---\n'
87-
+ ' operator: equal\n'
88-
+ ' expected: |-\n'
89-
+ ' { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }\n'
90-
+ ' actual: |-\n'
91-
+ ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }\n'
92-
+ ' at: Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)\n'
93-
+ ' stack: |-\n'
94-
+ ' Error: should be strictly equal\n'
95-
+ ' [... stack stripped ...]\n'
96-
+ ' at Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)\n'
97-
+ ' [... stack stripped ...]\n'
98-
+ ' ...\n'
99-
+ '\n'
100-
+ '1..1\n'
101-
+ '# tests 1\n'
102-
+ '# pass 0\n'
103-
+ '# fail 1\n'
104-
);
81+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
82+
'TAP version 13',
83+
'# deep equal',
84+
'not ok 1 should be strictly equal',
85+
' ---',
86+
' operator: equal',
87+
' expected: |-',
88+
' { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }',
89+
' actual: |-',
90+
' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }',
91+
' at: Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)',
92+
' stack: |-',
93+
' Error: should be strictly equal',
94+
' [... stack stripped ...]',
95+
' at Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)',
96+
' [... stack stripped ...]',
97+
' ...',
98+
'',
99+
'1..1',
100+
'# tests 1',
101+
'# pass 0',
102+
'# fail 1',
103+
''
104+
]);
105105

106106
assert.deepEqual(getDiag(body), {
107107
operator: 'equal',
@@ -139,30 +139,30 @@ tap.test('deep equal failure, depth 6, without option', function (assert) {
139139

140140
stream.pipe(parser);
141141
stream.pipe(concat(function (body) {
142-
assert.equal(
143-
stripFullStack(body.toString('utf8')),
144-
'TAP version 13\n'
145-
+ '# deep equal\n'
146-
+ 'not ok 1 should be strictly equal\n'
147-
+ ' ---\n'
148-
+ ' operator: equal\n'
149-
+ ' expected: |-\n'
150-
+ ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }\n'
151-
+ ' actual: |-\n'
152-
+ ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }\n'
153-
+ ' at: Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)\n'
154-
+ ' stack: |-\n'
155-
+ ' Error: should be strictly equal\n'
156-
+ ' [... stack stripped ...]\n'
157-
+ ' at Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)\n'
158-
+ ' [... stack stripped ...]\n'
159-
+ ' ...\n'
160-
+ '\n'
161-
+ '1..1\n'
162-
+ '# tests 1\n'
163-
+ '# pass 0\n'
164-
+ '# fail 1\n'
165-
);
142+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
143+
'TAP version 13',
144+
'# deep equal',
145+
'not ok 1 should be strictly equal',
146+
' ---',
147+
' operator: equal',
148+
' expected: |-',
149+
' { a: { a1: { a2: { a3: { a4: [Object] } } } } }',
150+
' actual: |-',
151+
' { a: { a1: { a2: { a3: { a4: [Object] } } } } }',
152+
' at: Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)',
153+
' stack: |-',
154+
' Error: should be strictly equal',
155+
' [... stack stripped ...]',
156+
' at Test.<anonymous> ($TEST/deep-equal-failure.js:$LINE:$COL)',
157+
' [... stack stripped ...]',
158+
' ...',
159+
'',
160+
'1..1',
161+
'# tests 1',
162+
'# pass 0',
163+
'# fail 1',
164+
''
165+
]);
166166

167167
assert.deepEqual(getDiag(body), {
168168
operator: 'equal',

‎test/default-messages.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ tap.test('default messages', function (t) {
1313
var ps = spawn(process.execPath, [path.join(__dirname, 'messages', 'defaults.js')]);
1414

1515
ps.stdout.pipe(concat(function (rows) {
16-
1716
t.same(stripFullStack(rows.toString('utf8')), [
1817
'TAP version 13',
1918
'# default messages',
@@ -44,7 +43,9 @@ tap.test('default messages', function (t) {
4443
'1..12',
4544
'# tests 12',
4645
'# pass 11',
47-
'# fail 1'
48-
].join('\n') + '\n\n');
46+
'# fail 1',
47+
'',
48+
''
49+
]);
4950
}));
5051
});

‎test/double_end.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ var spawn = require('child_process').spawn;
77

88
var stripFullStack = require('./common').stripFullStack;
99

10-
test(function (t) {
11-
t.plan(2);
10+
test(function (tt) {
11+
tt.plan(2);
1212
var ps = spawn(process.execPath, [path.join(__dirname, 'double_end', 'double.js')]);
1313
ps.on('exit', function (code) {
14-
t.equal(code, 1);
14+
tt.equal(code, 1);
1515
});
1616
ps.stdout.pipe(concat(function (body) {
1717
// The implementation of node's timer library has changed over time. We
@@ -31,14 +31,14 @@ test(function (t) {
3131
to._onTimeout();
3232
}
3333
catch (e) {
34-
stackExpected = stripFullStack(e.stack).split('\n')[1];
34+
stackExpected = stripFullStack(e.stack)[1];
3535
stackExpected = stackExpected.replace('double_end.js', 'double_end/double.js');
3636
stackExpected = stackExpected.trim();
3737
atExpected = stackExpected.replace(/^at\s+/, 'at: ');
3838
}
3939

4040
var stripped = stripFullStack(body.toString('utf8'));
41-
t.equal(stripped, [
41+
tt.same(stripped, [
4242
'TAP version 13',
4343
'# double end',
4444
'ok 1 should be strictly equal',
@@ -57,6 +57,8 @@ test(function (t) {
5757
'# tests 2',
5858
'# pass 1',
5959
'# fail 1',
60-
].join('\n') + '\n\n');
60+
'',
61+
''
62+
]);
6163
}));
6264
});

‎test/edge-cases.js

+226-225
Large diffs are not rendered by default.

‎test/error.js

+19-18
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ tap.test('failures', function (tt) {
1111

1212
var test = tape.createHarness();
1313
test.createStream().pipe(concat(function (body) {
14-
tt.equal(
15-
stripFullStack(body.toString('utf8')),
16-
'TAP version 13\n'
17-
+ '# error\n'
18-
+ 'not ok 1 Error: this is a message\n'
19-
+ ' ---\n'
20-
+ ' operator: error\n'
21-
+ ' at: Test.<anonymous> ($TEST/error.js:$LINE:$COL)\n'
22-
+ ' stack: |-\n'
23-
+ ' Error: this is a message\n'
24-
+ ' at Test.<anonymous> ($TEST/error.js:$LINE:$COL)\n'
25-
+ ' [... stack stripped ...]\n'
26-
+ ' ...\n'
27-
+ '\n1..1\n'
28-
+ '# tests 1\n'
29-
+ '# pass 0\n'
30-
+ '# fail 1\n'
31-
);
14+
tt.same(stripFullStack(body.toString('utf8')), [
15+
'TAP version 13',
16+
'# error',
17+
'not ok 1 Error: this is a message',
18+
' ---',
19+
' operator: error',
20+
' at: Test.<anonymous> ($TEST/error.js:$LINE:$COL)',
21+
' stack: |-',
22+
' Error: this is a message',
23+
' at Test.<anonymous> ($TEST/error.js:$LINE:$COL)',
24+
' [... stack stripped ...]',
25+
' ...',
26+
'',
27+
'1..1',
28+
'# tests 1',
29+
'# pass 0',
30+
'# fail 1',
31+
'',
32+
]);
3233
}));
3334

3435
test('error', function (t) {

‎test/exit.js

+24-12
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ tap.test('exit fail', function (t) {
6868
'1..5',
6969
'# tests 5',
7070
'# pass 4',
71-
'# fail 1'
72-
].join('\n') + '\n\n');
71+
'# fail 1',
72+
'',
73+
''
74+
]);
7375
};
7476

7577
var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'fail.js')]);
@@ -105,8 +107,10 @@ tap.test('too few exit', function (t) {
105107
'1..6',
106108
'# tests 6',
107109
'# pass 5',
108-
'# fail 1'
109-
].join('\n') + '\n\n');
110+
'# fail 1',
111+
'',
112+
''
113+
]);
110114
};
111115

112116
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/too_few.js')]);
@@ -140,8 +144,10 @@ tap.test('more planned in a second test', function (t) {
140144
'1..3',
141145
'# tests 3',
142146
'# pass 2',
143-
'# fail 1'
144-
].join('\n') + '\n\n');
147+
'# fail 1',
148+
'',
149+
''
150+
]);
145151
};
146152

147153
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/second.js')]);
@@ -164,8 +170,10 @@ tap.test('todo passing', function (t) {
164170
'# tests 1',
165171
'# pass 1',
166172
'',
167-
'# ok'
168-
].join('\n') + '\n\n');
173+
'# ok',
174+
'',
175+
''
176+
]);
169177
};
170178

171179
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/todo.js')]);
@@ -194,8 +202,10 @@ tap.test('todo failing', function (t) {
194202
'# tests 1',
195203
'# pass 1',
196204
'',
197-
'# ok'
198-
].join('\n') + '\n\n');
205+
'# ok',
206+
'',
207+
''
208+
]);
199209
};
200210

201211
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/todo_fail.js')]);
@@ -227,8 +237,10 @@ tap.test('forgot to call t.end()', function (t) {
227237
'1..3',
228238
'# tests 3',
229239
'# pass 2',
230-
'# fail 1'
231-
].join('\n') + '\n\n');
240+
'# fail 1',
241+
'',
242+
''
243+
]);
232244
};
233245

234246
var ps = spawn(process.execPath, [path.join(__dirname, '/exit/missing_end.js')]);

‎test/fail.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ tap.test('array test', function (tt) {
4040
'# pass 4',
4141
'# fail 1',
4242
''
43-
].join('\n'));
43+
]);
4444
};
4545

4646
test.createStream().pipe(concat(tc));

‎test/has spaces.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tap.test('array test', function (tt) {
3030
'# pass 0',
3131
'# fail 1',
3232
''
33-
].join('\n'));
33+
]);
3434
};
3535

3636
test.createStream().pipe(concat(tc));

‎test/ignore_from_gitignore.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tap.test('Should pass with ignoring', { skip: process.platform === 'win32' }, fu
3535
'# ok',
3636
'',
3737
''
38-
].join('\n'));
38+
]);
3939
};
4040

4141
var ps = spawn(tapeBin, ['**/*.js', '-i', '.ignore'], {cwd: path.join(__dirname, 'ignore')});
@@ -92,7 +92,7 @@ tap.test('Should pass', { skip: process.platform === 'win32' }, function (tt) {
9292
'# fail 2',
9393
'',
9494
''
95-
].join('\n'));
95+
]);
9696
};
9797

9898
var ps = spawn(tapeBin, ['**/*.js'], {cwd: path.join(__dirname, 'ignore')});
@@ -110,7 +110,7 @@ tap.test('Should fail when ignore file does not exist', { skip: process.platform
110110
};
111111

112112
var testStderr = function (rows) {
113-
tt.ok(/^ENOENT[:,] no such file or directory,? (?:open )?'\$TEST\/ignore\/.gitignore'\n$/m.test(stripFullStack(rows.toString('utf8'))));
113+
tt.ok(/^ENOENT[:,] no such file or directory,? (?:open )?'\$TEST\/ignore\/.gitignore'\n$/m.test(stripFullStack(rows.toString('utf8')).join('\n')));
114114
};
115115

116116
var ps = spawn(tapeBin, ['**/*.js', '-i'], {cwd: path.join(__dirname, 'ignore')});

‎test/match.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ tap.test('match', function (tt) {
4848
'# pass 4',
4949
'# fail 2',
5050
''
51-
].join('\n'));
51+
]);
5252
};
5353

5454
test.createStream().pipe(concat(tc));
@@ -142,7 +142,7 @@ tap.test('doesNotMatch', function (tt) {
142142
'# pass 2',
143143
'# fail 4',
144144
''
145-
].join('\n'));
145+
]);
146146
};
147147

148148
test.createStream().pipe(concat(tc));

‎test/no_callback.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ tap.test('no callback', function (tt) {
3131
'# tests 1',
3232
'# pass 0',
3333
'# fail 1',
34-
].join('\n') + '\n');
34+
'',
35+
]);
3536
};
3637

3738
test.createStream().pipe(concat(tc));

‎test/not-deep-equal-failure.js

+72-72
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ tap.test('deep equal failure', function (assert) {
1717

1818
stream.pipe(parser);
1919
stream.pipe(concat(function (body) {
20-
assert.equal(
21-
stripFullStack(body.toString('utf8')),
22-
'TAP version 13\n'
23-
+ '# not deep equal\n'
24-
+ 'not ok 1 should not be deeply equivalent\n'
25-
+ ' ---\n'
26-
+ ' operator: notDeepEqual\n'
27-
+ ' expected: |-\n'
28-
+ ' { b: 2 }\n'
29-
+ ' actual: |-\n'
30-
+ ' { b: 2 }\n'
31-
+ ' at: Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)\n'
32-
+ ' stack: |-\n'
33-
+ ' Error: should not be deeply equivalent\n'
34-
+ ' [... stack stripped ...]\n'
35-
+ ' at Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)\n'
36-
+ ' [... stack stripped ...]\n'
37-
+ ' ...\n'
38-
+ '\n'
39-
+ '1..1\n'
40-
+ '# tests 1\n'
41-
+ '# pass 0\n'
42-
+ '# fail 1\n'
43-
);
20+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
21+
'TAP version 13',
22+
'# not deep equal',
23+
'not ok 1 should not be deeply equivalent',
24+
' ---',
25+
' operator: notDeepEqual',
26+
' expected: |-',
27+
' { b: 2 }',
28+
' actual: |-',
29+
' { b: 2 }',
30+
' at: Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)',
31+
' stack: |-',
32+
' Error: should not be deeply equivalent',
33+
' [... stack stripped ...]',
34+
' at Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)',
35+
' [... stack stripped ...]',
36+
' ...',
37+
'',
38+
'1..1',
39+
'# tests 1',
40+
'# pass 0',
41+
'# fail 1',
42+
''
43+
]);
4444

4545
assert.deepEqual(getDiag(body), {
4646
operator: 'notDeepEqual',
@@ -78,30 +78,30 @@ tap.test('not deep equal failure, depth 6, with option', function (assert) {
7878

7979
stream.pipe(parser);
8080
stream.pipe(concat(function (body) {
81-
assert.equal(
82-
stripFullStack(body.toString('utf8')),
83-
'TAP version 13\n'
84-
+ '# not deep equal\n'
85-
+ 'not ok 1 should not be deeply equivalent\n'
86-
+ ' ---\n'
87-
+ ' operator: notDeepEqual\n'
88-
+ ' expected: |-\n'
89-
+ ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }\n'
90-
+ ' actual: |-\n'
91-
+ ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }\n'
92-
+ ' at: Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)\n'
93-
+ ' stack: |-\n'
94-
+ ' Error: should not be deeply equivalent\n'
95-
+ ' [... stack stripped ...]\n'
96-
+ ' at Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)\n'
97-
+ ' [... stack stripped ...]\n'
98-
+ ' ...\n'
99-
+ '\n'
100-
+ '1..1\n'
101-
+ '# tests 1\n'
102-
+ '# pass 0\n'
103-
+ '# fail 1\n'
104-
);
81+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
82+
'TAP version 13',
83+
'# not deep equal',
84+
'not ok 1 should not be deeply equivalent',
85+
' ---',
86+
' operator: notDeepEqual',
87+
' expected: |-',
88+
' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }',
89+
' actual: |-',
90+
' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }',
91+
' at: Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)',
92+
' stack: |-',
93+
' Error: should not be deeply equivalent',
94+
' [... stack stripped ...]',
95+
' at Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)',
96+
' [... stack stripped ...]',
97+
' ...',
98+
'',
99+
'1..1',
100+
'# tests 1',
101+
'# pass 0',
102+
'# fail 1',
103+
''
104+
]);
105105

106106
assert.deepEqual(getDiag(body), {
107107
operator: 'notDeepEqual',
@@ -139,30 +139,30 @@ tap.test('not deep equal failure, depth 6, without option', function (assert) {
139139

140140
stream.pipe(parser);
141141
stream.pipe(concat(function (body) {
142-
assert.equal(
143-
stripFullStack(body.toString('utf8')),
144-
'TAP version 13\n'
145-
+ '# not deep equal\n'
146-
+ 'not ok 1 should not be deeply equivalent\n'
147-
+ ' ---\n'
148-
+ ' operator: notDeepEqual\n'
149-
+ ' expected: |-\n'
150-
+ ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }\n'
151-
+ ' actual: |-\n'
152-
+ ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }\n'
153-
+ ' at: Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)\n'
154-
+ ' stack: |-\n'
155-
+ ' Error: should not be deeply equivalent\n'
156-
+ ' [... stack stripped ...]\n'
157-
+ ' at Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)\n'
158-
+ ' [... stack stripped ...]\n'
159-
+ ' ...\n'
160-
+ '\n'
161-
+ '1..1\n'
162-
+ '# tests 1\n'
163-
+ '# pass 0\n'
164-
+ '# fail 1\n'
165-
);
142+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
143+
'TAP version 13',
144+
'# not deep equal',
145+
'not ok 1 should not be deeply equivalent',
146+
' ---',
147+
' operator: notDeepEqual',
148+
' expected: |-',
149+
' { a: { a1: { a2: { a3: { a4: [Object] } } } } }',
150+
' actual: |-',
151+
' { a: { a1: { a2: { a3: { a4: [Object] } } } } }',
152+
' at: Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)',
153+
' stack: |-',
154+
' Error: should not be deeply equivalent',
155+
' [... stack stripped ...]',
156+
' at Test.<anonymous> ($TEST/not-deep-equal-failure.js:$LINE:$COL)',
157+
' [... stack stripped ...]',
158+
' ...',
159+
'',
160+
'1..1',
161+
'# tests 1',
162+
'# pass 0',
163+
'# fail 1',
164+
''
165+
]);
166166

167167
assert.deepEqual(getDiag(body), {
168168
operator: 'notDeepEqual',

‎test/not-equal-failure.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ tap.test('not equal failure', function (assert) {
1717

1818
stream.pipe(parser);
1919
stream.pipe(concat(function (body) {
20-
assert.equal(
21-
stripFullStack(body.toString('utf8')),
22-
'TAP version 13\n'
23-
+ '# not equal\n'
24-
+ 'not ok 1 should not be strictly equal\n'
25-
+ ' ---\n'
26-
+ ' operator: notEqual\n'
27-
+ ' expected: 2\n'
28-
+ ' actual: 2\n'
29-
+ ' at: Test.<anonymous> ($TEST/not-equal-failure.js:$LINE:$COL)\n'
30-
+ ' stack: |-\n'
31-
+ ' Error: should not be strictly equal\n'
32-
+ ' [... stack stripped ...]\n'
33-
+ ' at Test.<anonymous> ($TEST/not-equal-failure.js:$LINE:$COL)\n'
34-
+ ' [... stack stripped ...]\n'
35-
+ ' ...\n'
36-
+ '\n'
37-
+ '1..1\n'
38-
+ '# tests 1\n'
39-
+ '# pass 0\n'
40-
+ '# fail 1\n'
41-
);
20+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
21+
'TAP version 13',
22+
'# not equal',
23+
'not ok 1 should not be strictly equal',
24+
' ---',
25+
' operator: notEqual',
26+
' expected: 2',
27+
' actual: 2',
28+
' at: Test.<anonymous> ($TEST/not-equal-failure.js:$LINE:$COL)',
29+
' stack: |-',
30+
' Error: should not be strictly equal',
31+
' [... stack stripped ...]',
32+
' at Test.<anonymous> ($TEST/not-equal-failure.js:$LINE:$COL)',
33+
' [... stack stripped ...]',
34+
' ...',
35+
'',
36+
'1..1',
37+
'# tests 1',
38+
'# pass 0',
39+
'# fail 1',
40+
''
41+
]);
4242

4343
assert.deepEqual(getDiag(body), {
4444
operator: 'notEqual',

‎test/numerics.js

+140-139
Original file line numberDiff line numberDiff line change
@@ -11,145 +11,146 @@ tap.test('numerics', function (tt) {
1111

1212
var test = tape.createHarness();
1313
test.createStream().pipe(concat(function (body) {
14-
tt.equal(
15-
stripFullStack(body.toString('utf8')),
16-
'TAP version 13\n'
17-
+ '# numeric strings\n'
18-
+ 'not ok 1 number equal to string\n'
19-
+ ' ---\n'
20-
+ ' operator: equal\n'
21-
+ ' expected: \'3\'\n'
22-
+ ' actual: 3\n'
23-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
24-
+ ' stack: |-\n'
25-
+ ' Error: number equal to string\n'
26-
+ ' [... stack stripped ...]\n'
27-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
28-
+ ' [... stack stripped ...]\n'
29-
+ ' ...\n'
30-
+ 'not ok 2 string equal to number\n'
31-
+ ' ---\n'
32-
+ ' operator: equal\n'
33-
+ ' expected: 3\n'
34-
+ ' actual: \'3\'\n'
35-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
36-
+ ' stack: |-\n'
37-
+ ' Error: string equal to number\n'
38-
+ ' [... stack stripped ...]\n'
39-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
40-
+ ' [... stack stripped ...]\n'
41-
+ ' ...\n'
42-
+ 'ok 3 number notEqual to string\n'
43-
+ 'ok 4 string notEqual to number\n'
44-
+ 'ok 5 number looseEqual to string\n'
45-
+ 'ok 6 string looseEqual to number\n'
46-
+ 'not ok 7 number notLooseEqual to string\n'
47-
+ ' ---\n'
48-
+ ' operator: notLooseEqual\n'
49-
+ ' expected: \'3\'\n'
50-
+ ' actual: 3\n'
51-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
52-
+ ' stack: |-\n'
53-
+ ' Error: number notLooseEqual to string\n'
54-
+ ' [... stack stripped ...]\n'
55-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
56-
+ ' [... stack stripped ...]\n'
57-
+ ' ...\n'
58-
+ 'not ok 8 string notLooseEqual to number\n'
59-
+ ' ---\n'
60-
+ ' operator: notLooseEqual\n'
61-
+ ' expected: 3\n'
62-
+ ' actual: \'3\'\n'
63-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
64-
+ ' stack: |-\n'
65-
+ ' Error: string notLooseEqual to number\n'
66-
+ ' [... stack stripped ...]\n'
67-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
68-
+ ' [... stack stripped ...]\n'
69-
+ ' ...\n'
70-
+ 'not ok 9 number strictEqual to string\n'
71-
+ ' ---\n'
72-
+ ' operator: equal\n'
73-
+ ' expected: \'3\'\n'
74-
+ ' actual: 3\n'
75-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
76-
+ ' stack: |-\n'
77-
+ ' Error: number strictEqual to string\n'
78-
+ ' [... stack stripped ...]\n'
79-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
80-
+ ' [... stack stripped ...]\n'
81-
+ ' ...\n'
82-
+ 'not ok 10 string strictEqual to number\n'
83-
+ ' ---\n'
84-
+ ' operator: equal\n'
85-
+ ' expected: 3\n'
86-
+ ' actual: \'3\'\n'
87-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
88-
+ ' stack: |-\n'
89-
+ ' Error: string strictEqual to number\n'
90-
+ ' [... stack stripped ...]\n'
91-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
92-
+ ' [... stack stripped ...]\n'
93-
+ ' ...\n'
94-
+ 'ok 11 number notStrictEqual to string\n'
95-
+ 'ok 12 string notStrictEqual to number\n'
96-
+ 'ok 13 number deepLooseEqual to string\n'
97-
+ 'ok 14 string deepLooseEqual to number\n'
98-
+ 'not ok 15 number notDeepLooseEqual to string\n'
99-
+ ' ---\n'
100-
+ ' operator: notDeepLooseEqual\n'
101-
+ ' expected: \'3\'\n'
102-
+ ' actual: 3\n'
103-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
104-
+ ' stack: |-\n'
105-
+ ' Error: number notDeepLooseEqual to string\n'
106-
+ ' [... stack stripped ...]\n'
107-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
108-
+ ' [... stack stripped ...]\n'
109-
+ ' ...\n'
110-
+ 'not ok 16 string notDeepLooseEqual to number\n'
111-
+ ' ---\n'
112-
+ ' operator: notDeepLooseEqual\n'
113-
+ ' expected: 3\n'
114-
+ ' actual: \'3\'\n'
115-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
116-
+ ' stack: |-\n'
117-
+ ' Error: string notDeepLooseEqual to number\n'
118-
+ ' [... stack stripped ...]\n'
119-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
120-
+ ' [... stack stripped ...]\n'
121-
+ ' ...\n'
122-
+ 'not ok 17 number deepEqual to string\n'
123-
+ ' ---\n'
124-
+ ' operator: deepEqual\n'
125-
+ ' expected: \'3\'\n'
126-
+ ' actual: 3\n'
127-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
128-
+ ' stack: |-\n'
129-
+ ' Error: number deepEqual to string\n'
130-
+ ' [... stack stripped ...]\n'
131-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
132-
+ ' [... stack stripped ...]\n'
133-
+ ' ...\n'
134-
+ 'not ok 18 string deepEqual to number\n'
135-
+ ' ---\n'
136-
+ ' operator: deepEqual\n'
137-
+ ' expected: 3\n'
138-
+ ' actual: \'3\'\n'
139-
+ ' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
140-
+ ' stack: |-\n'
141-
+ ' Error: string deepEqual to number\n'
142-
+ ' [... stack stripped ...]\n'
143-
+ ' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)\n'
144-
+ ' [... stack stripped ...]\n'
145-
+ ' ...\n'
146-
+ 'ok 19 number notDeepEqual to string\n'
147-
+ 'ok 20 string notDeepEqual to number\n'
148-
+ '\n1..20\n'
149-
+ '# tests 20\n'
150-
+ '# pass 10\n'
151-
+ '# fail 10\n'
152-
);
14+
tt.same(stripFullStack(body.toString('utf8')), [
15+
'TAP version 13',
16+
'# numeric strings',
17+
'not ok 1 number equal to string',
18+
' ---',
19+
' operator: equal',
20+
' expected: \'3\'',
21+
' actual: 3',
22+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
23+
' stack: |-',
24+
' Error: number equal to string',
25+
' [... stack stripped ...]',
26+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
27+
' [... stack stripped ...]',
28+
' ...',
29+
'not ok 2 string equal to number',
30+
' ---',
31+
' operator: equal',
32+
' expected: 3',
33+
' actual: \'3\'',
34+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
35+
' stack: |-',
36+
' Error: string equal to number',
37+
' [... stack stripped ...]',
38+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
39+
' [... stack stripped ...]',
40+
' ...',
41+
'ok 3 number notEqual to string',
42+
'ok 4 string notEqual to number',
43+
'ok 5 number looseEqual to string',
44+
'ok 6 string looseEqual to number',
45+
'not ok 7 number notLooseEqual to string',
46+
' ---',
47+
' operator: notLooseEqual',
48+
' expected: \'3\'',
49+
' actual: 3',
50+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
51+
' stack: |-',
52+
' Error: number notLooseEqual to string',
53+
' [... stack stripped ...]',
54+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
55+
' [... stack stripped ...]',
56+
' ...',
57+
'not ok 8 string notLooseEqual to number',
58+
' ---',
59+
' operator: notLooseEqual',
60+
' expected: 3',
61+
' actual: \'3\'',
62+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
63+
' stack: |-',
64+
' Error: string notLooseEqual to number',
65+
' [... stack stripped ...]',
66+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
67+
' [... stack stripped ...]',
68+
' ...',
69+
'not ok 9 number strictEqual to string',
70+
' ---',
71+
' operator: equal',
72+
' expected: \'3\'',
73+
' actual: 3',
74+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
75+
' stack: |-',
76+
' Error: number strictEqual to string',
77+
' [... stack stripped ...]',
78+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
79+
' [... stack stripped ...]',
80+
' ...',
81+
'not ok 10 string strictEqual to number',
82+
' ---',
83+
' operator: equal',
84+
' expected: 3',
85+
' actual: \'3\'',
86+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
87+
' stack: |-',
88+
' Error: string strictEqual to number',
89+
' [... stack stripped ...]',
90+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
91+
' [... stack stripped ...]',
92+
' ...',
93+
'ok 11 number notStrictEqual to string',
94+
'ok 12 string notStrictEqual to number',
95+
'ok 13 number deepLooseEqual to string',
96+
'ok 14 string deepLooseEqual to number',
97+
'not ok 15 number notDeepLooseEqual to string',
98+
' ---',
99+
' operator: notDeepLooseEqual',
100+
' expected: \'3\'',
101+
' actual: 3',
102+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
103+
' stack: |-',
104+
' Error: number notDeepLooseEqual to string',
105+
' [... stack stripped ...]',
106+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
107+
' [... stack stripped ...]',
108+
' ...',
109+
'not ok 16 string notDeepLooseEqual to number',
110+
' ---',
111+
' operator: notDeepLooseEqual',
112+
' expected: 3',
113+
' actual: \'3\'',
114+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
115+
' stack: |-',
116+
' Error: string notDeepLooseEqual to number',
117+
' [... stack stripped ...]',
118+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
119+
' [... stack stripped ...]',
120+
' ...',
121+
'not ok 17 number deepEqual to string',
122+
' ---',
123+
' operator: deepEqual',
124+
' expected: \'3\'',
125+
' actual: 3',
126+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
127+
' stack: |-',
128+
' Error: number deepEqual to string',
129+
' [... stack stripped ...]',
130+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
131+
' [... stack stripped ...]',
132+
' ...',
133+
'not ok 18 string deepEqual to number',
134+
' ---',
135+
' operator: deepEqual',
136+
' expected: 3',
137+
' actual: \'3\'',
138+
' at: Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
139+
' stack: |-',
140+
' Error: string deepEqual to number',
141+
' [... stack stripped ...]',
142+
' at Test.<anonymous> ($TEST/numerics.js:$LINE:$COL)',
143+
' [... stack stripped ...]',
144+
' ...',
145+
'ok 19 number notDeepEqual to string',
146+
'ok 20 string notDeepEqual to number',
147+
'',
148+
'1..20',
149+
'# tests 20',
150+
'# pass 10',
151+
'# fail 10',
152+
''
153+
]);
153154
}));
154155

155156
test('numeric strings', function (t) {

‎test/promise_fail.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ tap.test('callback returning rejected promise should cause that test (and only t
1919
return tt.pass('the test file indicated it should be skipped');
2020
}
2121

22-
var strippedString = stripFullStack(rowsString);
23-
var lines = strippedString.split('\n');
24-
lines = lines.filter(function (line) {
22+
var strippedString = stripFullStack(rowsString).filter(function (line) {
2523
return !/^(\s+)at(\s+)(?:Test\.)?<anonymous>(?:$|\s)/.test(line);
26-
});
27-
strippedString = lines.join('\n');
24+
}).join('\n');
2825

2926
// hack for consistency across all versions of node
3027
// some versions produce a longer stack trace for some reason
@@ -70,12 +67,9 @@ tap.test('subtest callback returning rejected promise should cause that subtest
7067
return tt.pass('the test file indicated it should be skipped');
7168
}
7269

73-
var strippedString = stripFullStack(rowsString);
74-
var lines = strippedString.split('\n');
75-
lines = lines.filter(function (line) {
70+
var strippedString = stripFullStack(rowsString).filter(function (line) {
7671
return !/^(\s+)at(\s+)(?:Test\.)?<anonymous>(?:$|\s)/.test(line);
77-
});
78-
strippedString = lines.join('\n');
72+
}).join('\n');
7973

8074
// hack for consistency across all versions of node
8175
// some versions produce a longer stack trace for some reason

‎test/skip_explanation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tap.test('test skip explanations', function (assert) {
99
assert.plan(1);
1010

1111
var verify = function (output) {
12-
assert.equal(stripFullStack(output.toString('utf8')), [
12+
assert.deepEqual(stripFullStack(output.toString('utf8')), [
1313
'TAP version 13',
1414
'# SKIP (this skips)',
1515
'# some tests might skip',
@@ -32,7 +32,7 @@ tap.test('test skip explanations', function (assert) {
3232
'',
3333
'# ok',
3434
''
35-
].join('\n'));
35+
]);
3636
};
3737

3838
var tapeTest = test.createHarness();

‎test/throws.js

+94-93
Original file line numberDiff line numberDiff line change
@@ -33,99 +33,100 @@ tap.test('failures', function (tt) {
3333

3434
var test = tape.createHarness();
3535
test.createStream().pipe(concat(function (body) {
36-
tt.equal(
37-
stripFullStack(body.toString('utf8')),
38-
'TAP version 13\n'
39-
+ '# non functions\n'
40-
+ 'ok 1 should throw\n'
41-
+ 'ok 2 should throw\n'
42-
+ 'ok 3 should throw\n'
43-
+ 'ok 4 should throw\n'
44-
+ 'ok 5 should throw\n'
45-
+ 'ok 6 should throw\n'
46-
+ 'ok 7 should throw\n'
47-
+ 'ok 8 should throw\n'
48-
+ '# function\n'
49-
+ 'not ok 9 should throw\n'
50-
+ ' ---\n'
51-
+ ' operator: throws\n'
52-
+ ' expected: undefined\n'
53-
+ ' actual: undefined\n'
54-
+ ' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
55-
+ ' stack: |-\n'
56-
+ ' Error: should throw\n'
57-
+ ' [... stack stripped ...]\n'
58-
+ ' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
59-
+ ' [... stack stripped ...]\n'
60-
+ ' ...\n'
61-
+ '# custom error messages\n'
62-
+ 'ok 10 "message" is enumerable\n'
63-
+ "ok 11 { custom: 'error', message: 'message' }\n"
64-
+ 'ok 12 getter is still the same\n'
65-
+ '# throws null\n'
66-
+ 'ok 13 throws null\n'
67-
+ '# wrong type of error\n'
68-
+ 'not ok 14 throws actual\n'
69-
+ ' ---\n'
70-
+ ' operator: throws\n'
71-
+ ' expected: |-\n'
72-
+ ' [Function: TypeError]\n'
73-
+ ' actual: |-\n'
74-
+ " { [RangeError: actual!] message: 'actual!' }\n"
75-
+ ' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
76-
+ ' stack: |-\n'
77-
+ ' RangeError: actual!\n'
78-
+ ' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
79-
+ ' [... stack stripped ...]\n'
80-
+ ' ...\n'
81-
+ '# object\n'
82-
+ 'ok 15 object properties are validated\n'
83-
+ '# object with regexes\n'
84-
+ 'ok 16 object with regex values is validated\n'
85-
+ '# similar error object\n'
86-
+ 'ok 17 throwing a similar error\n'
87-
+ '# validate with regex\n'
88-
+ 'ok 18 regex against toString of error\n'
89-
+ '# custom error validation\n'
90-
+ 'ok 19 error is SyntaxError\n'
91-
+ 'ok 20 error matches /value/\n'
92-
+ 'ok 21 unexpected error\n'
93-
+ '# throwing primitives\n'
94-
+ 'ok 22 primitive: null\n'
95-
+ 'ok 23 primitive: undefined\n'
96-
+ 'ok 24 primitive: 0\n'
97-
+ 'ok 25 primitive: NaN\n'
98-
+ 'ok 26 primitive: 42\n'
99-
+ 'ok 27 primitive: Infinity\n'
100-
+ 'ok 28 primitive: \'\'\n'
101-
+ 'ok 29 primitive: \'foo\'\n'
102-
+ 'ok 30 primitive: true\n'
103-
+ 'ok 31 primitive: false\n'
104-
+ '# ambiguous arguments\n'
105-
+ 'ok 32 Second\n'
106-
+ 'ok 33 Second\n'
107-
+ 'ok 34 Second\n'
108-
+ 'ok 35 should throw\n'
109-
+ 'not ok 36 should throw\n'
110-
+ ' ---\n'
111-
+ ' operator: throws\n'
112-
+ ' expected: |-\n'
113-
+ ' \'/Second$/\'\n'
114-
+ ' actual: |-\n'
115-
+ ' { [Error: First] message: \'First\' }\n'
116-
+ ' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
117-
+ ' stack: |-\n'
118-
+ ' Error: First\n'
119-
+ ' at throwingFirst ($TEST/throws.js:$LINE:$COL)\n'
120-
+ ' [... stack stripped ...]\n'
121-
+ ' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
122-
+ ' [... stack stripped ...]\n'
123-
+ ' ...\n'
124-
+ '\n1..36\n'
125-
+ '# tests 36\n'
126-
+ '# pass 33\n'
127-
+ '# fail 3\n'
128-
);
36+
tt.same(stripFullStack(body.toString('utf8')), [
37+
'TAP version 13',
38+
'# non functions',
39+
'ok 1 should throw',
40+
'ok 2 should throw',
41+
'ok 3 should throw',
42+
'ok 4 should throw',
43+
'ok 5 should throw',
44+
'ok 6 should throw',
45+
'ok 7 should throw',
46+
'ok 8 should throw',
47+
'# function',
48+
'not ok 9 should throw',
49+
' ---',
50+
' operator: throws',
51+
' expected: undefined',
52+
' actual: undefined',
53+
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)',
54+
' stack: |-',
55+
' Error: should throw',
56+
' [... stack stripped ...]',
57+
' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)',
58+
' [... stack stripped ...]',
59+
' ...',
60+
'# custom error messages',
61+
'ok 10 "message" is enumerable',
62+
"ok 11 { custom: 'error', message: 'message' }",
63+
'ok 12 getter is still the same',
64+
'# throws null',
65+
'ok 13 throws null',
66+
'# wrong type of error',
67+
'not ok 14 throws actual',
68+
' ---',
69+
' operator: throws',
70+
' expected: |-',
71+
' [Function: TypeError]',
72+
' actual: |-',
73+
" { [RangeError: actual!] message: 'actual!' }",
74+
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)',
75+
' stack: |-',
76+
' RangeError: actual!',
77+
' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)',
78+
' [... stack stripped ...]',
79+
' ...',
80+
'# object',
81+
'ok 15 object properties are validated',
82+
'# object with regexes',
83+
'ok 16 object with regex values is validated',
84+
'# similar error object',
85+
'ok 17 throwing a similar error',
86+
'# validate with regex',
87+
'ok 18 regex against toString of error',
88+
'# custom error validation',
89+
'ok 19 error is SyntaxError',
90+
'ok 20 error matches /value/',
91+
'ok 21 unexpected error',
92+
'# throwing primitives',
93+
'ok 22 primitive: null',
94+
'ok 23 primitive: undefined',
95+
'ok 24 primitive: 0',
96+
'ok 25 primitive: NaN',
97+
'ok 26 primitive: 42',
98+
'ok 27 primitive: Infinity',
99+
'ok 28 primitive: \'\'',
100+
'ok 29 primitive: \'foo\'',
101+
'ok 30 primitive: true',
102+
'ok 31 primitive: false',
103+
'# ambiguous arguments',
104+
'ok 32 Second',
105+
'ok 33 Second',
106+
'ok 34 Second',
107+
'ok 35 should throw',
108+
'not ok 36 should throw',
109+
' ---',
110+
' operator: throws',
111+
' expected: |-',
112+
' \'/Second$/\'',
113+
' actual: |-',
114+
' { [Error: First] message: \'First\' }',
115+
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)',
116+
' stack: |-',
117+
' Error: First',
118+
' at throwingFirst ($TEST/throws.js:$LINE:$COL)',
119+
' [... stack stripped ...]',
120+
' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)',
121+
' [... stack stripped ...]',
122+
' ...',
123+
'',
124+
'1..36',
125+
'# tests 36',
126+
'# pass 33',
127+
'# fail 3',
128+
''
129+
]);
129130
}));
130131

131132
test('non functions', function (t) {

‎test/timeoutAfter.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ tap.test('timeoutAfter test', function (tt) {
2525
'1..1',
2626
'# tests 1',
2727
'# pass 0',
28-
'# fail 1'
29-
].join('\n') + '\n');
28+
'# fail 1',
29+
''
30+
]);
3031
};
3132

3233
test.createStream().pipe(concat(tc));
@@ -65,8 +66,9 @@ tap.test('timeoutAfter with Promises', { skip: typeof Promise === 'undefined' },
6566
'1..2',
6667
'# tests 2',
6768
'# pass 0',
68-
'# fail 2'
69-
].join('\n') + '\n');
69+
'# fail 2',
70+
''
71+
]);
7072
};
7173

7274
test.createStream().pipe(concat(tc));

‎test/todo.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ tap.test('tape todo test', function (assert) {
1212
assert.plan(1);
1313

1414
test.createStream().pipe(concat(function (body) {
15-
assert.equal(
16-
stripFullStack(body.toString('utf8')),
17-
'TAP version 13\n'
18-
+ '# success\n'
19-
+ 'ok 1 this test runs\n'
20-
+ '# TODO failure\n'
21-
+ 'not ok 2 should never happen # TODO\n'
22-
+ ' ---\n'
23-
+ ' operator: fail\n'
24-
+ ' at: Test.<anonymous> ($TEST/todo.js:$LINE:$COL)\n'
25-
+ ' ...\n'
26-
+ '\n'
27-
+ '1..2\n'
28-
+ '# tests 2\n'
29-
+ '# pass 2\n'
30-
+ '\n'
31-
+ '# ok\n'
32-
);
15+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
16+
'TAP version 13',
17+
'# success',
18+
'ok 1 this test runs',
19+
'# TODO failure',
20+
'not ok 2 should never happen # TODO',
21+
' ---',
22+
' operator: fail',
23+
' at: Test.<anonymous> ($TEST/todo.js:$LINE:$COL)',
24+
' ...',
25+
'',
26+
'1..2',
27+
'# tests 2',
28+
'# pass 2',
29+
'',
30+
'# ok',
31+
''
32+
]);
3333
}));
3434

3535
test('success', function (t) {

‎test/todo_explanation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tap.test('tape todo test', { todo: process.versions.node.match(/0\.8\.\d+/) ? 'F
1212
assert.plan(1);
1313

1414
test.createStream().pipe(concat(function (body) {
15-
assert.equal(
15+
assert.deepEqual(
1616
stripFullStack(body.toString('utf8')), [
1717
'TAP version 13',
1818
'# success',
@@ -46,7 +46,7 @@ tap.test('tape todo test', { todo: process.versions.node.match(/0\.8\.\d+/) ? 'F
4646
'',
4747
'# ok',
4848
''
49-
].join('\n')
49+
]
5050
);
5151
}));
5252

‎test/todo_single.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ tap.test('tape todo test', function (assert) {
1212
assert.plan(1);
1313

1414
test.createStream().pipe(concat(function (body) {
15-
assert.equal(
16-
stripFullStack(body.toString('utf8')),
17-
'TAP version 13\n'
18-
+ '# TODO failure\n'
19-
+ 'not ok 1 should be strictly equal # TODO\n'
20-
+ ' ---\n'
21-
+ ' operator: equal\n'
22-
+ ' expected: false\n'
23-
+ ' actual: true\n'
24-
+ ' at: Test.<anonymous> ($TEST/todo_single.js:$LINE:$COL)\n'
25-
+ ' ...\n'
26-
+ '\n'
27-
+ '1..1\n'
28-
+ '# tests 1\n'
29-
+ '# pass 1\n'
30-
+ '\n'
31-
+ '# ok\n'
32-
);
15+
assert.deepEqual(stripFullStack(body.toString('utf8')), [
16+
'TAP version 13',
17+
'# TODO failure',
18+
'not ok 1 should be strictly equal # TODO',
19+
' ---',
20+
' operator: equal',
21+
' expected: false',
22+
' actual: true',
23+
' at: Test.<anonymous> ($TEST/todo_single.js:$LINE:$COL)',
24+
' ...',
25+
'',
26+
'1..1',
27+
'# tests 1',
28+
'# pass 1',
29+
'',
30+
'# ok',
31+
''
32+
]);
3333
}));
3434

3535
test('failure', { todo: true }, function (t) {

‎test/too_many.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ tap.test('array test', function (tt) {
3939
'1..6',
4040
'# tests 6',
4141
'# pass 5',
42-
'# fail 1'
43-
].join('\n') + '\n');
42+
'# fail 1',
43+
''
44+
]);
4445
};
4546

4647
test.createStream().pipe(concat(tc));

‎test/undef.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@ tap.test('array test', function (tt) {
1111

1212
var test = tape.createHarness();
1313
test.createStream().pipe(concat(function (body) {
14-
tt.equal(
15-
stripFullStack(body.toString('utf8')),
16-
'TAP version 13\n'
17-
+ '# undef\n'
18-
+ 'not ok 1 should be deeply equivalent\n'
19-
+ ' ---\n'
20-
+ ' operator: deepEqual\n'
21-
+ ' expected: |-\n'
22-
+ ' { beep: undefined }\n'
23-
+ ' actual: |-\n'
24-
+ ' {}\n'
25-
+ ' at: Test.<anonymous> ($TEST/undef.js:$LINE:$COL)\n'
26-
+ ' stack: |-\n'
27-
+ ' Error: should be deeply equivalent\n'
28-
+ ' [... stack stripped ...]\n'
29-
+ ' at Test.<anonymous> ($TEST/undef.js:$LINE:$COL)\n'
30-
+ ' [... stack stripped ...]\n'
31-
+ ' ...\n'
32-
+ '\n'
33-
+ '1..1\n'
34-
+ '# tests 1\n'
35-
+ '# pass 0\n'
36-
+ '# fail 1\n'
37-
);
14+
tt.same(stripFullStack(body.toString('utf8')), [
15+
'TAP version 13',
16+
'# undef',
17+
'not ok 1 should be deeply equivalent',
18+
' ---',
19+
' operator: deepEqual',
20+
' expected: |-',
21+
' { beep: undefined }',
22+
' actual: |-',
23+
' {}',
24+
' at: Test.<anonymous> ($TEST/undef.js:$LINE:$COL)',
25+
' stack: |-',
26+
' Error: should be deeply equivalent',
27+
' [... stack stripped ...]',
28+
' at Test.<anonymous> ($TEST/undef.js:$LINE:$COL)',
29+
' [... stack stripped ...]',
30+
' ...',
31+
'',
32+
'1..1',
33+
'# tests 1',
34+
'# pass 0',
35+
'# fail 1',
36+
''
37+
]);
3838
}));
3939

4040
test('undef', function (t) {

0 commit comments

Comments
 (0)
Please sign in to comment.