Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Using root-cause jest integration with typescript (ts-jest) #24

Open
talkl opened this issue Sep 21, 2020 · 6 comments
Open

Using root-cause jest integration with typescript (ts-jest) #24

talkl opened this issue Sep 21, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@talkl
Copy link

talkl commented Sep 21, 2020

Hi, i'm trying to use Root Cause Jest integration and see the results locally, but because i'm using a page of puppeteer-cluster i suspect the results are not logged to root cause, when i tried to use the page, as shown in the jest example, it couldn't understand where page variable is defined (I'm using typescript).
So when i open npx root-cause show i see nothing.

Thank you guys

@benjamingr
Copy link
Contributor

Hey, interesting.

Any chance you can make a repro repository?

So when i open npx root-cause show i see nothing.

When you say nothing, do you mean "no runs found" or "a run with no screenshots"?

it couldn't understand where page variable is defined (I'm using typescript).

Root cause (automatic integration) expects a page global variable (globalThis.page) like jest-puppeteer defines. You can use root-cause without jest-puppeteer or defining a global using the lower-level .attach API.

I suspect that https://github.com/thomasdondorf/puppeteer-cluster would require you to (instead of using the setupFilesAfterEnv jest hook) use rootCause.attach directly on the pages inside cluster.task

@benjamingr benjamingr added the bug Something isn't working label Sep 21, 2020
@benjamingr
Copy link
Contributor

@Bnaya any chance we can add a (small) example of puppeteer-cluster to our examples?

@Bnaya
Copy link
Contributor

Bnaya commented Sep 21, 2020

Seems that puppeteer-cluster is mostly for scraping,
would need to hear more about @talkl use case

@talkl
Copy link
Author

talkl commented Sep 21, 2020

@Bnaya @benjamingr ok i decided to go with the page that is attached with the jest puppeteer integration since i guess i will avoid bugs that can happen from not using the recommended way of getting a page. i would just add in the documentation this line const page = (global as any).page;
or else typescript yells that it doesn't understand where is page defined.

@talkl talkl changed the title Root Cause Jest integration - blank npx root-cause show <result-id> page Using root-cause jest integration with typescript (ts-jest) Sep 21, 2020
@benjamingr
Copy link
Contributor

We use TypeScript throughout this project - you can see integration examples in https://github.com/testimio/root-cause/tree/main/integration-examples - I'll hit you up (on FB)

@Bnaya
Copy link
Contributor

Bnaya commented Oct 27, 2020

Hey @talkl, I'm closing this issue,
if the problem persists please open new one
Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants