internalBootstrapBrowserTest function

void internalBootstrapBrowserTest(
  1. Function getMain(), {
  2. StreamChannel<Object?>? testChannel,
})

Bootstraps a browser test to communicate with the test runner.

Implementation

void internalBootstrapBrowserTest(Function Function() getMain,
    {StreamChannel<Object?>? testChannel}) {
  var channel = serializeSuite(getMain, hidePrints: false,
      beforeLoad: (suiteChannel) async {
    var serialized = await suiteChannel('test.browser.mapper').stream.first;
    if (serialized is! Map) return;
    setStackTraceMapper(JSStackTraceMapper.deserialize(serialized)!);
  });
  (testChannel ?? postMessageChannel()).pipe(channel);
}