Preserve values across test re-runs in Watch mode #2803
-
How can we persist values across test runs that occur in Watch mode? For example, I'd like to
My use case is creating a pool of Puppeteer pages that can quickly be obtained and worked with. These pages take > 5s to authenticate and load, and I'd like the Puppeteer browser and created pages to be reused to avoid the instantiation times. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This would be possible using the experimental shared workers feature. Keep in mind though that test files run in fresh contexts, so you won't be able to directly share the Puppeteer API. |
Beta Was this translation helpful? Give feedback.
-
I will look into the shared workers. My current workaround is to launch Chrome with a debugging port and use $ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222 import puppeteer from 'puppeteer-core'
puppeteer.connect({
browserURL: 'http://127.0.0.1:9222/json/version',
...
}) |
Beta Was this translation helpful? Give feedback.
This would be possible using the experimental shared workers feature.
Keep in mind though that test files run in fresh contexts, so you won't be able to directly share the Puppeteer API.