Skip to content

Commit

Permalink
to have items satisfying: Don't use bubble mode, it makes the output …
Browse files Browse the repository at this point in the history
…worse.
  • Loading branch information
papandreou committed Sep 4, 2015
1 parent cea5982 commit 33968d7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion documentation/api/promise-any.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ return expect.promise.any({
aggregate error
0: expected '42' to be a number after a short delay
1: expected [ 0, '1', 2 ]
to have values satisfying expect.it('to be a number after a short delay')
to have items satisfying expect.it('to be a number after a short delay')
[
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ expect([ [0, 1, 2], [4, '5', '6'], [7, '8', 9] ],

```output
expected [ [ 0, 1, 2 ], [ 4, '5', '6' ], [ 7, '8', 9 ] ]
to have values satisfying 'to have items satisfying', 'to be a number'
to have items satisfying 'to have items satisfying', 'to be a number'
[
[...],
Expand All @@ -54,7 +54,7 @@ expect([0, 1, 2, 3, 4], 'to have items satisfying',
```

```output
expected [ 0, 1, 2, 3, 4 ] to have values satisfying
expected [ 0, 1, 2, 3, 4 ] to have items satisfying
expect.it('to be a number')
.and('to be positive')
Expand Down
2 changes: 1 addition & 1 deletion lib/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ module.exports = function (expect) {
}
this.errorMode = 'nested';
expect(subject, 'to be non-empty');
this.errorMode = 'bubble';
this.errorMode = 'default';
return expect.apply(expect, [subject, 'to have values satisfying'].concat(extraArgs));
});

Expand Down
6 changes: 3 additions & 3 deletions test/documentation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ describe("documentation tests", function () {
"aggregate error\n" +
" 0: expected '42' to be a number after a short delay\n" +
" 1: expected [ 0, '1', 2 ]\n" +
" to have values satisfying expect.it('to be a number after a short delay')\n" +
" to have items satisfying expect.it('to be a number after a short delay')\n" +
"\n" +
" [\n" +
" 0,\n" +
Expand Down Expand Up @@ -2230,7 +2230,7 @@ describe("documentation tests", function () {
} catch (e) {
expect(e, "to have message",
"expected [ [ 0, 1, 2 ], [ 4, '5', '6' ], [ 7, '8', 9 ] ]\n" +
"to have values satisfying 'to have items satisfying', 'to be a number'\n" +
"to have items satisfying 'to have items satisfying', 'to be a number'\n" +
"\n" +
"[\n" +
" [...],\n" +
Expand Down Expand Up @@ -2259,7 +2259,7 @@ describe("documentation tests", function () {
});
} catch (e) {
expect(e, "to have message",
"expected [ 0, 1, 2, 3, 4 ] to have values satisfying\n" +
"expected [ 0, 1, 2, 3, 4 ] to have items satisfying\n" +
"expect.it('to be a number')\n" +
" .and('to be positive')\n" +
"\n" +
Expand Down
32 changes: 18 additions & 14 deletions test/unexpected.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4102,17 +4102,21 @@ describe('unexpected', function () {
});
});
}, 'to throw',
"expected array to have values satisfying\n" +
"function (item) {\n" +
" expect.fail(function (output) {\n" +
" output.text('foo').nl().text('bar');\n" +
" });\n" +
"}\n" +
"\n" +
"[\n" +
" [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] // foo\n" +
" // bar\n" +
"]");
"expected\n" +
"[\n" +
" [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]\n" +
"]\n" +
"to have items satisfying\n" +
"function (item) {\n" +
" expect.fail(function (output) {\n" +
" output.text('foo').nl().text('bar');\n" +
" });\n" +
"}\n" +
"\n" +
"[\n" +
" [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] // foo\n" +
" // bar\n" +
"]");
});

it('supports legacy "to be an array whose items satisfy"', function () {
Expand Down Expand Up @@ -4146,7 +4150,7 @@ describe('unexpected', function () {
expect(item, 'to be less than', 4);
});
}, 'to throw',
"expected [ 0, 1, '2', 3, 4 ] to have values satisfying\n" +
"expected [ 0, 1, '2', 3, 4 ] to have items satisfying\n" +
"function (item) {\n" +
" expect(item, 'to be a number');\n" +
" expect(item, 'to be less than', 4);\n" +
Expand All @@ -4169,7 +4173,7 @@ describe('unexpected', function () {
});
});
}, 'to throw',
"expected [ [ 0, 1, 2 ], [ 4, '5', 6 ], [ 7, 8, '9' ] ] to have values satisfying\n" +
"expected [ [ 0, 1, 2 ], [ 4, '5', 6 ], [ 7, 8, '9' ] ] to have items satisfying\n" +
"function (arr) {\n" +
" expect(arr, 'to have items satisfying', function (item) {\n" +
" expect(item, 'to be a number');\n" +
Expand Down Expand Up @@ -4212,7 +4216,7 @@ describe('unexpected', function () {
clonedExpect([0, false, 'abc'], 'to have items satisfying', 'to be a number after a short delay'),
'to be rejected',
"expected [ 0, false, 'abc' ]\n" +
"to have values satisfying 'to be a number after a short delay'\n" +
"to have items satisfying 'to be a number after a short delay'\n" +
"\n" +
"[\n" +
" 0,\n" +
Expand Down

0 comments on commit 33968d7

Please sign in to comment.