Skip to content

Commit

Permalink
Merge tag 'v4.14.0'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ljharb committed Jul 28, 2021
2 parents d0a3888 + af5b2f2 commit 1f1a4a7
Show file tree
Hide file tree
Showing 20 changed files with 163 additions and 156 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -1 +1,2 @@
coverage/
.nyc_output/
4 changes: 1 addition & 3 deletions bin/tape
Expand Up @@ -27,9 +27,7 @@ if (typeof opts.require === 'string') {
opts.require.forEach(function (module) {
var options = { basedir: cwd, extensions: Object.keys(require.extensions) };
if (module) {
/* This check ensures we ignore `-r ""`, trailing `-r`, or
* other silly things the user might (inadvertently) be doing.
*/
// This check ensures we ignore `-r ""`, trailing `-r`, or other silly things the user might (inadvertently) be doing.
require(resolveModule(module, options));
}
});
Expand Down
8 changes: 4 additions & 4 deletions example/array.js
Expand Up @@ -19,10 +19,10 @@ test('array', function (t) {
});

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[ 1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand Down
4 changes: 2 additions & 2 deletions example/nested.js
Expand Up @@ -7,8 +7,8 @@ test('nested array test', function (t) {
t.plan(6);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([ xs, ys ]);
} + ')()';

Expand Down
14 changes: 7 additions & 7 deletions example/too_many_fail.js
Expand Up @@ -7,8 +7,8 @@ test('array', function (t) {
t.plan(3);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([ xs, ys ]);
} + ')()';

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

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand All @@ -31,7 +31,7 @@ test('array', function (t) {
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
}
);
});
16 changes: 8 additions & 8 deletions test/array.js
Expand Up @@ -32,9 +32,9 @@ tap.test('array test', function (tt) {
t.plan(5);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([xs, ys]);
} + ')()';

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

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand All @@ -56,7 +56,7 @@ tap.test('array test', function (tt) {
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
}
);
});
Expand Down
20 changes: 12 additions & 8 deletions test/async-await.js
Expand Up @@ -14,7 +14,7 @@ if (Number(majorVersion) < 8) {

tap.test('async1', function (t) {
runProgram('async-await', 'async1.js', function (r) {
t.same(r.stdout.toString('utf8'), [
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
'TAP version 13',
'# async1',
'ok 1 before await',
Expand All @@ -24,8 +24,10 @@ tap.test('async1', function (t) {
'# tests 2',
'# pass 2',
'',
'# ok'
].join('\n') + '\n\n');
'# ok',
'',
''
]);
t.same(r.exitCode, 0);
t.same(r.stderr.toString('utf8'), '');
t.end();
Expand All @@ -39,7 +41,7 @@ tap.test('async2', function (t) {
return !(/^(\s+)at(\s+)<anonymous>$/).test(line);
});

t.same(stripFullStack(lines.join('\n')), [
t.deepEqual(stripFullStack(lines.join('\n')), [
'TAP version 13',
'# async2',
'ok 1 before await',
Expand Down Expand Up @@ -70,7 +72,7 @@ tap.test('async2', function (t) {

tap.test('async3', function (t) {
runProgram('async-await', 'async3.js', function (r) {
t.same(r.stdout.toString('utf8'), [
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
'TAP version 13',
'# async3',
'ok 1 before await',
Expand All @@ -80,8 +82,10 @@ tap.test('async3', function (t) {
'# tests 2',
'# pass 2',
'',
'# ok'
].join('\n') + '\n\n');
'# ok',
'',
''
]);
t.same(r.exitCode, 0);
t.same(r.stderr.toString('utf8'), '');
t.end();
Expand All @@ -90,7 +94,7 @@ tap.test('async3', function (t) {

tap.test('async4', function (t) {
runProgram('async-await', 'async4.js', function (r) {
t.same(stripFullStack(r.stdout.toString('utf8')), [
t.deepEqual(stripFullStack(r.stdout.toString('utf8')), [
'TAP version 13',
'# async4',
'ok 1 before await',
Expand Down
4 changes: 2 additions & 2 deletions test/comment.js
Expand Up @@ -10,7 +10,7 @@ tap.test('no comment', function (assert) {
assert.plan(1);

var verify = function (output) {
assert.equal(output.toString('utf8'), [
assert.deepEqual(output.toString('utf8').split('\n'), [
'TAP version 13',
'# no comment',
'',
Expand All @@ -20,7 +20,7 @@ tap.test('no comment', function (assert) {
'',
'# ok',
''
].join('\n'));
]);
};

var test = tape.createHarness();
Expand Down
8 changes: 4 additions & 4 deletions test/deep.js
Expand Up @@ -4,16 +4,16 @@ var test = require('../');

test('deep strict equal', function (t) {
t.notDeepEqual(
[ { a: '3' } ],
[ { a: 3 } ]
[{ a: '3' }],
[{ a: 3 }]
);
t.end();
});

test('deep loose equal', function (t) {
t.deepLooseEqual(
[ { a: '3' } ],
[ { a: 3 } ]
[{ a: '3' }],
[{ a: 3 }]
);
t.end();
});
Expand Down
16 changes: 8 additions & 8 deletions test/exit/fail.js
Expand Up @@ -7,9 +7,9 @@ test('array', function (t) {
t.plan(5);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([xs, ys]);
} + ')()';

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

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand All @@ -31,7 +31,7 @@ test('array', function (t) {
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]);
t.same(xs, [[1, 2, [3, 4444]], [5, 6]]);
}
);
});
16 changes: 8 additions & 8 deletions test/exit/ok.js
Expand Up @@ -8,9 +8,9 @@ test('array', function (t) {
t.plan(5);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([xs, ys]);
} + ')()';

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

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand All @@ -32,7 +32,7 @@ test('array', function (t) {
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
}
);
});
16 changes: 8 additions & 8 deletions test/exit/too_few.js
Expand Up @@ -7,9 +7,9 @@ test('array', function (t) {
t.plan(6);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([xs, ys]);
} + ')()';

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

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand All @@ -31,7 +31,7 @@ test('array', function (t) {
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
}
);
});
16 changes: 8 additions & 8 deletions test/fail.js
Expand Up @@ -49,9 +49,9 @@ tap.test('array test', function (tt) {
t.plan(5);

var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
var xs = [1, 2, [3, 4]];
var ys = [5, 6];
g([xs, ys]);
} + ')()';

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

var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
[3, 4],
[1, 2, [3, 4]],
[5, 6],
[[1, 2, [3, 4]], [5, 6]]
];

Function(['fn', 'g'], output)(
Expand All @@ -73,7 +73,7 @@ tap.test('array test', function (tt) {
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]);
t.same(xs, [[1, 2, [3, 4444]], [5, 6]]);
}
);
});
Expand Down
7 changes: 4 additions & 3 deletions test/nested-sync-noplan-noend.js
Expand Up @@ -9,7 +9,7 @@ tap.test('nested sync test without plan or end', function (tt) {

var test = tape.createHarness();
var tc = function (rows) {
tt.same(rows.toString('utf8'), [
tt.same(rows.toString('utf8').split('\n'), [
'TAP version 13',
'# nested without plan or end',
'# first',
Expand All @@ -21,8 +21,9 @@ tap.test('nested sync test without plan or end', function (tt) {
'# tests 2',
'# pass 2',
'',
'# ok'
].join('\n') + '\n');
'# ok',
''
]);
};

test.createStream().pipe(concat(tc));
Expand Down

0 comments on commit 1f1a4a7

Please sign in to comment.