MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

deps/v8/test/wasm-js/third_party/testharness.js:526–554  ·  view source on GitHub ↗
(func, name, properties)

Source from the content-addressed store, hash-verified

524 * API functions
525 */
526 function test(func, name, properties)
527 {
528 if (tests.promise_setup_called) {
529 tests.status.status = tests.status.ERROR;
530 tests.status.message = '`test` invoked after `promise_setup`';
531 tests.complete();
532 }
533 var test_name = name ? name : test_environment.next_default_test_name();
534 var test_obj = new Test(test_name, properties);
535 var value = test_obj.step(func, test_obj, test_obj);
536
537 if (value !== undefined) {
538 var msg = "Test named \"" + test_name +
539 "\" inappropriately returned a value";
540
541 try {
542 if (value && value.hasOwnProperty("then")) {
543 msg += ", consider using `promise_test` instead";
544 }
545 } catch (err) {}
546
547 tests.status.status = tests.status.ERROR;
548 tests.status.message = msg;
549 }
550
551 if (test_obj.phase === test_obj.phases.STARTED) {
552 test_obj.done();
553 }
554 }
555
556 function async_test(func, name, properties)
557 {

Callers 1

generate_testsFunction · 0.70

Calls 3

completeMethod · 0.45
hasOwnPropertyMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…