ulysses/static/js
BarsatZulkarnine 00f16d66a3
Fix test suite: ESM module loading and stub isolation (#844)
* Fix test suite: ESM loading and stub isolation (refs #605)

Three targeted fixes to reduce suite failures from 9 → 1:

1. package.json: add "type": "module" so Node loads static/js/**
   as ES modules. Fixes 7 tests in test_compare_js.py and
   test_reply_recipients_js.py that fail with
   "SyntaxError: Unexpected token 'export'".

2. test_null_owner_gates.py: add Base and ChatMessage to the
   core.database stub. Without Base the scheduler test cannot
   import at collection time; without ChatMessage core/__init__.py
   fails mid-load when session_manager.py tries to import it,
   leaving core partially initialised in sys.modules and poisoning
   the auth manager migration test that runs later in the same file.

3. test_task_scheduler_session_delivery.py: skip gracefully when
   core.database is stubbed (Base is a MagicMock) rather than
   crashing. The test passes correctly when run in isolation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Scope ESM declaration to static/js/ and document isolation workaround

Per review feedback on #844:

1. Move "type": "module" from root package.json to static/js/package.json.
   The root package.json had no type field (defaulted to CJS) and should
   stay that way — vendored UMD bundles in static/lib/ use require() internally
   and would break if Node ever tried to load them as ES modules. Node resolves
   the nearest package.json, so adding it in static/js/ scopes the ESM
   declaration to just the files the JS unit tests actually load
   (compare/state.js, emailLibrary/replyRecipients.js).

2. Expand the module-level skip comment in test_task_scheduler_session_delivery
   to document that it is a temporary isolation workaround, explain root cause
   (test_null_owner_gates installs a module-level sys.modules stub with no
   cleanup), record before/after suite numbers, and note the clean path
   (refactor to fixture-scoped stub).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 11:29:29 +09:00
..
calendar Odysseus v1.0 2026-05-31 23:58:26 +09:00
compare fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
editor Ignore AltGr keystrokes in Ctrl+Alt keyboard shortcuts (#825) 2026-06-02 11:12:54 +09:00
emailLibrary Escape email fold summary metadata 2026-06-02 05:50:53 +09:00
research feat(ai): add OpenRouter and Ollama Cloud providers (#231) 2026-06-01 14:26:10 +09:00
a11y.js Improve accessibility across core flows (#86) 2026-06-01 22:04:00 +02:00
admin.js feat(ai): add OpenRouter and Ollama Cloud providers (#231) 2026-06-01 14:26:10 +09:00
assistant.js feat(ai): add OpenRouter and Ollama Cloud providers (#231) 2026-06-01 14:26:10 +09:00
calendar.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
censor.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
chat.js Merge branch 'pr-469' into visual-pr-playground 2026-06-02 06:26:31 +09:00
chatRenderer.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
chatStream.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
codeRunner.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
colorPicker.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
cookbook-diagnosis.js Clarify Cookbook diffusion dependencies 2026-06-01 11:45:26 +09:00
cookbook-hwfit.js fix(cookbook): sort by Fit when the Fit header is clicked (#842) (#860) 2026-06-02 11:09:18 +09:00
cookbook.js fix(cookbook): sort by Fit when the Fit header is clicked (#842) (#860) 2026-06-02 11:09:18 +09:00
cookbookDownload.js fix: require GGUF sources for llama downloads (#368) 2026-06-01 22:47:47 +09:00
cookbookRunning.js Polish task UI slash commands and Ollama serving 2026-06-02 09:36:03 +09:00
cookbookServe.js Polish task UI slash commands and Ollama serving 2026-06-02 09:36:03 +09:00
document.js Polish email tasks and window controls 2026-06-01 20:56:46 +09:00
documentLibrary.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
dragSort.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
emailInbox.js Polish email reply and task controls 2026-06-01 23:02:25 +09:00
emailLibrary.js Polish email reply and task controls 2026-06-01 23:02:25 +09:00
emojiPicker.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
escMenuStack.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
fileHandler.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
gallery.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
galleryEditor.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
group.js Await character templates before populating group dropdowns 2026-06-01 15:18:32 +09:00
init.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
keyboard-shortcuts.js Ignore AltGr keystrokes in Ctrl+Alt keyboard shortcuts (#825) 2026-06-02 11:12:54 +09:00
langIcons.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
markdown.js Sanitize preserved markdown HTML 2026-06-02 05:58:38 +09:00
memory.js feat: allow memory import without session (#493) 2026-06-01 22:32:17 +09:00
modalManager.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
modalSnap.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
modelPicker.js Add model favorite dot feedback 2026-06-02 06:50:22 +09:00
models.js Merge branch 'pr-673' into visual-pr-playground 2026-06-02 06:26:32 +09:00
modelSort.js feat(ai): add OpenRouter and Ollama Cloud providers (#231) 2026-06-01 14:26:10 +09:00
MODULE_SUMMARY.md Odysseus v1.0 2026-05-31 23:58:26 +09:00
notes.js Remove mobile notes close button 2026-06-02 07:00:40 +09:00
package.json Fix test suite: ESM module loading and stub isolation (#844) 2026-06-02 11:29:29 +09:00
platform.js Ignore AltGr keystrokes in Ctrl+Alt keyboard shortcuts (#825) 2026-06-02 11:12:54 +09:00
presets.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
providers.js feat(ai): add OpenRouter and Ollama Cloud providers (#231) 2026-06-01 14:26:10 +09:00
rag.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
researchSynapse.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
search-chat.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
search.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
section-management.js Fix Models section collapse dead pause and missing animation 2026-06-01 16:53:46 +02:00
sessions.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
settings.js Ignore AltGr keystrokes in Ctrl+Alt keyboard shortcuts (#825) 2026-06-02 11:12:54 +09:00
sidebar-layout.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
signature.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
skills.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
slashAutocomplete.js Polish task UI slash commands and Ollama serving 2026-06-02 09:36:03 +09:00
slashCommands.js Polish task UI slash commands and Ollama serving 2026-06-02 09:36:03 +09:00
spinner.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
storage.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tasks.js Polish task UI slash commands and Ollama serving 2026-06-02 09:36:03 +09:00
theme.js Improve accessibility across core flows (#86) 2026-06-01 22:04:00 +02:00
tileManager.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tourAutoplay.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tourHints.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tts-ai.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
ui.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
voiceRecorder.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
windowDrag.js Make tool windows resizable by dragging edges or corners 2026-06-01 19:49:23 +02:00
windowResize.js Make tool windows resizable by dragging edges or corners 2026-06-01 19:49:23 +02:00