Pytorch-NLU
Pytorch-NLU copied to clipboard
Using root-cause jest integration with typescript (ts-jest)
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
Thank you guys
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
@Bnaya any chance we can add a (small) example of puppeteer-cluster to our examples?
Seems that puppeteer-cluster is mostly for scraping, would need to hear more about @talkl use case
@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.
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)
Hey @talkl, I'm closing this issue, if the problem persists please open new one Thanks!