Skip to content

Commit 1f1a4a7

Browse files
committed
Merge tag 'v4.14.0'
v4.14.0 - [New] add `.teardown()` on `t` instances (#546) - [New] Include name of test in log when test times out (#524) - [Refactor] avoid reassigning arguments - [Refactor] remove unused line, unneeded var initialization; add missing `new` - [Refactor] remove use of legacy `exports` - [Refactor] Avoid setting message property on primitives; use strict mode to catch this - [Refactor] generalize error message from calling `.end` more than once - [Refactor] use `call-bind/callBound` instead of `function-bind` directly - [readme] improve `t.throws` documentation (#541) - [readme] Another way to create custom reportersA (#556) - [readme] remove long-dead testling-ci badge - [readme] add `tape-describe` to 'other' section (#523) - [readme] remove travis badge; add actions and codecov badges - [eslint] remove useless regex escapes - [eslint] fully enable `@ljharb` eslint config - [meta] do not publish github action workflow files - [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+ - [meta] run `aud` in `posttest` - [Deps] update `glob`, `is-regex`, `object-inspect`, `resolve`, `string.prototype.trim` - [Dev Deps] update `eslint` - [actions] use `node/install` instead of `node/run`; use `codecov` action - [Tests] exclude examples from coverage - [Tests] ensure bin/tape is linted - [Tests] make `stripFullStack` output an array of lines, for better failure messages - [Tests] handle stack differences in node 15 - [Tests] add test case for #519 for test.comment() in createStream/objectMode context
2 parents d0a3888 + af5b2f2 commit 1f1a4a7

20 files changed

+163
-156
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
coverage/
2+
.nyc_output/

bin/tape

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ if (typeof opts.require === 'string') {
2727
opts.require.forEach(function (module) {
2828
var options = { basedir: cwd, extensions: Object.keys(require.extensions) };
2929
if (module) {
30-
/* This check ensures we ignore `-r ""`, trailing `-r`, or
31-
* other silly things the user might (inadvertently) be doing.
32-
*/
30+
// This check ensures we ignore `-r ""`, trailing `-r`, or other silly things the user might (inadvertently) be doing.
3331
require(resolveModule(module, options));
3432
}
3533
});

example/array.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ test('array', function (t) {
1919
});
2020

2121
var arrays = [
22-
[ 3, 4 ],
23-
[ 1, 2, [ 3, 4 ] ],
24-
[ 5, 6 ],
25-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
22+
[3, 4],
23+
[1, 2, [3, 4]],
24+
[5, 6],
25+
[[ 1, 2, [3, 4]], [5, 6]]
2626
];
2727

2828
Function(['fn', 'g'], output)(

example/nested.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ test('nested array test', function (t) {
77
t.plan(6);
88

99
var src = '(' + function () {
10-
var xs = [ 1, 2, [ 3, 4 ] ];
11-
var ys = [ 5, 6 ];
10+
var xs = [1, 2, [3, 4]];
11+
var ys = [5, 6];
1212
g([ xs, ys ]);
1313
} + ')()';
1414

example/too_many_fail.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ test('array', function (t) {
77
t.plan(3);
88

99
var src = '(' + function () {
10-
var xs = [ 1, 2, [ 3, 4 ] ];
11-
var ys = [ 5, 6 ];
10+
var xs = [1, 2, [3, 4]];
11+
var ys = [5, 6];
1212
g([ xs, ys ]);
1313
} + ')()';
1414

@@ -19,10 +19,10 @@ test('array', function (t) {
1919
});
2020

2121
var arrays = [
22-
[ 3, 4 ],
23-
[ 1, 2, [ 3, 4 ] ],
24-
[ 5, 6 ],
25-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
22+
[3, 4],
23+
[1, 2, [3, 4]],
24+
[5, 6],
25+
[[1, 2, [3, 4]], [5, 6]]
2626
];
2727

2828
Function(['fn', 'g'], output)(
@@ -31,7 +31,7 @@ test('array', function (t) {
3131
return xs;
3232
},
3333
function (xs) {
34-
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
34+
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
3535
}
3636
);
3737
});

test/array.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ tap.test('array test', function (tt) {
3232
t.plan(5);
3333

3434
var src = '(' + function () {
35-
var xs = [ 1, 2, [ 3, 4 ] ];
36-
var ys = [ 5, 6 ];
37-
g([ xs, ys ]);
35+
var xs = [1, 2, [3, 4]];
36+
var ys = [5, 6];
37+
g([xs, ys]);
3838
} + ')()';
3939

4040
var output = falafel(src, function (node) {
@@ -44,10 +44,10 @@ tap.test('array test', function (tt) {
4444
});
4545

4646
var arrays = [
47-
[ 3, 4 ],
48-
[ 1, 2, [ 3, 4 ] ],
49-
[ 5, 6 ],
50-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
47+
[3, 4],
48+
[1, 2, [3, 4]],
49+
[5, 6],
50+
[[1, 2, [3, 4]], [5, 6]]
5151
];
5252

5353
Function(['fn', 'g'], output)(
@@ -56,7 +56,7 @@ tap.test('array test', function (tt) {
5656
return xs;
5757
},
5858
function (xs) {
59-
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
59+
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
6060
}
6161
);
6262
});

test/async-await.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (Number(majorVersion) < 8) {
1414

1515
tap.test('async1', function (t) {
1616
runProgram('async-await', 'async1.js', function (r) {
17-
t.same(r.stdout.toString('utf8'), [
17+
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
1818
'TAP version 13',
1919
'# async1',
2020
'ok 1 before await',
@@ -24,8 +24,10 @@ tap.test('async1', function (t) {
2424
'# tests 2',
2525
'# pass 2',
2626
'',
27-
'# ok'
28-
].join('\n') + '\n\n');
27+
'# ok',
28+
'',
29+
''
30+
]);
2931
t.same(r.exitCode, 0);
3032
t.same(r.stderr.toString('utf8'), '');
3133
t.end();
@@ -39,7 +41,7 @@ tap.test('async2', function (t) {
3941
return !(/^(\s+)at(\s+)<anonymous>$/).test(line);
4042
});
4143

42-
t.same(stripFullStack(lines.join('\n')), [
44+
t.deepEqual(stripFullStack(lines.join('\n')), [
4345
'TAP version 13',
4446
'# async2',
4547
'ok 1 before await',
@@ -70,7 +72,7 @@ tap.test('async2', function (t) {
7072

7173
tap.test('async3', function (t) {
7274
runProgram('async-await', 'async3.js', function (r) {
73-
t.same(r.stdout.toString('utf8'), [
75+
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
7476
'TAP version 13',
7577
'# async3',
7678
'ok 1 before await',
@@ -80,8 +82,10 @@ tap.test('async3', function (t) {
8082
'# tests 2',
8183
'# pass 2',
8284
'',
83-
'# ok'
84-
].join('\n') + '\n\n');
85+
'# ok',
86+
'',
87+
''
88+
]);
8589
t.same(r.exitCode, 0);
8690
t.same(r.stderr.toString('utf8'), '');
8791
t.end();
@@ -90,7 +94,7 @@ tap.test('async3', function (t) {
9094

9195
tap.test('async4', function (t) {
9296
runProgram('async-await', 'async4.js', function (r) {
93-
t.same(stripFullStack(r.stdout.toString('utf8')), [
97+
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
9498
'TAP version 13',
9599
'# async4',
96100
'ok 1 before await',

test/comment.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tap.test('no comment', function (assert) {
1010
assert.plan(1);
1111

1212
var verify = function (output) {
13-
assert.equal(output.toString('utf8'), [
13+
assert.deepEqual(output.toString('utf8').split('\n'), [
1414
'TAP version 13',
1515
'# no comment',
1616
'',
@@ -20,7 +20,7 @@ tap.test('no comment', function (assert) {
2020
'',
2121
'# ok',
2222
''
23-
].join('\n'));
23+
]);
2424
};
2525

2626
var test = tape.createHarness();

test/deep.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ var test = require('../');
44

55
test('deep strict equal', function (t) {
66
t.notDeepEqual(
7-
[ { a: '3' } ],
8-
[ { a: 3 } ]
7+
[{ a: '3' }],
8+
[{ a: 3 }]
99
);
1010
t.end();
1111
});
1212

1313
test('deep loose equal', function (t) {
1414
t.deepLooseEqual(
15-
[ { a: '3' } ],
16-
[ { a: 3 } ]
15+
[{ a: '3' }],
16+
[{ a: 3 }]
1717
);
1818
t.end();
1919
});

test/exit/fail.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ test('array', function (t) {
77
t.plan(5);
88

99
var src = '(' + function () {
10-
var xs = [ 1, 2, [ 3, 4 ] ];
11-
var ys = [ 5, 6 ];
12-
g([ xs, ys ]);
10+
var xs = [1, 2, [3, 4]];
11+
var ys = [5, 6];
12+
g([xs, ys]);
1313
} + ')()';
1414

1515
var output = falafel(src, function (node) {
@@ -19,10 +19,10 @@ test('array', function (t) {
1919
});
2020

2121
var arrays = [
22-
[ 3, 4 ],
23-
[ 1, 2, [ 3, 4 ] ],
24-
[ 5, 6 ],
25-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
22+
[3, 4],
23+
[1, 2, [3, 4]],
24+
[5, 6],
25+
[[1, 2, [3, 4]], [5, 6]]
2626
];
2727

2828
Function(['fn', 'g'], output)(
@@ -31,7 +31,7 @@ test('array', function (t) {
3131
return xs;
3232
},
3333
function (xs) {
34-
t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]);
34+
t.same(xs, [[1, 2, [3, 4444]], [5, 6]]);
3535
}
3636
);
3737
});

test/exit/ok.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ test('array', function (t) {
88
t.plan(5);
99

1010
var src = '(' + function () {
11-
var xs = [ 1, 2, [ 3, 4 ] ];
12-
var ys = [ 5, 6 ];
13-
g([ xs, ys ]);
11+
var xs = [1, 2, [3, 4]];
12+
var ys = [5, 6];
13+
g([xs, ys]);
1414
} + ')()';
1515

1616
var output = falafel(src, function (node) {
@@ -20,10 +20,10 @@ test('array', function (t) {
2020
});
2121

2222
var arrays = [
23-
[ 3, 4 ],
24-
[ 1, 2, [ 3, 4 ] ],
25-
[ 5, 6 ],
26-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
23+
[3, 4],
24+
[1, 2, [3, 4]],
25+
[5, 6],
26+
[[1, 2, [3, 4]], [5, 6]]
2727
];
2828

2929
Function(['fn', 'g'], output)(
@@ -32,7 +32,7 @@ test('array', function (t) {
3232
return xs;
3333
},
3434
function (xs) {
35-
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
35+
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
3636
}
3737
);
3838
});

test/exit/too_few.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ test('array', function (t) {
77
t.plan(6);
88

99
var src = '(' + function () {
10-
var xs = [ 1, 2, [ 3, 4 ] ];
11-
var ys = [ 5, 6 ];
12-
g([ xs, ys ]);
10+
var xs = [1, 2, [3, 4]];
11+
var ys = [5, 6];
12+
g([xs, ys]);
1313
} + ')()';
1414

1515
var output = falafel(src, function (node) {
@@ -19,10 +19,10 @@ test('array', function (t) {
1919
});
2020

2121
var arrays = [
22-
[ 3, 4 ],
23-
[ 1, 2, [ 3, 4 ] ],
24-
[ 5, 6 ],
25-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
22+
[3, 4],
23+
[1, 2, [3, 4]],
24+
[5, 6],
25+
[[1, 2, [3, 4]], [5, 6]]
2626
];
2727

2828
Function(['fn', 'g'], output)(
@@ -31,7 +31,7 @@ test('array', function (t) {
3131
return xs;
3232
},
3333
function (xs) {
34-
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
34+
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
3535
}
3636
);
3737
});

test/fail.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ tap.test('array test', function (tt) {
4949
t.plan(5);
5050

5151
var src = '(' + function () {
52-
var xs = [ 1, 2, [ 3, 4 ] ];
53-
var ys = [ 5, 6 ];
54-
g([ xs, ys ]);
52+
var xs = [1, 2, [3, 4]];
53+
var ys = [5, 6];
54+
g([xs, ys]);
5555
} + ')()';
5656

5757
var output = falafel(src, function (node) {
@@ -61,10 +61,10 @@ tap.test('array test', function (tt) {
6161
});
6262

6363
var arrays = [
64-
[ 3, 4 ],
65-
[ 1, 2, [ 3, 4 ] ],
66-
[ 5, 6 ],
67-
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
64+
[3, 4],
65+
[1, 2, [3, 4]],
66+
[5, 6],
67+
[[1, 2, [3, 4]], [5, 6]]
6868
];
6969

7070
Function(['fn', 'g'], output)(
@@ -73,7 +73,7 @@ tap.test('array test', function (tt) {
7373
return xs;
7474
},
7575
function (xs) {
76-
t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]);
76+
t.same(xs, [[1, 2, [3, 4444]], [5, 6]]);
7777
}
7878
);
7979
});

test/nested-sync-noplan-noend.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tap.test('nested sync test without plan or end', function (tt) {
99

1010
var test = tape.createHarness();
1111
var tc = function (rows) {
12-
tt.same(rows.toString('utf8'), [
12+
tt.same(rows.toString('utf8').split('\n'), [
1313
'TAP version 13',
1414
'# nested without plan or end',
1515
'# first',
@@ -21,8 +21,9 @@ tap.test('nested sync test without plan or end', function (tt) {
2121
'# tests 2',
2222
'# pass 2',
2323
'',
24-
'# ok'
25-
].join('\n') + '\n');
24+
'# ok',
25+
''
26+
]);
2627
};
2728

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

0 commit comments

Comments
 (0)