fix: e2e failed

This commit is contained in:
lin onetwo 2026-04-04 05:16:08 +08:00
parent f7487fa257
commit 860dc8bfde
2 changed files with 8 additions and 3 deletions

View file

@ -1187,9 +1187,12 @@ When('I update workspace {string} settings:', async function(this: ApplicationWo
// wiki worker initialization can take several seconds.
await waitForLogMarker(this, '[test-id-WIKI_WORKER_STARTED]', 'wiki worker not started before restart attempt');
// Only wait for watch-fs if it was enabled before the update
// If it was disabled, wiki is ready immediately without watch-fs markers
if (watchFsCurrentlyEnabled) {
// Wait for watch-fs to stabilize before restarting to avoid nsfw crash.
// If watch-fs was already enabled OR is being enabled in this update, the wiki worker
// may have started nsfw already (it reads updated settings on start). We must wait for
// it to fully initialize before calling terminateWorker, otherwise the native nsfw
// polling thread may try to callback into a destroyed JS environment (FATAL napi error).
if (watchFsCurrentlyEnabled || settingsUpdate.enableFileSystemWatch === true) {
await waitForLogMarker(this, '[test-id-WATCH_FS_STABILIZED]', 'watch-fs not ready before restart', LOG_MARKER_WAIT_TIMEOUT);
}

View file

@ -82,6 +82,8 @@ export class WikiGitWorkspace implements IWikiGitWorkspaceService {
const isSyncedWiki = storageService !== SupportedStorageServices.local;
if (await hasGit(wikiFolderLocation)) {
logger.warn('Skip git init because it already has a git setup.', { wikiFolderLocation });
// Still emit the marker so e2e tests waiting for git-init-complete don't hang
logger.info(`[test-id-git-init-complete]`, { wikiFolderLocation });
} else {
if (isSyncedWiki) {
if (typeof gitUrl === 'string' && userInfo !== undefined) {