-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is @types/jest-environment-puppeteer still required? #568
Comments
@pyoor Thank you kind sir for this wisdom I was experiencing a similar issue and adding the latest In my case version |
I am unable to use
I see from lock file that using Directly @types/jest-environment-puppeteer/5.0.6 has dependencies: '@jest/types': 26.6.2
'@types/puppeteer': 5.4.7 <-- does not have FrameWaitForFunctionOptions
jest-environment-node: 27.5.1 |
The difference I see in the @types versus package is that the global additions are not declared. @types has: declare global {
const browser: Browser;
const context: BrowserContext;
const page: Page;
const jestPuppeteer: JestPuppeteer;
} Per the difficulties I ran into, I built a local @types/jest-environment-puppeteer that re-exports jest-environment-puppeteer with the addition of global declaration: declare global {
const browser: JestPuppeteerGlobal["browser"];
const context: JestPuppeteerGlobal["context"];
const page: JestPuppeteerGlobal["page"];
const jestPuppeteer: JestPuppeteerGlobal["jestPuppeteer"];
} |
Upgrades puppeteer and related dependencies to the latest version. - Fix some logic for a few typings that now come through properly. - Handle puppeteer breaking change of toMatch -> toMatchTextContext. - Use headless "shell" mode until use of new mode can be investigated. jest-environment-puppeteer is not providing typing for its globals, but old (stale types) @types/jest-environment-puppeteer will - see argos-ci/jest-puppeteer#568. expect-puppeteer however needs more recent puppeteer types that @types/jest-environment-puppeteer interferes with. So, force any lingering @types/puppeteer to just puppeteer Future: get jest-environment-puppeteer fixed or replace @types with our own to reduce garbage dependencies. --------- Co-authored-by: Tyler Butler <[email protected]> Co-authored-by: Daniel Lehenbauer <[email protected]>
…9548) Upgrades puppeteer and related dependencies to the latest version. - Fix some logic for a few typings that now come through properly. - Handle puppeteer breaking change of toMatch -> toMatchTextContext. - Use headless "shell" mode until use of new mode can be investigated. jest-environment-puppeteer is not providing typing for its globals, but old (stale types) @types/jest-environment-puppeteer will - see argos-ci/jest-puppeteer#568. expect-puppeteer however needs more recent puppeteer types that @types/jest-environment-puppeteer interferes with. So, force any lingering @types/puppeteer to just puppeteer Future: get jest-environment-puppeteer fixed or replace @types with our own to reduce garbage dependencies. --------- Co-authored-by: Tyler Butler <[email protected]> Co-authored-by: Daniel Lehenbauer <[email protected]>
Feel free to submit a PR to fix things if not correct please. |
After updating
jest-environment-puppeteer
to 9.0.1, I get the following typescript compiler error:error TS2304: Cannot find name 'page'
.The README notes that typescript definitions are now provided for jest-puppeteer versions > v8.0.0. However, the only way I'm able to resolve the issue is by installing the
@types/jest-environment-puppeteer
. Is this something wrong with my configuration?Relevant dependencies:
tsconfig.json:
jest.config.ts
The text was updated successfully, but these errors were encountered: