Repository navigation
Labels
42-x-ybug 🪲ci-flake ⭕️Issues specific to CI flakes, not bugs, if a bug happens to be related to a CI flake merge themcomponent/desktopcapturerplatform/macOS
Description
Confirmation
- I am a maintainer of the Electron project. (If not, please create a different issue type.)
Description
The desktopCapturer tests are flaky on macos-x64 in CI (both darwin and mas).
Logs
Failure in test: "desktopCapturer should return a non-empty array of sources"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (1/3)...
Failure in test: "desktopCapturer should return a non-empty array of sources"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (2/3)...
Failure in test: "desktopCapturer should return a non-empty array of sources"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (3/3)...
not ok 78 desktopCapturer should return a non-empty array of sources
Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at listOnTimeout (node:internal/timers:605:17)
at processTimers (node:internal/timers:541:7)
ok 79 desktopCapturer throws an error for invalid options
Failure in test: "desktopCapturer does not throw an error when called more than once (regression)"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (1/3)...
Failure in test: "desktopCapturer does not throw an error when called more than once (regression)"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (2/3)...
Failure in test: "desktopCapturer does not throw an error when called more than once (regression)"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (3/3)...
not ok 80 desktopCapturer does not throw an error when called more than once (regression)
Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at listOnTimeout (node:internal/timers:605:17)
at processTimers (node:internal/timers:541:7)
Failure in test: "desktopCapturer responds to subsequent calls of different options"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (1/3)...
Failure in test: "desktopCapturer responds to subsequent calls of different options"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (2/3)...
Failure in test: "desktopCapturer responds to subsequent calls of different options"
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
Retrying test (3/3)...
not ok 81 desktopCapturer responds to subsequent calls of different options
Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/api-desktop-capturer-spec.ts)
at listOnTimeout (node:internal/timers:605:17)
at processTimers (node:internal/timers:541:7)
ok 82 desktopCapturer returns an empty display_id for window sources
ok 83 desktopCapturer returns display_ids matching the Screen API
ok 84 desktopCapturer enabling thumbnail should return non-empty images
ok 85 desktopCapturer disabling thumbnail should return empty images
ok 86 desktopCapturer getMediaSourceId should match DesktopCapturerSource.id
ok 87 desktopCapturer getSources should not incorrectly duplicate window_id
ok 88 desktopCapturer does not affect window resizable state
ok 89 desktopCapturer moveAbove should move the window at the requested place
Example runs:
- https://github.com/electron/electron/actions/runs/24536707895/job/71740316880
- Tests failed, then succeeded later when they were retried
- https://github.com/electron/electron/actions/runs/24532356638/job/71726205800
- Tests failed, then succeeded later when they were retried
- https://github.com/electron/electron/actions/runs/24529741067/job/71720589688
- Tests failed, then succeeded later when they were retried
- https://github.com/electron/electron/actions/runs/24540027968/job/71748822796
- Tests failed, then succeeded later when they were retried
- https://github.com/electron/electron/actions/runs/24540027968/job/71748822797
- Tests failed, then succeeded later when they were retried
- https://github.com/electron/electron/actions/runs/24560181390/job/71811733867
- Tests failed, then succeeded later when they were retried
- https://github.com/electron/electron/actions/runs/24529005866/job/71741701441
- Tests also failed when retried
When investigating, look at the full macos-x64 test logs and search for desktopCapturer. You will see lots of timeouts.
CC @ckerr who recently did work trying to fix desktopCapturer tests.
Metadata
Metadata
Assignees
Labels
42-x-ybug 🪲ci-flake ⭕️Issues specific to CI flakes, not bugs, if a bug happens to be related to a CI flake merge themcomponent/desktopcapturerplatform/macOS
Type
Projects
- StatusShow more project fields🛠️ Fixed for Next Release
Activity
nikwen commentedon Apr 17, 2026
Given that these time out, I assume that the promise returned by
desktopCapturer.getSources()never resolves.nikwen commentedon Apr 17, 2026
It seems like this is the PR where it started happening: #51068
When I look at the CI runs for all commits on main, the timeouts did not occur before this PR.
They happened on every commit after this PR.
nikwen commentedon Apr 17, 2026
It's not obvious at first sight why that PR would be causing these timeouts.
Just some ideas:
BrowserWindows / destroying thewebContentsin those tests would fix it.api-media-handler-spec.tsoperate on a random session. I wonder if that would help.nikwen commentedon Apr 17, 2026
This seems to be the real root cause: #51125
I noticed that the order in which tests were run changed after #51068. Maybe some side effect of another test made the tests work before. Then the change in order broke them.
ckerr commentedon Apr 17, 2026
@nikwen should this be closed as superseded by #51125 ?
nikwen commentedon Apr 17, 2026
We can do that. :)
desktopCapturer.getSources()hangs indefinitely on macOS #51125