I'm trying to deploy the Jest-Puppeteer-example from The Jest documentation here on my machine. While the test functions without a problem, IntelliSense does not seem to correctly interpret the global_this.__BROWSER_GLOBAL__
from setup.js
as a Browser
object, neither within the module, nor outside of it, even though it recognizes global_this
as a module. Other Jest or Puppeteer-related functionality is interpreted correctly by IntelliSense.
Is there a way to have IntelliSense recognize the global_this.__BROWSER_GLOBAL__
object as a Browser
-object?
I tried running npm i @types/puppeteer
before I noticed that it seems to have been a problem with globalThis
. What I expected from that is that IntelliSense would start working on global_this.__BROWSER_GLOBAL__
, but it didn't.
I also tried turning the test file into a Typescript file and adding the following to the top of it:
const puppeteer = require('puppeteer');
var browser : puppeteer.Browser = globalThis.__BROWSER_GLOBAL__;
and replacing the other reference to globalThis.BROWSER_GLOBAL with a reference to the browser variable.
This has caused several issues:
- Within VSCode:
Cannot find namespace 'puppeteer'.
- When trying to run the test, Justjs does not recognize the Typescript Syntax and runs into an error.
- IntelliSense still doesn't give me correct autocompletion on the browser variable.