function done() {
        if (tests.tests.length === 0) {
            // `done` is invoked after handling uncaught exceptions, so if the
            // harness status is already set, the corresponding message is more
            // descriptive than the generic message defined here.
            if (tests.status.status === null) {
                tests.status.status = tests.status.ERROR;
                tests.status.message = "done() was called without first defining any tests";
            }

            tests.complete();
            return;
        }
        if (tests.file_is_test) {
            // file is test files never have asynchronous cleanup logic,
            // meaning the fully-synchronous `done` function can be used here.
            tests.tests[0].done();
        }
        tests.end_wait();
    }
Mark test loading as complete.

Typically this function is called implicitly on page load; it's
only necessary for users to call this when either the
``explicit_done`` or ``single_page`` properties have been set
via the :js:func:`setup` function.

For single page tests this marks the test as complete and sets its status.
For other tests, this marks test loading as complete, but doesn't affect ongoing tests.