Repository navigation
test: run the code instead of reading it - #1032
Merged
Merged
Conversation
Merge the ~200 per-fix test files into a few files per feature area. Source-reading cases move to <feature>.checks.* files, separate from behavior tests. No assertion changed: the same 1752 test names pass.
…Handlers.ts test: run the editing keys against the extracted handlers instead of cutting them out of Editor.svelte
…nt-matter scroll end out of Editor.svelte test: run them instead of reading Editor.svelte
…ough the document session
…it out of Editor.svelte
…Bar.svelte Move the window-tag editor, menu flags and window dismissal out of TitleBar.svelte into stores/titleBarPopovers.svelte.ts, and the Home menu export gate into canExportTab. Rewrite the tag-editor, export-gate and context-menu-dismiss checks as behaviour specs and delete scripts/windowTagEditor.ts.
…oved window save checks
…p instead of reading the viewer
…them directly The close handler, quit, update settle, last-tab close, merge and pinned group open move out of MarkdownViewer.svelte unchanged, as does the set_window_meta report. Source-reading checks for them are replaced by behavior tests; checks that lifted these functions now run the module.
…ead of reading components
…ns.ts Editor.svelte and MarkdownViewer.svelte call createdEditorOptions, updatedEditorOptions and editorReadOnly, so the option tests run the functions instead of lifting the literal out of the component.
…s readings into EditorDocument
…ut of Editor.svelte
test: check every theme name the editor asks for against what defineAppThemes and the VS Code theme loader actually define.
…calizedActions.svelte.ts test: drive it with a real effect in editor.localizedActions.spec.ts instead of matching Editor.svelte
# Conflicts: # scripts/shortcuts.checks.test.ts
Settings.svelte walks SETTINGS_PANES (src/lib/utils/settingsPanes.ts) and its open effect lives in settingsOpen.svelte.ts. The pane checks that read the component now run on the data in settings.spec.ts.
Delete the AST walk over Settings.svelte, the inactive-row opacity check (component CSS) and the viewer's auto-save debounce wiring check.
… engine, could observe The viewer and editor wiring and the component CSS rules they pinned are listed in the PR body.
# Conflicts: # scripts/editor.checks.spec.ts
AGENTS.md no longer asks for source-shape assertions. It says tests run the code, logic a test cannot reach moves into a module, which components may be mounted, and that the checks files hold only contract and convention checks until bindings and lint rules replace them.
- documents.load: the #692 reload test replaced the invoke handler for good; reset() now restores the disk-backed one. - settings.themeLoad: the Monaco mock is cached after its first import; the first-load test re-registers it, resets modules and holds the import. - export: the KaTeX/highlight memo is module-level; each export run resets it.
refreshesPreviewCache, showsHomeScreen and tocAutoCollapses take getters for the value the old short-circuit did not read, so their effects do not subscribe to it. patchHost runs readTab and patchPreview inside untrack, as the viewer did. saveImageAs reads the UI language after the Save dialog.
Sticky Headings now comes from editorOptionsFromSettings only, so the moved creation options no longer set it a second time, and the 'option a setting can change' test covers it instead of skipping it.
The Windows test binary failed to load (STATUS_ENTRYPOINT_NOT_FOUND): tauri's test feature pulls in Common Controls v6 entry points and a test binary carries no manifest declaring them. The three tests that need the mock runtime, and the feature itself, now apply to macOS and Linux only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1030. Most cases in the
*.checks.*files read source as text: they sliced function bodies out of components, cut code out of.sveltefiles and evaluated it, or matched a line's spelling. This rewrites them as tests that run the code.Logic a test could not reach is moved out of the components into modules the components call (41 new files under
src/lib: the viewer's window exit, external change, view mode, viewer command table, preview links and copy; the editor's actions, key handlers, clipboard, mount sequence, document readings and jumps; the settings panes as row data; and similar). Each move is the old code plus its call site, with no intended behavior change. A few Rust functions became pure or generic overRuntimeso they can be unit tested, with thetauritestfeature as a dev-dependency only.Every rewritten test was checked by putting the old bug back (or breaking the guarded behavior) and watching it fail for that reason. Small components without Monaco are now mounted under jsdom for their markup wiring; AGENTS.md is updated to say so and to stop asking for source-shape assertions. The checks files keep 177 cases: Tauri command/event names, config and i18n keys, and single-implementation conventions, which a follow-up moves to generated bindings and lint rules.
Order-dependent tests (pre-existing in the external change reload spec) are fixed; vitest
--sequence.shuffleandnode --test --test-random-seedpass on 10 seeds each.These 18 checks are deleted with no replacement, because they need MarkdownViewer.svelte or Editor.svelte mounted, or real CSS layout:
saveSilently, so a file that decoded with losses is never auto-saved over itself.<article id="print-root">, not the live preview with its folds and theme.codeinside a##heading is sized relative to the heading, not stuck at the code font size.text/html, no WebArchive).Verified: node --test, vitest (normal and shuffled), svelte-check, cargo fmt/clippy/test, npm audit all green. Not clicked through in a built app.