mirror of
https://github.com/penpot/penpot.git
synced 2026-11-20 09:00:49 +00:00
* ✨ Explain why a library cannot be disconnected in its modal A library that another connected library uses cannot be disconnected from a file, but the Libraries modal showed it with the same disconnect button as any other library, only disabled, and said nothing about why. Replace that button with an icon and a tooltip. A nested library ("Connected through ...") says it is inherited from its parent, and a direct library that another connected library uses says which one. Both name the library to disconnect first. A library nothing else uses keeps its button. library-disconnect-hint decides the case from the same data the disabled state used, so the buttons that were disabled are the ones that change. The legacy libraries tab keeps its button. Closes #12838 AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 🐛 Name every library to disconnect in the disconnect hint The hint named only the parent of a nested library as the one to disconnect. That was wrong when several libraries use it (disconnecting one leaves it linked through the others) and no help when the parent is nested too and has no disconnect button either. The removal step now lists the libraries the user can actually disconnect: those that use the library directly or through others, and that no linked library uses. The parent is still named as the reason it is inherited. In a cycle nothing is removable, so the parent is named as before. Tests cover a shared dependency, a deep chain and a cycle. AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 🐛 List directly linked libraries in the disconnect hint A library linked to the file directly stays until the user disconnects it, even when another linked library uses it. The hint skipped those: for a file linked to A and B, with A using B and B using C, it told the user to disconnect only A, and C stayed linked through B. Collect the libraries that use it, however far up, and that are either linked directly or used by no linked library. A directly linked library that another one uses cannot be disconnected yet, and its own tooltip says to disconnect that one first. The test covers a directly linked intermediate library. AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 🐛 Count a library linked in this session as direct in the hint Only the libraries fetched when the workspace opens carry :is-indirect. One linked afterwards comes back without it, so the hint did not treat it as directly linked: after connecting B (which uses C) and then A (which uses B) without reloading, C's tooltip said to disconnect only A, and C stayed linked through B. A library the user linked has no flag and is direct by construction, so only one known to be indirect is skipped. The test covers that sequence. AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 🐛 Flag libraries linked in this session as direct or indirect Only the libraries fetched when the workspace opens carried :is-indirect. Linking a library afterwards loads it and its dependencies through load-library-file, and none of them got the flag, so a missing flag could mean either. The disconnect hint in the Libraries modal reads it to tell which libraries the user can disconnect, and it listed the wrong ones for a chain connected in the same session (it named a dependency that has no disconnect button). Set the flag where the library is loaded: the library the user links is direct and the libraries it brings in are indirect. The hint is back to trusting only a flag that says false, because a missing one no longer means a direct link. The test links a library with one dependency and checks both flags. AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 🐛 Keep a library's direct flag when it is loaded twice When links overlap, a library can be requested twice: once because the user linked it and once because a library linked right after brings it in. Each load stored its own :is-indirect value, so whichever answer landed last won, and an indirect one could erase the direct link. The disconnect hint then listed the wrong libraries. Store a loaded library through one event that never turns a known direct link into an indirect one. The reverse order already ends direct, since the user's link is stored with the flag false. The test links a library and then one that uses it before the first answer arrives, and answers in the order that used to lose the flag. AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 🐛 Scope a library's kept direct flag to the file it belongs to The flag kept when a library is loaded twice was read from :files, which outlives a workspace. A library that was a direct link of the file visited before could keep that flag in the next file, where another library only brings it in, and the disconnect hint then listed one library too many. Keep the flag only when it was recorded for the file being loaded, using the :library-of the entry already carries. The test leaves a library flagged direct for another file and links a library that brings it in. AI-assisted-by: claude-opus-5-5 AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> * 💄 Name the libraries in the disconnect hint as design asked The nested library hint now reads "Connected through <parent>. To remove it, disconnect <libraries>." instead of "Inherited from ...". The library names in both hints (connected through and used by) show in the primary foreground color, so they stand out from the text. The translation is split on its two placeholders instead of rendered as HTML, because the library names are written by users. The full plain sentence stays as the aria label of the icon. The new key is workspace.libraries.connected-through-hint, since workspace.libraries.connected-through already labels the parent in the list. AI-assisted-by: claude-sonnet-5-5 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> --------- Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> Co-authored-by: Eva Marco <evamarcod@gmail.com>
598 lines
24 KiB
Clojure
598 lines
24 KiB
Clojure
(ns frontend-tests.runner
|
|
(:require
|
|
[app.common.logging :as l]
|
|
[cljs.test :as t]
|
|
[clojure.string :as str]
|
|
[clojure.tools.cli :refer [parse-opts]]
|
|
[frontend-tests.basic-shapes-test]
|
|
[frontend-tests.browser-history-test]
|
|
[frontend-tests.code-gen-style-test]
|
|
[frontend-tests.composable-tests.comp.sync-test]
|
|
[frontend-tests.config-test]
|
|
[frontend-tests.copy-as-svg-test]
|
|
[frontend-tests.data.auth-test]
|
|
[frontend-tests.data.comments-batches-test]
|
|
[frontend-tests.data.comments-filters-test]
|
|
[frontend-tests.data.common-test]
|
|
[frontend-tests.data.dashboard-test]
|
|
[frontend-tests.data.event-test]
|
|
[frontend-tests.data.exports-assets-test]
|
|
[frontend-tests.data.exports-files-test]
|
|
[frontend-tests.data.fix-deleted-fonts-test]
|
|
[frontend-tests.data.fonts-test]
|
|
[frontend-tests.data.imports-test]
|
|
[frontend-tests.data.jobs-test]
|
|
[frontend-tests.data.modal-test]
|
|
[frontend-tests.data.nitrate-test]
|
|
[frontend-tests.data.persistence-commits-test]
|
|
[frontend-tests.data.persistence-lock-test]
|
|
[frontend-tests.data.persistence-retry-test]
|
|
[frontend-tests.data.persistence-rollback-test]
|
|
[frontend-tests.data.persistence-test]
|
|
[frontend-tests.data.pointer-map-test]
|
|
[frontend-tests.data.profile-test]
|
|
[frontend-tests.data.repo-test]
|
|
[frontend-tests.data.store-test]
|
|
[frontend-tests.data.svg-upload-test]
|
|
[frontend-tests.data.team-test]
|
|
[frontend-tests.data.uploads-test]
|
|
[frontend-tests.data.viewer-test]
|
|
[frontend-tests.data.workspace-board-link-test]
|
|
[frontend-tests.data.workspace-colors-test]
|
|
[frontend-tests.data.workspace-comments-test]
|
|
[frontend-tests.data.workspace-context-menu-test]
|
|
[frontend-tests.data.workspace-focus-test]
|
|
[frontend-tests.data.workspace-interactions-test]
|
|
[frontend-tests.data.workspace-layout-other-page-test]
|
|
[frontend-tests.data.workspace-libraries-link-test]
|
|
[frontend-tests.data.workspace-libraries-load-test]
|
|
[frontend-tests.data.workspace-libraries-sync-test]
|
|
[frontend-tests.data.workspace-mcp-test]
|
|
[frontend-tests.data.workspace-media-test]
|
|
[frontend-tests.data.workspace-notifications-test]
|
|
[frontend-tests.data.workspace-pages-test]
|
|
[frontend-tests.data.workspace-path-edition-test]
|
|
[frontend-tests.data.workspace-reflow-test]
|
|
[frontend-tests.data.workspace-shortcuts-test]
|
|
[frontend-tests.data.workspace-texts-test]
|
|
[frontend-tests.data.workspace-thumbnails-test]
|
|
[frontend-tests.data.workspace-thumbnails-wasm-test]
|
|
[frontend-tests.data.workspace-undo-test]
|
|
[frontend-tests.data.workspace-undo-translation-test]
|
|
[frontend-tests.data.workspace-variant-rename-test]
|
|
[frontend-tests.data.workspace-variants-test]
|
|
[frontend-tests.data.workspace-versions-test]
|
|
[frontend-tests.debug-logging-test]
|
|
[frontend-tests.errors-governor-test]
|
|
[frontend-tests.errors-test]
|
|
[frontend-tests.fonts-test]
|
|
[frontend-tests.helpers-shapes-test]
|
|
[frontend-tests.helpers.async-test]
|
|
[frontend-tests.logic.bool-move-test]
|
|
[frontend-tests.logic.comp-remove-swap-slots-test]
|
|
[frontend-tests.logic.comp-watcher-test]
|
|
[frontend-tests.logic.components-and-tokens]
|
|
[frontend-tests.logic.copy-paste-typography-test]
|
|
[frontend-tests.logic.copying-and-duplicating-test]
|
|
[frontend-tests.logic.drag-on-save-failure-test]
|
|
[frontend-tests.logic.frame-guides-test]
|
|
[frontend-tests.logic.groups-test]
|
|
[frontend-tests.logic.ignore-tree-test]
|
|
[frontend-tests.logic.move-shapes-to-frame-test]
|
|
[frontend-tests.logic.multi-variant-switch-test]
|
|
[frontend-tests.logic.nudge-selected-shapes-test]
|
|
[frontend-tests.logic.pasting-in-containers-test]
|
|
[frontend-tests.logic.path-actions-test]
|
|
[frontend-tests.logic.path-clipboard-test]
|
|
[frontend-tests.logic.path-helpers-test]
|
|
[frontend-tests.logic.path-lifecycle-test]
|
|
[frontend-tests.logic.path-tools-test]
|
|
[frontend-tests.logic.scale-selected-test]
|
|
[frontend-tests.logic.sidebar-transform-coalescing-test]
|
|
[frontend-tests.logic.update-position-test]
|
|
[frontend-tests.logic.wasm-modifiers-nil-id-test]
|
|
[frontend-tests.logic.wasm-pixel-snap-test]
|
|
[frontend-tests.main-errors-test]
|
|
[frontend-tests.main.refs-test]
|
|
[frontend-tests.plugins.comments-test]
|
|
[frontend-tests.plugins.context-shapes-test]
|
|
[frontend-tests.plugins.creation-parent-test]
|
|
[frontend-tests.plugins.events-test]
|
|
[frontend-tests.plugins.file-test]
|
|
[frontend-tests.plugins.flex-test]
|
|
[frontend-tests.plugins.format-test]
|
|
[frontend-tests.plugins.grid-test]
|
|
[frontend-tests.plugins.interactions-test]
|
|
[frontend-tests.plugins.library-test]
|
|
[frontend-tests.plugins.local-storage-test]
|
|
[frontend-tests.plugins.location-test]
|
|
[frontend-tests.plugins.management-test]
|
|
[frontend-tests.plugins.page-active-validation-test]
|
|
[frontend-tests.plugins.page-test]
|
|
[frontend-tests.plugins.parser-test]
|
|
[frontend-tests.plugins.read-only-test]
|
|
[frontend-tests.plugins.register-test]
|
|
[frontend-tests.plugins.runtime-unavailable-test]
|
|
[frontend-tests.plugins.shape-bugfixes-test]
|
|
[frontend-tests.plugins.system-events-test]
|
|
[frontend-tests.plugins.text-test]
|
|
[frontend-tests.plugins.tokens-test]
|
|
[frontend-tests.plugins.user-test]
|
|
[frontend-tests.plugins.utils-test]
|
|
[frontend-tests.plugins.value-objects-test]
|
|
[frontend-tests.plugins.wait-for-save-test]
|
|
[frontend-tests.render-dimensions-test]
|
|
[frontend-tests.render-wasm.call-test]
|
|
[frontend-tests.render-wasm.modifiers-test]
|
|
[frontend-tests.render-wasm.process-objects-test]
|
|
[frontend-tests.render-wasm.serialization-test]
|
|
[frontend-tests.render-wasm.shape-proxy-test]
|
|
[frontend-tests.render-wasm.text-editor-apply-styles-test]
|
|
[frontend-tests.render-wasm.text-editor-caret-color-test]
|
|
[frontend-tests.render-wasm.text-editor-content-range-test]
|
|
[frontend-tests.render-wasm.text-paste-test]
|
|
[frontend-tests.render-wasm.webgl-test]
|
|
[frontend-tests.router-test]
|
|
[frontend-tests.svg-fills-test]
|
|
[frontend-tests.svg-filters-test]
|
|
[frontend-tests.text-editor-paste-guard-test]
|
|
[frontend-tests.tokens.context-menu-test]
|
|
[frontend-tests.tokens.copy-paste-props-test]
|
|
[frontend-tests.tokens.export-modal-test]
|
|
[frontend-tests.tokens.import-export-test]
|
|
[frontend-tests.tokens.logic.token-actions-test]
|
|
[frontend-tests.tokens.logic.token-data-test]
|
|
[frontend-tests.tokens.logic.token-remapping-test]
|
|
[frontend-tests.tokens.logic.tokens-source-test]
|
|
[frontend-tests.tokens.logic.tokens-status-test]
|
|
[frontend-tests.tokens.referenced-token-value-test]
|
|
[frontend-tests.tokens.shadow-form-test]
|
|
[frontend-tests.tokens.style-dictionary-test]
|
|
[frontend-tests.tokens.theme-create-modal-test]
|
|
[frontend-tests.tokens.token-application-test]
|
|
[frontend-tests.tokens.token-errors-test]
|
|
[frontend-tests.tokens.token-group-test]
|
|
[frontend-tests.tokens.token-parsing-test]
|
|
[frontend-tests.tokens.token-path-test]
|
|
[frontend-tests.tokens.token-pill-test]
|
|
[frontend-tests.tokens.token-tree-test]
|
|
[frontend-tests.tokens.tokenscript-test]
|
|
[frontend-tests.tokens.typography-form-test]
|
|
[frontend-tests.tokens.workspace-tokens-remap-test]
|
|
[frontend-tests.ui.check-updates-test]
|
|
[frontend-tests.ui.color-token-position-test]
|
|
[frontend-tests.ui.colorpicker-token-set-order-test]
|
|
[frontend-tests.ui.comment-input-ime-test]
|
|
[frontend-tests.ui.comments-clustering-test]
|
|
[frontend-tests.ui.comments-position-modifier-test]
|
|
[frontend-tests.ui.dashboard-import-linking-test]
|
|
[frontend-tests.ui.drawarea-test]
|
|
[frontend-tests.ui.ds-controls-numeric-input-test]
|
|
[frontend-tests.ui.error-boundary-test]
|
|
[frontend-tests.ui.export-preview-test]
|
|
[frontend-tests.ui.file-restored-modal-test]
|
|
[frontend-tests.ui.gradient-handlers-test]
|
|
[frontend-tests.ui.history-test]
|
|
[frontend-tests.ui.inspect-geometry-test]
|
|
[frontend-tests.ui.inspect-stroke-tokens-test]
|
|
[frontend-tests.ui.inspect-text-list-test]
|
|
[frontend-tests.ui.jobs-progress-test]
|
|
[frontend-tests.ui.layout-container-multiple-test]
|
|
[frontend-tests.ui.mcp-authorize-test]
|
|
[frontend-tests.ui.measurements-test]
|
|
[frontend-tests.ui.measures-menu-props-test]
|
|
[frontend-tests.ui.organization-team-switch-test]
|
|
[frontend-tests.ui.routes-test]
|
|
[frontend-tests.ui.settings-password-schema-test]
|
|
[frontend-tests.ui.settings-shortcuts-test]
|
|
[frontend-tests.ui.shape-filters-test]
|
|
[frontend-tests.ui.shortcuts-labels-test]
|
|
[frontend-tests.ui.sidebar-scroll-test]
|
|
[frontend-tests.ui.sortable-auto-scroll-test]
|
|
[frontend-tests.ui.static-test]
|
|
[frontend-tests.ui.stroke-menu-test]
|
|
[frontend-tests.ui.subscription-test]
|
|
[frontend-tests.ui.team-container-test]
|
|
[frontend-tests.ui.text-attrs-multiple-test]
|
|
[frontend-tests.ui.viewport-texts-html-test]
|
|
[frontend-tests.ui.viewport-top-bar-test]
|
|
[frontend-tests.ui.workspace-libraries-test]
|
|
[frontend-tests.util-clipboard-test]
|
|
[frontend-tests.util-http-test]
|
|
[frontend-tests.util-i18n-test]
|
|
[frontend-tests.util-object-test]
|
|
[frontend-tests.util-queue-test]
|
|
[frontend-tests.util-range-tree-test]
|
|
[frontend-tests.util-simple-math-test]
|
|
[frontend-tests.util-text-clipboard-test]
|
|
[frontend-tests.util-text-editor-test]
|
|
[frontend-tests.util-theme-test]
|
|
[frontend-tests.util-webapi-test]
|
|
[frontend-tests.util-zip-test]
|
|
[frontend-tests.util.code-gen-markup-svg-wasm-test]
|
|
[frontend-tests.util.dom.dnd-test]
|
|
[frontend-tests.worker-snap-test]
|
|
[frontend-tests.worker.component-thumbnails-test]
|
|
[frontend-tests.worker.exports-test]
|
|
[frontend-tests.worker.fonts-sync-test]
|
|
[frontend-tests.worker.index-test]
|
|
[frontend-tests.worker.messages-test]
|
|
[frontend-tests.worker.trim-test]
|
|
[goog.object :as gobj]))
|
|
|
|
(enable-console-print!)
|
|
|
|
(defmethod t/report [:cljs.test/default :begin-test-var] [m]
|
|
(let [v (:var m)]
|
|
(println (str " ▸ " (:ns (meta v)) "/" (:name (meta v))))))
|
|
|
|
(defmethod t/report [:cljs.test/default :end-run-tests] [m]
|
|
(if (cljs.test/successful? m)
|
|
(.exit js/process 0)
|
|
(.exit js/process 1)))
|
|
|
|
(def test-namespaces
|
|
['frontend-tests.basic-shapes-test
|
|
'frontend-tests.code-gen-style-test
|
|
'frontend-tests.composable-tests.comp.sync-test
|
|
'frontend-tests.config-test
|
|
'frontend-tests.copy-as-svg-test
|
|
'frontend-tests.data.auth-test
|
|
'frontend-tests.data.comments-batches-test
|
|
'frontend-tests.data.comments-filters-test
|
|
'frontend-tests.data.common-test
|
|
'frontend-tests.data.dashboard-test
|
|
'frontend-tests.data.event-test
|
|
'frontend-tests.data.fix-deleted-fonts-test
|
|
'frontend-tests.data.modal-test
|
|
'frontend-tests.data.nitrate-test
|
|
'frontend-tests.data.persistence-commits-test
|
|
'frontend-tests.data.persistence-lock-test
|
|
'frontend-tests.data.persistence-retry-test
|
|
'frontend-tests.data.persistence-rollback-test
|
|
'frontend-tests.data.persistence-test
|
|
'frontend-tests.data.pointer-map-test
|
|
'frontend-tests.data.profile-test
|
|
'frontend-tests.data.repo-test
|
|
'frontend-tests.data.store-test
|
|
'frontend-tests.data.exports-assets-test
|
|
'frontend-tests.data.exports-files-test
|
|
'frontend-tests.data.fonts-test
|
|
'frontend-tests.data.imports-test
|
|
'frontend-tests.data.jobs-test
|
|
'frontend-tests.worker.component-thumbnails-test
|
|
'frontend-tests.worker.exports-test
|
|
'frontend-tests.worker.fonts-sync-test
|
|
'frontend-tests.worker.index-test
|
|
'frontend-tests.worker.messages-test
|
|
'frontend-tests.worker.trim-test
|
|
'frontend-tests.data.svg-upload-test
|
|
'frontend-tests.data.team-test
|
|
'frontend-tests.data.uploads-test
|
|
'frontend-tests.data.viewer-test
|
|
'frontend-tests.data.workspace-board-link-test
|
|
'frontend-tests.data.workspace-colors-test
|
|
'frontend-tests.data.workspace-comments-test
|
|
'frontend-tests.data.workspace-context-menu-test
|
|
'frontend-tests.data.workspace-focus-test
|
|
'frontend-tests.data.workspace-interactions-test
|
|
'frontend-tests.data.workspace-layout-other-page-test
|
|
'frontend-tests.data.workspace-libraries-link-test
|
|
'frontend-tests.data.workspace-libraries-load-test
|
|
'frontend-tests.data.workspace-libraries-sync-test
|
|
'frontend-tests.data.workspace-mcp-test
|
|
'frontend-tests.data.workspace-media-test
|
|
'frontend-tests.data.workspace-notifications-test
|
|
'frontend-tests.data.workspace-pages-test
|
|
'frontend-tests.data.workspace-path-edition-test
|
|
'frontend-tests.data.workspace-reflow-test
|
|
'frontend-tests.data.workspace-shortcuts-test
|
|
'frontend-tests.data.workspace-texts-test
|
|
'frontend-tests.data.workspace-thumbnails-test
|
|
'frontend-tests.data.workspace-thumbnails-wasm-test
|
|
'frontend-tests.data.workspace-undo-test
|
|
'frontend-tests.data.workspace-undo-translation-test
|
|
'frontend-tests.data.workspace-variant-rename-test
|
|
'frontend-tests.data.workspace-variants-test
|
|
'frontend-tests.data.workspace-versions-test
|
|
'frontend-tests.debug-logging-test
|
|
'frontend-tests.errors-governor-test
|
|
'frontend-tests.errors-test
|
|
'frontend-tests.fonts-test
|
|
'frontend-tests.helpers-shapes-test
|
|
'frontend-tests.helpers.async-test
|
|
'frontend-tests.logic.bool-move-test
|
|
'frontend-tests.logic.comp-remove-swap-slots-test
|
|
'frontend-tests.logic.comp-watcher-test
|
|
'frontend-tests.logic.components-and-tokens
|
|
'frontend-tests.logic.copy-paste-typography-test
|
|
'frontend-tests.logic.copying-and-duplicating-test
|
|
'frontend-tests.logic.drag-on-save-failure-test
|
|
'frontend-tests.logic.frame-guides-test
|
|
'frontend-tests.logic.groups-test
|
|
'frontend-tests.logic.ignore-tree-test
|
|
'frontend-tests.logic.move-shapes-to-frame-test
|
|
'frontend-tests.logic.multi-variant-switch-test
|
|
'frontend-tests.logic.nudge-selected-shapes-test
|
|
'frontend-tests.logic.path-actions-test
|
|
'frontend-tests.logic.path-clipboard-test
|
|
'frontend-tests.logic.path-helpers-test
|
|
'frontend-tests.logic.path-lifecycle-test
|
|
'frontend-tests.logic.path-tools-test
|
|
'frontend-tests.logic.pasting-in-containers-test
|
|
'frontend-tests.logic.scale-selected-test
|
|
'frontend-tests.main.refs-test
|
|
'frontend-tests.main-errors-test
|
|
'frontend-tests.logic.sidebar-transform-coalescing-test
|
|
'frontend-tests.logic.update-position-test
|
|
'frontend-tests.logic.wasm-modifiers-nil-id-test
|
|
'frontend-tests.logic.wasm-pixel-snap-test
|
|
'frontend-tests.plugins.comments-test
|
|
'frontend-tests.plugins.context-shapes-test
|
|
'frontend-tests.plugins.creation-parent-test
|
|
'frontend-tests.plugins.events-test
|
|
'frontend-tests.plugins.management-test
|
|
'frontend-tests.plugins.file-test
|
|
'frontend-tests.plugins.flex-test
|
|
'frontend-tests.plugins.format-test
|
|
'frontend-tests.plugins.grid-test
|
|
'frontend-tests.plugins.interactions-test
|
|
'frontend-tests.plugins.library-test
|
|
'frontend-tests.plugins.local-storage-test
|
|
'frontend-tests.plugins.location-test
|
|
'frontend-tests.plugins.page-active-validation-test
|
|
'frontend-tests.plugins.page-test
|
|
'frontend-tests.plugins.parser-test
|
|
'frontend-tests.plugins.read-only-test
|
|
'frontend-tests.plugins.register-test
|
|
'frontend-tests.plugins.runtime-unavailable-test
|
|
'frontend-tests.plugins.shape-bugfixes-test
|
|
'frontend-tests.plugins.system-events-test
|
|
'frontend-tests.plugins.text-test
|
|
'frontend-tests.plugins.tokens-test
|
|
'frontend-tests.plugins.user-test
|
|
'frontend-tests.plugins.utils-test
|
|
'frontend-tests.plugins.value-objects-test
|
|
'frontend-tests.plugins.wait-for-save-test
|
|
'frontend-tests.render-wasm.call-test
|
|
'frontend-tests.render-wasm.modifiers-test
|
|
'frontend-tests.render-wasm.process-objects-test
|
|
'frontend-tests.render-wasm.serialization-test
|
|
'frontend-tests.render-wasm.shape-proxy-test
|
|
'frontend-tests.render-wasm.text-editor-apply-styles-test
|
|
'frontend-tests.render-wasm.text-editor-caret-color-test
|
|
'frontend-tests.render-wasm.text-editor-content-range-test
|
|
'frontend-tests.render-wasm.text-paste-test
|
|
'frontend-tests.render-wasm.webgl-test
|
|
'frontend-tests.browser-history-test
|
|
'frontend-tests.router-test
|
|
'frontend-tests.svg-fills-test
|
|
'frontend-tests.svg-filters-test
|
|
'frontend-tests.tokens.copy-paste-props-test
|
|
'frontend-tests.tokens.context-menu-test
|
|
'frontend-tests.tokens.export-modal-test
|
|
'frontend-tests.tokens.import-export-test
|
|
'frontend-tests.tokens.logic.token-actions-test
|
|
'frontend-tests.tokens.logic.token-data-test
|
|
'frontend-tests.tokens.logic.token-remapping-test
|
|
'frontend-tests.tokens.referenced-token-value-test
|
|
'frontend-tests.tokens.shadow-form-test
|
|
'frontend-tests.tokens.style-dictionary-test
|
|
'frontend-tests.tokens.theme-create-modal-test
|
|
'frontend-tests.tokens.token-application-test
|
|
'frontend-tests.tokens.token-errors-test
|
|
'frontend-tests.tokens.token-group-test
|
|
'frontend-tests.tokens.token-parsing-test
|
|
'frontend-tests.tokens.token-path-test
|
|
'frontend-tests.tokens.token-pill-test
|
|
'frontend-tests.tokens.token-tree-test
|
|
'frontend-tests.tokens.tokenscript-test
|
|
'frontend-tests.tokens.typography-form-test
|
|
'frontend-tests.tokens.logic.tokens-source-test
|
|
'frontend-tests.tokens.logic.tokens-status-test
|
|
'frontend-tests.tokens.workspace-tokens-remap-test
|
|
'frontend-tests.ui.check-updates-test
|
|
'frontend-tests.ui.color-token-position-test
|
|
'frontend-tests.ui.colorpicker-token-set-order-test
|
|
'frontend-tests.ui.comment-input-ime-test
|
|
'frontend-tests.ui.comments-clustering-test
|
|
'frontend-tests.ui.comments-position-modifier-test
|
|
'frontend-tests.ui.dashboard-import-linking-test
|
|
'frontend-tests.ui.drawarea-test
|
|
'frontend-tests.ui.ds-controls-numeric-input-test
|
|
'frontend-tests.ui.error-boundary-test
|
|
'frontend-tests.ui.export-preview-test
|
|
'frontend-tests.ui.file-restored-modal-test
|
|
'frontend-tests.ui.gradient-handlers-test
|
|
'frontend-tests.ui.history-test
|
|
'frontend-tests.ui.inspect-geometry-test
|
|
'frontend-tests.ui.inspect-stroke-tokens-test
|
|
'frontend-tests.ui.inspect-text-list-test
|
|
'frontend-tests.ui.jobs-progress-test
|
|
'frontend-tests.ui.layout-container-multiple-test
|
|
'frontend-tests.ui.measurements-test
|
|
'frontend-tests.ui.measures-menu-props-test
|
|
'frontend-tests.ui.organization-team-switch-test
|
|
'frontend-tests.ui.mcp-authorize-test
|
|
'frontend-tests.ui.routes-test
|
|
'frontend-tests.render-dimensions-test
|
|
'frontend-tests.text-editor-paste-guard-test
|
|
'frontend-tests.ui.settings-password-schema-test
|
|
'frontend-tests.ui.settings-shortcuts-test
|
|
'frontend-tests.ui.shape-filters-test
|
|
'frontend-tests.ui.shortcuts-labels-test
|
|
'frontend-tests.ui.sidebar-scroll-test
|
|
'frontend-tests.ui.sortable-auto-scroll-test
|
|
'frontend-tests.ui.static-test
|
|
'frontend-tests.ui.stroke-menu-test
|
|
'frontend-tests.ui.subscription-test
|
|
'frontend-tests.ui.team-container-test
|
|
'frontend-tests.ui.text-attrs-multiple-test
|
|
'frontend-tests.ui.viewport-texts-html-test
|
|
'frontend-tests.ui.viewport-top-bar-test
|
|
'frontend-tests.ui.workspace-libraries-test
|
|
'frontend-tests.util-clipboard-test
|
|
'frontend-tests.util-http-test
|
|
'frontend-tests.util-i18n-test
|
|
'frontend-tests.util-object-test
|
|
'frontend-tests.util-queue-test
|
|
'frontend-tests.util-range-tree-test
|
|
'frontend-tests.util-simple-math-test
|
|
'frontend-tests.util-text-clipboard-test
|
|
'frontend-tests.util-text-editor-test
|
|
'frontend-tests.util-theme-test
|
|
'frontend-tests.util-webapi-test
|
|
'frontend-tests.util.code-gen-markup-svg-wasm-test
|
|
'frontend-tests.util.dom.dnd-test
|
|
'frontend-tests.util-zip-test
|
|
'frontend-tests.worker-snap-test])
|
|
|
|
(assert (every? find-ns-obj test-namespaces)
|
|
"test-namespaces contains a namespace that isn't required in runner.cljs")
|
|
|
|
;; This runner intentionally mirrors common-tests.runner. Both runners need
|
|
;; forwarded CLI args, focused namespace/var execution, fixture preservation,
|
|
;; and app log-level setup. A shared helper could own those mechanics, but we
|
|
;; keep the logic local while there are only two test targets because sharing
|
|
;; it would add cross-module test classpath coupling.
|
|
(def ^:private log-levels
|
|
#{:trace :debug :info :warn :error})
|
|
|
|
(def cli-options
|
|
[["-f" "--focus FOCUS" "Run one test namespace or one test var, e.g. frontend-tests.logic.components-and-tokens/change-token-in-main"]
|
|
["-l" "--log-level LEVEL" "Set app logger level: trace|debug|info|warn|error"
|
|
:parse-fn keyword
|
|
:validate [log-levels "must be one of trace, debug, info, warn, error"]]
|
|
["-h" "--help"]])
|
|
|
|
(defn- argv
|
|
[]
|
|
(let [args (->> (.-argv js/process)
|
|
(array-seq)
|
|
(drop 2))]
|
|
;; `pnpm run test -- --focus ...` forwards the separator to the node
|
|
;; process, so drop one leading `--` before handing args to tools.cli.
|
|
(cond-> args
|
|
(= "--" (first args)) rest)))
|
|
|
|
(defn- usage
|
|
[summary]
|
|
(str "Usage: pnpm run test -- [options]\n\n"
|
|
"Options:\n"
|
|
summary "\n\n"
|
|
"Focus examples:\n"
|
|
" pnpm run test -- --focus frontend-tests.logic.components-and-tokens\n"
|
|
" pnpm run test -- --focus frontend-tests.logic.components-and-tokens/change-token-in-main\n\n"
|
|
"Log level example (quiets app logging during the run):\n"
|
|
" pnpm run test -- --focus frontend-tests.logic.groups-test --log-level warn"))
|
|
|
|
(defn- fail!
|
|
[message]
|
|
(js/console.error message)
|
|
(.exit js/process 1))
|
|
|
|
(defn- parse-focus
|
|
[focus]
|
|
(let [[ns-name test-name & extra] (str/split focus #"/")]
|
|
(cond
|
|
(or (str/blank? ns-name) (seq extra))
|
|
(fail! (str "Invalid --focus value: " focus))
|
|
|
|
(some? test-name)
|
|
{:ns (symbol ns-name) :test test-name}
|
|
|
|
:else
|
|
{:ns (symbol ns-name)})))
|
|
|
|
(defn- fixture-value
|
|
[ns-obj fixture-name]
|
|
(let [value (gobj/get ns-obj (munge fixture-name))]
|
|
(when-not (undefined? value)
|
|
value)))
|
|
|
|
(defn- ns-test-vars
|
|
[ns-sym]
|
|
(when-let [ns-obj (find-ns-obj ns-sym)]
|
|
(->> (js-keys ns-obj)
|
|
(keep (fn [key]
|
|
(some-> (gobj/get ns-obj key)
|
|
(.-cljs$lang$var))))
|
|
(filter (comp :test meta))
|
|
(sort-by (comp :line meta)))))
|
|
|
|
(defn- ns-fixtures
|
|
[ns-sym vars]
|
|
(when-let [ns-obj (find-ns-obj ns-sym)]
|
|
(let [ns-key (or (some-> vars first meta :ns) ns-sym)
|
|
once-fixtures (fixture-value ns-obj "cljs-test-once-fixtures")
|
|
each-fixtures (fixture-value ns-obj "cljs-test-each-fixtures")]
|
|
{:once (when once-fixtures {ns-key once-fixtures})
|
|
:each (when each-fixtures {ns-key each-fixtures})})))
|
|
|
|
(defn- selected-tests
|
|
[{:keys [ns test]}]
|
|
(when-not (some #{ns} test-namespaces)
|
|
(fail! (str "Unknown test namespace: " ns)))
|
|
(let [vars (vec (ns-test-vars ns))]
|
|
(when (empty? vars)
|
|
(fail! (str "No tests found in namespace: " ns)))
|
|
(if test
|
|
(let [test-sym (symbol test)
|
|
test-var (some #(when (= test-sym (:name (meta %))) %) vars)]
|
|
(if test-var
|
|
{:vars [test-var]
|
|
:fixtures (ns-fixtures ns [test-var])}
|
|
(fail! (str "Unknown test var: " ns "/" test))))
|
|
{:vars vars
|
|
:fixtures (ns-fixtures ns vars)})))
|
|
|
|
(defn- merge-fixtures
|
|
[fixtures]
|
|
{:once (apply merge (keep :once fixtures))
|
|
:each (apply merge (keep :each fixtures))})
|
|
|
|
(defn- run-test-vars!
|
|
[tests]
|
|
(let [vars (vec (mapcat :vars tests))
|
|
fixtures (merge-fixtures (map :fixtures tests))
|
|
env (assoc (t/empty-env)
|
|
:once-fixtures (:once fixtures)
|
|
:each-fixtures (:each fixtures))
|
|
summary (volatile! {:test 0 :pass 0 :fail 0 :error 0 :type :summary})]
|
|
|
|
(t/set-env! env)
|
|
|
|
(t/run-block
|
|
(concat (t/test-vars-block vars)
|
|
[(fn []
|
|
(vswap! summary
|
|
(partial merge-with +)
|
|
(:report-counters (t/get-current-env))))
|
|
(fn []
|
|
(t/report @summary)
|
|
(t/report (assoc @summary :type :end-run-tests)))]))))
|
|
|
|
(defn- run-focused-test!
|
|
[focus]
|
|
(run-test-vars! [(selected-tests (parse-focus focus))]))
|
|
|
|
(defn init
|
|
[]
|
|
(let [{:keys [options errors summary]} (parse-opts (argv) cli-options)]
|
|
(cond
|
|
(seq errors)
|
|
(fail! (str/join "\n" errors))
|
|
|
|
(:help options)
|
|
(do
|
|
(println (usage summary))
|
|
(.exit js/process 0))
|
|
|
|
:else
|
|
(do
|
|
(l/setup! {:app (or (:log-level options) :warn)})
|
|
|
|
(if (:focus options)
|
|
(run-focused-test! (:focus options))
|
|
(run-test-vars! (map #(selected-tests {:ns %}) test-namespaces)))))))
|