Comments (4)
Actually, I realized that the proposed fix I mentioned suppresses the error and lets the tests be run, but the user profile is not stored in the specified directory. So, the proposed fixes don't actually work.
from jest-puppeteer.
Update: was actually able to solve this issue by modifying my Jest config file to have maxWorkers
set to 1. I'm now able to specify the userDataDir
parameter in the launch
options, and have tests run and user profile state persisted.
I realized this because when I specified the userDataDir
parameter (set to ./tmp
) with headless
set to true, I got this error:
Error: Jest: Got error running globalSetup - node_modules/jest-environment-puppeteer/setup.js, reason: Failed to launch the browser process! undefined
[83873:259:0405/141345.099847:ERROR:process_singleton_posix.cc(335)] Failed to create tmp/SingletonLock: File exists (17)
[83873:259:0405/141345.106931:ERROR:chrome_main_delegate.cc(590)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start multiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.
So it seems like having multiple Jest workers creates an issue with setting up a shared user profile. For now, I think it would be great if this issue is documented; I'm not sure what the fix for this would be
from jest-puppeteer.
Hello @alisha, I am not sure it's relative to jest-puppeteer itself then. So what is the issue exactly? Because this option is documented in Puppeteer: https://pptr.dev/api/puppeteer.browserlaunchargumentoptions
from jest-puppeteer.
Sorry the initial bug report was unclear -- I realized what the actual issue (mentioned here) is after submitting the initial report.
The actual issue is how Jest and Puppeteer integrate together. If you have multiple Jest workers, they will all launch simultaneous browser processes. If you specify a single user data directory in your jest-puppeteer config, all of these processes will share the same user data directory; and Chromium will abort the processes because of potential file system concurrency issues. As a result, the user sees a generic error message and their tests never run.
The fix is simple: use a single Jest worker if you need to specify the user data directory. I think it would be great for this to be documented somewhere, as I had to spend a lot of time to figure this out, and I'd love to spare other users that time spent debugging.
from jest-puppeteer.
Related Issues (20)
- Dependency Errors Using `npm i` HOT 2
- Cannot find module 'node:stream' on fresh install HOT 1
- Compiler errors importing `JestPuppeteerConfig` interface HOT 2
- Compiler errors extending `PuppeteerEnvironment`
- Compiler errors accessing `PuppeteerEnvironment` globals HOT 1
- Jest preset not working with latest jest and jest-puppeteer HOT 6
- Snapshot serializers added with `expect.addSnapshotSerializer` are not used HOT 3
- Remove Warning On New Headless Setting HOT 5
- Many browser windows open when running tests HOT 3
- [jest-dev-server] not working server.usedPortAction: 'ignore' config when running React application with react-scripts
- Invariant: WORKERS_COUNT not found HOT 4
- @types/expect-puppeteer no such type toMatchTextContent HOT 1
- Using jest-puppeteer with nx HOT 4
- How can I launch jest-puppeteer with args? HOT 1
- Regression: `injectGlobals:false` no longer supported ("Cannot convert undefined or null to object") HOT 1
- Puppeteer 21 regression: `[object Object] is not supported` HOT 4
- Is @types/jest-environment-puppeteer still required? HOT 3
- jest-dev-server - "kill" missing in "usedPortAction" type definition HOT 1
- TypeError: page.removeListener is not a function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest-puppeteer.