Skip to content

Conversation

ckerr
Copy link
Member

@ckerr ckerr commented Apr 26, 2025

Description of Change

Enable the mocha/no-nested-tests warning and fix the pre-existing instances. This fixes a problem that caused 57 tests to not be run.

Fixes #46806.

Notes: none.

Checklist

Release Notes

Notes: none.

@ckerr ckerr added the semver/patch backwards-compatible bug fixes label Apr 26, 2025
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Apr 26, 2025
@ckerr ckerr changed the title fix: mocha/no-nested-tests fix: enable mocha/no-nested-tests in eslint Apr 26, 2025
Copy link
Member

@nikwen nikwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@nikwen
Copy link
Member

nikwen commented Apr 26, 2025

Looks like some of the re-enabled tests are failing.

@ckerr
Copy link
Member Author

ckerr commented Apr 26, 2025

Yep, not great.

On the Windows size, windows-x64, windows-x86, and windows-arm64 all have the same three test failures:

2025-04-26T02:23:16.8606168Z not ok 221 BrowserWindow module sizing BrowserWindow.getNormalBounds() Fullscreen state with properties does not go fullscreen if roundedCorners are enabled
2025-04-26T02:23:16.8607043Z   expected true to be false
2025-04-26T02:23:16.8607677Z   AssertionError: expected true to be false
2025-04-26T02:23:16.8608235Z       at Context.<anonymous> (electron\spec\api-browser-window-spec.ts:2113:45)
2025-04-26T02:23:16.8608753Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T02:23:48.0526349Z not ok 437 BrowserWindow module window states (excluding Linux) visibleOnAllWorkspaces state with properties can be changed
2025-04-26T02:23:48.0528216Z   expected false to be true
2025-04-26T02:23:48.0528624Z   AssertionError: expected false to be true
2025-04-26T02:23:48.0529218Z       at Context.<anonymous> (electron\spec\api-browser-window-spec.ts:5456:54)
2025-04-26T02:23:48.0530687Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T02:23:48.1109508Z not ok 438 BrowserWindow module window states (excluding Linux) visibleOnAllWorkspaces state with functions can be changed
2025-04-26T02:23:48.1112440Z   expected false to be true
2025-04-26T02:23:48.1113848Z   AssertionError: expected false to be true
2025-04-26T02:23:48.1114879Z       at Context.<anonymous> (electron\spec\api-browser-window-spec.ts:5465:58)
2025-04-26T02:23:48.1115796Z       at processImmediate (node:internal/timers:491:21)

@ckerr
Copy link
Member Author

ckerr commented Apr 26, 2025

not ok 437 BrowserWindow module window states (excluding Linux) visibleOnAllWorkspaces state with properties can be changed

not ok 438 BrowserWindow module window states (excluding Linux) visibleOnAllWorkspaces state with functions can be changed

These two failures are to be expected: win.visibleOnAllWorkspaces is not supported on Windows, so I'll disable them there. In addition, this test probably should be enabled on Linux since the feature is supported on that platform? 😵

@ckerr
Copy link
Member Author

ckerr commented Apr 26, 2025

Lots of "new" failures in macOS:

