Skip to content

Commit dfe958d

Browse files
committed
fix(tests): fix Cypress and PHP 8.4 CI failures
- Add Electron to supported browsers regex so Electron-based environments (including Cypress) are not redirected to the unsupported browser page. The browserslist-useragent-regexp 4.1.4 upgrade stopped matching Electron implicitly; this mirrors the existing AscDesktopEditor special-case. - Fix TextProcessing mock: deleteOlderThan() returns int, not void. PHP 8.4 strict mock type enforcement causes a TypeError when the callback is declared void. AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b56334c commit dfe958d

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

core/src/services/BrowsersListService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ import browserslist from 'browserslist'
99
import browserslistConfig from '@nextcloud/browserslist-config'
1010

1111
// Generate a regex that matches user agents to detect incompatible browsers
12-
export const supportedBrowsersRegExp = new RegExp(getUserAgentRegex({ allowHigherVersions: true, browsers: browserslistConfig }).source + '|AscDesktopEditor')
12+
// Electron is added explicitly as it is used by Cypress tests and desktop app integrations
13+
export const supportedBrowsersRegExp = new RegExp(getUserAgentRegex({ allowHigherVersions: true, browsers: browserslistConfig }).source + '|AscDesktopEditor|Electron')
1314
export const supportedBrowsers = browserslist(browserslistConfig)

dist/7883-7883.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-unsupported-browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/lib/TextProcessing/TextProcessingTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ protected function setUp(): void {
160160
$this->taskMapper
161161
->expects($this->any())
162162
->method('deleteOlderThan')
163-
->willReturnCallback(function (int $timeout): void {
163+
->willReturnCallback(function (int $timeout): int {
164+
$before = count($this->tasksDb);
164165
$this->tasksDb = array_filter($this->tasksDb, function (array $task) use ($timeout) {
165166
return $task['last_updated'] >= $this->currentTime->getTimestamp() - $timeout;
166167
});
168+
return $before - count($this->tasksDb);
167169
});
168170

169171
$this->jobList = $this->createPartialMock(DummyJobList::class, ['add']);

0 commit comments

Comments
 (0)