fix(admin): isolate CodeMirror load for chunk-failure tests
- Route CodeEditorField through codeeditor/load so vitest can mock the chunk - Keep registry expectations for colorpicker/codeeditor without importing the editor SFC Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
5
admin/src/components/form/codeeditor/load.ts
Normal file
5
admin/src/components/form/codeeditor/load.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// Separate module so tests can mock the CodeMirror chunk import without
|
||||
// fighting a prior evaluation of editor.ts in the same vitest worker.
|
||||
export function importCodeEditor(): Promise<typeof import('./editor')> {
|
||||
return import('./editor')
|
||||
}
|
||||
@@ -84,7 +84,7 @@ onMounted(async () => {
|
||||
return
|
||||
}
|
||||
try {
|
||||
module = await import('../codeeditor/editor')
|
||||
module = await (await import('../codeeditor/load')).importCodeEditor()
|
||||
if (disposed) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user