MCPcopy Create free account
hub / github.com/nodejs/node / promise_setup

Function promise_setup

deps/v8/test/wasm-js/third_party/testharness.js:850–886  ·  view source on GitHub ↗
(func, maybe_properties)

Source from the content-addressed store, hash-verified

848 }
849
850 function promise_setup(func, maybe_properties)
851 {
852 if (typeof func !== "function") {
853 tests.set_status(tests.status.ERROR,
854 "promise_test invoked without a function");
855 tests.complete();
856 return;
857 }
858 tests.promise_setup_called = true;
859
860 if (!tests.promise_tests) {
861 tests.promise_tests = Promise.resolve();
862 }
863
864 tests.promise_tests = tests.promise_tests
865 .then(function()
866 {
867 var properties = maybe_properties || {};
868 var result;
869
870 tests.setup(null, properties);
871 result = func();
872 test_environment.on_new_harness_properties(properties);
873
874 if (!result || typeof result.then !== "function") {
875 throw "Non-thenable returned by function passed to `promise_setup`";
876 }
877 return result;
878 })
879 .catch(function(e)
880 {
881 tests.set_status(tests.status.ERROR,
882 String(e),
883 e && e.stack);
884 tests.complete();
885 });
886 }
887
888 function done() {
889 if (tests.tests.length === 0) {

Callers

nothing calls this directly

Calls 6

StringClass · 0.85
funcFunction · 0.50
completeMethod · 0.45
resolveMethod · 0.45
thenMethod · 0.45
setupMethod · 0.45

Tested by

no test coverage detected