Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw when returned value is not a promise #1028

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions integration_tests/__tests__/promise_it-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ describe('promise it', () => {
expect(json.numPendingTests).toBe(1);
});

it('throws when not a promise is returned', () => {
const result = runJest.json('promise_it', ['returning_values-test.js']);
const json = result.json;

expect(json.numTotalTests).toBe(11);
expect(json.numPassedTests).toBe(0);
expect(json.numFailedTests).toBe(11);
expect(json.numPendingTests).toBe(0);
});

it('tests async promise code', () => {
const result = runJest.json('promise_it', ['promise_it-test.js']);
const json = result.json;
Expand Down
18 changes: 0 additions & 18 deletions integration_tests/promise_it/__tests__/returning_values-test.js

This file was deleted.

8 changes: 4 additions & 4 deletions packages/jest-jasmine2/src/jasmine-pit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function isPromise(obj) {
function promisifyIt(originalFn, env) {
return function(specName, fn) {
if (!fn) {
return;
return null;
}

const isAsync = fn.length; // `done` was passed
Expand All @@ -39,9 +39,9 @@ function promisifyIt(originalFn, env) {
} else if (returnValue === undefined) {
done();
} else {
done.fail(new Error(
'Jest: `it` must return either a Promise or undefined.'
));
// TODO: 'Jest: `it` must return either a Promise or undefined.'
// CoffeeScript has implicit returns, so we can't really throw here
done();
}
});
}
Expand Down