Skip to content

Commit

Permalink
Merge 120ee73 into 7d3b2ef
Browse files Browse the repository at this point in the history
  • Loading branch information
depfu[bot] committed Nov 11, 2019
2 parents 7d3b2ef + 120ee73 commit 4281843
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 13 deletions.
27 changes: 22 additions & 5 deletions lib/assertions.js
Expand Up @@ -1605,7 +1605,10 @@ module.exports = expect => {
toSatisfyMatrix[aIndex][bIndex] = err;
return false;
}
result.then(() => {}, () => {});
result.then(
() => {},
() => {}
);
if (result.isPending()) {
isAsync = true;
return false;
Expand Down Expand Up @@ -2247,7 +2250,10 @@ module.exports = expect => {

expect.addAssertion('<function> to be rejected', (expect, subject) => {
expect.errorMode = 'nested';
return expect(expect.promise(() => subject()), 'to be rejected');
return expect(
expect.promise(() => subject()),
'to be rejected'
);
});

expect.addAssertion(
Expand Down Expand Up @@ -2310,7 +2316,10 @@ module.exports = expect => {

expect.addAssertion('<function> to be fulfilled', (expect, subject) => {
expect.errorMode = 'nested';
return expect(expect.promise(() => subject()), 'to be fulfilled');
return expect(
expect.promise(() => subject()),
'to be fulfilled'
);
});

expect.addAssertion(
Expand Down Expand Up @@ -2396,7 +2405,11 @@ module.exports = expect => {
'<function> when rejected <assertion>',
(expect, subject, ...rest) => {
expect.errorMode = 'nested';
return expect(expect.promise(() => subject()), 'when rejected', ...rest);
return expect(
expect.promise(() => subject()),
'when rejected',
...rest
);
}
);

Expand Down Expand Up @@ -2442,7 +2455,11 @@ module.exports = expect => {
'<function> when fulfilled <assertion>',
(expect, subject, ...rest) => {
expect.errorMode = 'nested';
return expect(expect.promise(() => subject()), 'when fulfilled', ...rest);
return expect(
expect.promise(() => subject()),
'when fulfilled',
...rest
);
}
);

Expand Down
2 changes: 1 addition & 1 deletion lib/createTopLevelExpect.js
Expand Up @@ -815,7 +815,7 @@ expectPrototype.addType = function(type, childExpect) {
}

extendedType.inspect = function(obj, depth, output, inspect) {
if (arguments.length < 2 || (!output || !output.isMagicPen)) {
if (arguments.length < 2 || !output || !output.isMagicPen) {
return `type: ${type.name}`;
} else if (childExpect) {
const childOutput = childExpect.createOutput(output.format);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -63,7 +63,7 @@
"node-version-check": "^2.2.0",
"nyc": "^14.0.0",
"offline-github-changelog": "^1.6.1",
"prettier": "~1.18.2",
"prettier": "~1.19.1",
"rollup": "^1.0.1",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-multi-entry": "^2.1.0",
Expand Down
6 changes: 5 additions & 1 deletion test/assertions/to-have-items-satisfying.spec.js
Expand Up @@ -215,7 +215,11 @@ describe('to have items satisfying assertion', () => {
expect(
function() {
expect(
[[0, 1, 2], [4, '5', 6], [7, 8, '9']],
[
[0, 1, 2],
[4, '5', 6],
[7, 8, '9']
],
'to have items satisfying',
// prettier-ignore
expect.it(function(arr) {
Expand Down
6 changes: 5 additions & 1 deletion test/assertions/to-have-values-satisfying.spec.js
Expand Up @@ -33,7 +33,11 @@ describe('to have values satisfying assertion', () => {
it('only accepts objects and arrays as the target', () => {
expect(
function() {
expect(42, 'to have values satisfying', expect.it(function(value) {}));
expect(
42,
'to have values satisfying',
expect.it(function(value) {})
);
},
'to throw',
'expected 42 to have values satisfying expect.it(function (value) {})\n' +
Expand Down
5 changes: 4 additions & 1 deletion test/assertions/when-passed-as-parameter-to.spec.js
Expand Up @@ -36,7 +36,10 @@ describe('when passed as parameters to assertion', () => {

it('should combine with other assertions (showcase)', () => {
expect(
[[1, 2], [3, 4]],
[
[1, 2],
[3, 4]
],
'to have items satisfying',
'when passed as parameters to',
add,
Expand Down
5 changes: 4 additions & 1 deletion test/types/Promise-type.spec.js
Expand Up @@ -54,7 +54,10 @@ describe('Promise type', () => {
describe('with a Bluebird promise (that supports synchronous inspection)', () => {
it('should inspect a pending promise', () => {
var promise = expect.promise(function(run) {
setTimeout(run(function() {}), 0);
setTimeout(
run(function() {}),
0
);
});
expect(promise, 'to inspect as', 'Promise (pending)');
return promise;
Expand Down
12 changes: 10 additions & 2 deletions test/utils.spec.js
Expand Up @@ -54,11 +54,19 @@ describe('utils', () => {

describe('#getFunctionName', () => {
it('should return the name of a named function', () => {
expect(utils.getFunctionName(function foo() {}), 'to equal', 'foo');
expect(
utils.getFunctionName(function foo() {}),
'to equal',
'foo'
);
});

it('should return the empty string for an anonymous function', () => {
expect(utils.getFunctionName(function() {}), 'to equal', '');
expect(
utils.getFunctionName(function() {}),
'to equal',
''
);
});

describe('with Function.prototype.toString mocked out', () => {
Expand Down

0 comments on commit 4281843

Please sign in to comment.