In case of a more procedural code we test using nclosure node module as a first line of defense (again without ever depending on host object, which is possible, but rare in client side development).
There is the concept of mocked objects, if a class behavior / correctness need to be tested, it is better to do mocking of the dependencies if possible.
Compiled tests: We do so by exporting the required symbols in a new namespace and then require in there the tested module. Then the module is compiled. It can then be included as a script tag and it will have the needed symbol available. Another approach (in case modules are already used in the project for example) is to include a new module with the tests inside and run the compiler with the module specified. Then in the main module require the test module. This will also be helpful with your other issue: the need to have the whole app running when the tests are run.
As a whole the scenarios described are possible, but I would recommend rethinking the whole test story. If for example a test fails when the whole app is loaded in the browser, how would one determine the cause of the issue if only a single module is tested that depends on 10 others which in their turn depends on 30 others. On some projects the list of files pulled might be over a thousand.