fix: test idempotency issues#51526
Merged
ckerr merged 7 commits intoMay 7, 2026
Merged
Conversation
The getPath(name) and setPath(name, path) describe blocks both call
app.setPath('music', ...) without restoring the original value. This
causes subsequent tests that call app.getPath('music') to get a
corrupted path if test ordering changes.
Capture the original music path and restore it in afterEach().
Co-authored-by: Charles Kerr <charles@charleskerr.com>
The commandLine.hasSwitch and commandLine.getSwitchValue tests append switches (foobar1, foobar) that are never removed. These persist for the entire process lifetime, which could affect tests that check for switch presence or absence if test ordering changes. Add afterEach hooks that call removeSwitch for each appended switch. Co-authored-by: Charles Kerr <charles@charleskerr.com>
The 'validates process APIs access in sandboxed renderer' test sets process.env.sandboxmain = 'foo' without cleaning it up. This env var persists for all subsequent tests and could affect tests that compare process.env snapshots. Use defer() to delete the env var after the test completes. Co-authored-by: Charles Kerr <charles@charleskerr.com>
The release-notes spec sets NOTES_CACHE_PATH in before() but never deletes it. This env var persists for all subsequent test files and could interfere with any code that checks for its presence. Add an after() hook to delete the env var when the suite completes. Co-authored-by: Charles Kerr <charles@charleskerr.com>
The app name tests restore app.name at the end of each test body. If an assertion fails before the restoration line, the name stays corrupted for all subsequent tests. Move restoration to an afterEach hook so it always runs, and remove the now-redundant inline restoration calls. Co-authored-by: Charles Kerr <charles@charleskerr.com>
The 'can download from custom protocols' test registers an HTTP protocol handler on session.defaultSession but never unregisters it. This handler persists globally and could interfere with other tests that use the same protocol name or the default session. Use defer() to ensure the protocol is unregistered after the test. Co-authored-by: Charles Kerr <charles@charleskerr.com>
The 'reporting api' test sets setCertificateVerifyProc on defaultSession to accept all certificates, but the finally block only destroys the window and closes the server. The permissive certificate handler persists globally, causing all subsequent tests using defaultSession HTTPS requests to skip certificate verification. Reset the handler to null in the finally block. Co-authored-by: Charles Kerr <charles@charleskerr.com>
ckerr
approved these changes
May 7, 2026
|
No Release Notes |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #51504
See that PR for details.
Notes: none.