Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

Require "thenable" for promise_test #252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion testharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,19 @@ policies and contribution forms [3].
});
var promise = test.step(func, test, test);
test.step(function() {
assert_not_equals(promise, undefined);
var message;

if (promise === undefined || promise === null) {
message = "Function provided to `promise_test` did not return a value.";
} else if (typeof promise.then !== "function") {
message = "Function provided to `promise_test` did not return a \"thenable\" value.";
}

if (message) {
tests.status.message = message;
tests.status.status = tests.status.ERROR;
throw new Error('testharness.js: ' + message);
}
});
Promise.resolve(promise).then(
function() {
Expand Down