2025-04-26T01:52:44.6552870Z not ok 243 BrowserWindow module autoHideMenuBar state for properties can be set with autoHideMenuBar constructor option
2025-04-26T01:52:44.6643840Z   autoHideMenuBar: expected false to be true
2025-04-26T01:52:44.6716210Z   AssertionError: autoHideMenuBar: expected false to be true
2025-04-26T01:52:44.6718060Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:2370:45)
2025-04-26T01:52:44.6747980Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:52:44.7865730Z not ok 244 BrowserWindow module autoHideMenuBar state for properties can be changed
2025-04-26T01:52:44.7891580Z   autoHideMenuBar: expected false to be true
2025-04-26T01:52:44.7925710Z   AssertionError: autoHideMenuBar: expected false to be true
2025-04-26T01:52:44.7959440Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:2377:45)
2025-04-26T01:52:44.7996940Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:52:45.0030270Z not ok 245 BrowserWindow module autoHideMenuBar state for functions can be set with autoHideMenuBar constructor option
2025-04-26T01:52:45.0435800Z   autoHideMenuBar: expected false to be true
2025-04-26T01:52:45.1438800Z   AssertionError: autoHideMenuBar: expected false to be true
2025-04-26T01:52:45.1917040Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:2386:49)
2025-04-26T01:52:45.2026080Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:52:45.2259920Z not ok 246 BrowserWindow module autoHideMenuBar state for functions can be changed
2025-04-26T01:52:45.2287570Z   autoHideMenuBar: expected false to be true
2025-04-26T01:52:45.2314990Z   AssertionError: autoHideMenuBar: expected false to be true
2025-04-26T01:52:45.2336710Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:2393:49)
2025-04-26T01:52:45.2337730Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:43.6147370Z not ok 426 BrowserWindow module window states resizable state with properties can be set with resizable constructor option
2025-04-26T01:53:43.7150620Z   maximizable: expected false to be true
2025-04-26T01:53:43.8152880Z   AssertionError: maximizable: expected false to be true
2025-04-26T01:53:43.8412840Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5228:45)
2025-04-26T01:53:43.8415100Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:43.8420100Z not ok 428 BrowserWindow module window states resizable state with functions can be set with resizable constructor option
2025-04-26T01:53:43.8422710Z   maximizable: expected false to be true
2025-04-26T01:53:43.8424570Z   AssertionError: maximizable: expected false to be true
2025-04-26T01:53:43.8426530Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5248:49)
2025-04-26T01:53:43.8429070Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:45.1113600Z not ok 441 BrowserWindow module window states (excluding Linux) representedFilename with properties can be changed
2025-04-26T01:53:45.1115230Z   expected '/Users/runner/work/electron/electron/src/~/work/electron/electron/src/a name' to deeply equal 'a name'
2025-04-26T01:53:45.1117140Z   AssertionError: expected '/Users/runner/work/electron/electron/src/~/work/electron/electron/src/a name' to deeply equal 'a name'
2025-04-26T01:53:45.1118610Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5496:44)
2025-04-26T01:53:45.1119460Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:45.2325430Z not ok 442 BrowserWindow module window states (excluding Linux) representedFilename with functions can be changed
2025-04-26T01:53:45.2326990Z   expected '/Users/runner/work/electron/electron/src/~/work/electron/electron/src/a name' to deeply equal 'a name'
2025-04-26T01:53:45.2328650Z   AssertionError: expected '/Users/runner/work/electron/electron/src/~/work/electron/electron/src/a name' to deeply equal 'a name'
2025-04-26T01:53:45.2330000Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5505:49)
2025-04-26T01:53:45.2330790Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:45.5623600Z not ok 451 BrowserWindow module window states (excluding Linux) maximizable state (property) with properties can be set with maximizable constructor option
2025-04-26T01:53:45.5645640Z   maximizable: expected true to be false
2025-04-26T01:53:45.5695990Z   AssertionError: maximizable: expected true to be false
2025-04-26T01:53:45.5724000Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5578:44)
2025-04-26T01:53:45.5746190Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:45.7575770Z not ok 452 BrowserWindow module window states (excluding Linux) maximizable state (property) with properties can be changed
2025-04-26T01:53:45.7863650Z   maximizable: expected true to be false
2025-04-26T01:53:45.7870580Z   AssertionError: maximizable: expected true to be false
2025-04-26T01:53:45.7895760Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5585:44)
2025-04-26T01:53:45.7906030Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:45.7962300Z not ok 453 BrowserWindow module window states (excluding Linux) maximizable state (property) with properties is not affected when changing other states
2025-04-26T01:53:45.7996890Z   maximizable: expected true to be false
2025-04-26T01:53:45.8027140Z   AssertionError: maximizable: expected true to be false
2025-04-26T01:53:45.8041640Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5593:44)
2025-04-26T01:53:45.8068020Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:45.8977900Z not ok 454 BrowserWindow module window states (excluding Linux) maximizable state (property) with functions can be set with maximizable constructor option
2025-04-26T01:53:45.8982880Z   isMaximizable: expected true to be false
2025-04-26T01:53:45.9004380Z   AssertionError: isMaximizable: expected true to be false
2025-04-26T01:53:45.9019320Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5611:48)
2025-04-26T01:53:45.9053240Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:46.0056920Z not ok 455 BrowserWindow module window states (excluding Linux) maximizable state (property) with functions can be changed
2025-04-26T01:53:46.0387200Z   isMaximizable: expected true to be false
2025-04-26T01:53:46.0425220Z   AssertionError: isMaximizable: expected true to be false
2025-04-26T01:53:46.0435810Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5618:48)
2025-04-26T01:53:46.0456540Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:53:46.1227070Z not ok 456 BrowserWindow module window states (excluding Linux) maximizable state (property) with functions is not affected when changing other states
2025-04-26T01:53:46.1242090Z   isMaximizable: expected true to be false
2025-04-26T01:53:46.1267270Z   AssertionError: isMaximizable: expected true to be false
2025-04-26T01:53:46.1282000Z       at Context.<anonymous> (electron/spec/api-browser-window-spec.ts:5626:48)
2025-04-26T01:53:46.1301790Z       at processImmediate (node:internal/timers:491:21)

2025-04-26T01:52:36.3191220Z not ok 62 app module accessibilitySupportEnabled property with functions can set accessibility support enabled
2025-04-26T01:52:36.3192820Z   expected true to deeply equal false
2025-04-26T01:52:36.3193580Z   AssertionError: expected true to deeply equal false
2025-04-26T01:52:36.3194580Z       at Context.<anonymous> (electron/spec/api-app-spec.ts:993:56)
2025-04-26T01:52:36.3195590Z       at processImmediate (node:internal/timers:491:21)

@ckerr
Copy link
Member Author

ckerr commented Apr 26, 2025

I think maybe this work is getting bigger than one PR.

@ckerr ckerr force-pushed the fix/no-nested-tests branch from 7e77e1b to 35369cb Compare May 2, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

many tests are never being run due to nested if() calls in Mocha
2 participants