refactor(editor): use stable stringify for snapshots (#10948)

This commit is contained in:
pengx17
2025-03-18 05:41:19 +00:00
parent 83af78d9ee
commit 99370573c8
183 changed files with 10875 additions and 10142 deletions

View File

@@ -8,6 +8,7 @@ import { uuidv4 } from '@blocksuite/affine/store';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import type { ConsoleMessage, Locator, Page } from '@playwright/test';
import { expect } from '@playwright/test';
import stringify from 'json-stable-stringify';
import lz from 'lz-string';
import { currentEditorIndex } from '../multiple-editor.js';
@@ -881,7 +882,7 @@ export async function getPageSnapshot(page: Page, toJSON?: boolean) {
return snapshot.blocks;
});
if (toJSON) {
return JSON.stringify(json, null, 2);
return stringify(json, { space: ' ' });
}
return json;
}