Repository navigation
fix(electron): report a failed ffmpeg download as ELECTRON_INSTALL_FAILED and read a package.json with a byte order mark #2502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+65
−10
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a92c60f
fix(electron): probe the PATH's ffmpeg once when it has none
kdy1 a2ce261
docs(electron): give the order the engine finds ffmpeg in
kdy1 06ccb28
fix(electron): download the Electron binary once when two runs start …
kdy1 a9ff846
fix(electron): say when a run waits on the Electron install lock, and…
kdy1 31d02dd
fix(electron): hold the install lock until a cancelled download's ins…
kdy1 5217b25
fix(electron): report a failed ffmpeg download as ELECTRON_INSTALL_FA…
kdy1 040d2c3
fix(electron): read an app's package.json that starts with a byte ord…
kdy1 e277c19
fix(electron): put back a fresh install lock another run took while t…
kdy1 081d0a7
test(electron): check the install lock's path with the platform's sep…
kdy1 6844b68
chore(electron): add a changeset for the install lock and ffmpeg fixes
kdy1 9ffff0e
docs(electron): leave the order the engine finds ffmpeg in to the ref…
kdy1 663c7f4
fix(electron): remove a stale install lock under a takeover lock inst…
kdy1 50702ff
fix(electron): remove only the install lock this run took when its do…
kdy1 ffe4ffd
test(electron): cancel the download once the fixture's install.js lis…
kdy1 c11e499
docs(electron): say a failed ffmpeg download fails the recording in t…
kdy1 de353b8
revert(electron): remove the install lock by path again when the down…
kdy1 5bfd9e1
fix(electron): leave the Electron download lock to #2470
kdy1 03aea09
chore(electron): describe only the ffmpeg and package.json fixes in a…
kdy1 05604a8
test(electron): check that a machine with no ffmpeg is probed once an…
kdy1 b5fbb8b
chore(electron): say the PATH's ffmpeg is checked once per process in…
kdy1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@e2e-dev/electron': patch | ||
| --- | ||
|
|
||
| A failed download of ffmpeg for video fails with `ELECTRON_INSTALL_FAILED`, as a failed Electron download does, instead of `ENGINE_FAILURE`. A machine with no ffmpeg on its `PATH` is checked once per process, not once per recording, and an app's `package.json` that starts with a byte order mark passes the `app.appPath` check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { mkdtempSync, rmSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import path from 'node:path'; | ||
| import { InfrastructureError } from '@e2e-dev/core/engine'; | ||
| import { afterAll, describe, expect, it, vi } from 'vitest'; | ||
|
|
||
| // Every probe of the PATH's ffmpeg finds one without VP9, as on a machine with no ffmpeg. | ||
| const probes = vi.hoisted(() => ({ count: 0 })); | ||
| vi.mock('node:child_process', async (importOriginal) => { | ||
| const actual = await importOriginal<typeof import('node:child_process')>(); | ||
| return { | ||
| ...actual, | ||
| spawnSync: () => { | ||
| probes.count += 1; | ||
| return { status: 1, stdout: '', stderr: '' }; | ||
| }, | ||
| }; | ||
| }); | ||
|
|
||
| const { ensureFfmpeg } = await import('../../src/ffmpeg.ts'); | ||
|
|
||
| const cache = mkdtempSync(path.join(tmpdir(), 'e2e-electron-ffmpeg-')); | ||
| afterAll(() => { | ||
| vi.unstubAllGlobals(); | ||
| rmSync(cache, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| describe('ensureFfmpeg', () => { | ||
| it('checks the PATH for ffmpeg once, and fails a download that failed with ELECTRON_INSTALL_FAILED', async () => { | ||
| vi.stubGlobal('fetch', async () => new Response('', { status: 500 })); | ||
| // An empty cache, so each call reaches the PATH, then the download. | ||
| const env = { E2E_BROWSERS_PATH: cache }; | ||
| for (let attempt = 0; attempt < 2; attempt += 1) { | ||
| const failure: unknown = await ensureFfmpeg(env, new AbortController().signal).catch((cause: unknown) => cause); | ||
| expect(failure).toBeInstanceOf(InfrastructureError); | ||
| expect(failure).toMatchObject({ code: 'ELECTRON_INSTALL_FAILED', message: expect.stringContaining('HTTP 500') }); | ||
| } | ||
| expect(probes.count).toBe(1); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.