Jest Setup and share global variables

Viewed 1175

I am using Jest to write Puppeteer tests and I want to do a single time setup(of opening a browser) and share it across all the tests.

The setup I need to do is returns a promise.

I tried used setupTestFrameworkScriptFile and set global.browser

But this global.browser is not available

If I set it in the global config of Jest, I can write custom logic of setting the browser object

Like event If I declare __BROWSER__ I cant set it

__BROWSER__ = await puppeteer.launch({
    headless: false,
    ignoreHTTPSErrors: true,
    dumpio: true,
    devtools: false
  });
0 Answers
Related