Skip to content

AI-native design editor. Open-source Figma alternative.

test(core): move the fig round-trip suite home, and stop test imports drilling

Danila Poyarkov7140328b1d76
diff --git a/AGENTS.md b/AGENTS.md
index 730cb0310..d958d3049 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -44,7 +44,8 @@ Before a PR run `bun run check`, `bun run format`, `bun run test:unit`, and `bun
- Across package/app boundaries import the owning package's public exports, never workspace internals or forwarding-only shims. `@open-pencil/scene-graph` owns graph types and primitives; `@open-pencil/kiwi` owns low-level Kiwi/FIG helpers; `@open-pencil/core` provides the compatibility barrel plus the subpaths listed in `packages/core/package.json`.
- `bun run check:arch` enforces: public workspace exports, framework-neutral Core, no app services in views or shared UI, property-panel internals scoped to that panel.
-- Package aliases are `#core/*`, `#fig/*`, `#vue/*`, `#cli/*`, `#mcp/*`, `#dom-css/*`, `#design-jsx/*`; the app uses `@/`. Prefer clear relative imports nearby. Never escape an alias root with `../` (for example `#tests/../vite`); fix module ownership instead.
+- Package aliases are `#core/*`, `#fig/*`, `#vue/*`, `#cli/*`, `#mcp/*`, `#dom-css/*`, `#design-jsx/*`; a package's own tests use `#core-tests/*` and `#fig-tests/*`; the app uses `@/`. Prefer clear relative imports nearby. Never escape an alias root with `../` (for example `#tests/../vite`); fix module ownership instead.
+- Never drill with `../../`: one `../` to a sibling folder is fine, two or more means an alias. This holds in tests as much as in source — a test reaches its package's source through `#<pkg>/*` and its own helpers through `#<pkg>-tests/*`. `open-pencil/no-deep-parent-relative-imports` enforces it; a new test directory must be added to `lint:structure` so the rule reaches it.
- Reuse named types from `@open-pencil/scene-graph`; do not respell `Color`, `Vector`, `SceneNode`, `Effect`, `Fill`, or `Stroke`.
## Code conventions
diff --git a/package.json b/package.json
index e0122eb3c..864e784ec 100644
--- a/package.json
+++ b/package.json
@@ -51,7 +51,7 @@
"benchmark:navigation": "bun tools/dev/navigation-benchmark/src/cli.ts run",
"test:native": "bun run build:native-test && wdio run wdio.conf.ts",
"lint": "bun run lint:structure && oxlint -c oxlint.json --type-aware --type-check src/ packages/scene-graph/src/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/dom-css/src/ packages/pen/src/ packages/design-jsx/src/ packages/kiwi/src/ packages/fig/src/",
- "lint:structure": "oxlint -c oxlint.json commitlint.config.ts vite.config.ts vite/ .storybook/ src/ packages/scene-graph/src/ packages/scene-graph/scripts/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/harness/tests/ packages/dom-css/src/ packages/dom-css/tests/ packages/dom-css/scripts/ packages/pen/src/ packages/pen/scripts/ packages/design-jsx/src/ packages/design-jsx/tests/ packages/design-jsx/scripts/ packages/kiwi/src/ packages/kiwi/tests/ packages/kiwi/scripts/ packages/fig/src/ packages/fig/tests/ packages/fig/scripts/ tests/ scripts/ tools/",
+ "lint:structure": "oxlint -c oxlint.json commitlint.config.ts vite.config.ts vite/ .storybook/ src/ packages/scene-graph/src/ packages/scene-graph/scripts/ packages/core/src/ packages/vue/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/harness/tests/ packages/dom-css/src/ packages/dom-css/tests/ packages/dom-css/scripts/ packages/pen/src/ packages/pen/scripts/ packages/design-jsx/src/ packages/design-jsx/tests/ packages/design-jsx/scripts/ packages/kiwi/src/ packages/kiwi/tests/ packages/kiwi/scripts/ packages/fig/src/ packages/fig/tests/ packages/fig/scripts/ packages/core/tests/ packages/scene-graph/tests/ packages/vue/tests/ tests/ scripts/ tools/",
"format": "oxfmt --write .oxfmtrc.json commitlint.config.ts vite.config.ts vite/ .storybook/ src/ packages/scene-graph/src/ packages/scene-graph/scripts/ packages/core/src/ packages/cli/src/ packages/mcp/src/ packages/harness/src/ packages/harness/tests/ packages/vue/src/ packages/dom-css/src/ packages/dom-css/tests/ packages/dom-css/scripts/ packages/pen/src/ packages/pen/scripts/ packages/design-jsx/src/ packages/design-jsx/tests/ packages/design-jsx/scripts/ packages/kiwi/src/ packages/kiwi/tests/ packages/kiwi/scripts/ packages/fig/src/ packages/fig/tests/ packages/fig/scripts/ tests scripts/ tools/",
"format:check": "bun run format && status=$(git status --porcelain -uall) && test -z \"$status\" || (echo \"$status\" && exit 1)",
"check": "bun run check:icons && bun run build:packages && bun run lint && tsgo --noEmit && bun run check:vue && bun run check:native-test && bun run check:i18n && bun run check:docs && bun run check:changelog && bun run check:packages && bun run check:deps && bun run check:audit && bun run check:secrets && bun run check:monorepo && bun run check:arch && bun run check:test-homes && bun run test:type-shapes && bun run check:tools && bun run test:tools && bun run test:dupes",
diff --git a/packages/core/package.json b/packages/core/package.json
index 8bbc69cee..cfaa6916b 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -17,7 +17,8 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"imports": {
- "#core/*": "./src/*.ts"
+ "#core/*": "./src/*.ts",
+ "#core-tests/*": "./tests/*.ts"
},
"exports": {
"./package.json": "./package.json",
diff --git a/packages/core/tests/clipboard/figma/replacement-import.test.ts b/packages/core/tests/clipboard/figma/replacement-import.test.ts
index 775067389..fea1c21f8 100644
--- a/packages/core/tests/clipboard/figma/replacement-import.test.ts
+++ b/packages/core/tests/clipboard/figma/replacement-import.test.ts
@@ -3,7 +3,7 @@ import { expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/scene-graph'
import { prepareClipboardImport } from '#core/clipboard/fig-import'
-import { readFixtureJSON } from '../../helpers/fig/fixtures'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const fixture = readFixtureJSON<Record<string, unknown>[]>('nested-binding-ownership-records.json')
diff --git a/packages/core/tests/editor/clipboard/binding-corruption.test.ts b/packages/core/tests/editor/clipboard/binding-corruption.test.ts
index 222cbd0be..01bef975e 100644
--- a/packages/core/tests/editor/clipboard/binding-corruption.test.ts
+++ b/packages/core/tests/editor/clipboard/binding-corruption.test.ts
@@ -4,7 +4,7 @@ import { SceneGraph } from '@open-pencil/core'
import { collectSubtrees } from '@open-pencil/core/editor/clipboard/subtree-history'
import { createInstanceOverrideState } from '@open-pencil/scene-graph'
-import { expectDefined, getNodeOrThrow } from '../../helpers/assert'
+import { expectDefined, getNodeOrThrow } from '#core-tests/helpers/assert'
function pageId(graph: SceneGraph): string {
return graph.getPages()[0].id
diff --git a/packages/core/tests/editor/clipboard/delete.test.ts b/packages/core/tests/editor/clipboard/delete.test.ts
index 0fb72e5b8..8ceeb257a 100644
--- a/packages/core/tests/editor/clipboard/delete.test.ts
+++ b/packages/core/tests/editor/clipboard/delete.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, test } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
import { computeAllLayouts } from '@open-pencil/core/layout'
-import { getNodeOrThrow } from '../../helpers/assert'
-import { autoFrame, rect } from '../../helpers/layout'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { autoFrame, rect } from '#core-tests/helpers/layout'
describe('deleteSelected', () => {
test('reflows fixed vertical auto-layout siblings', () => {
diff --git a/packages/core/tests/editor/clipboard/fig-transfer-history.test.ts b/packages/core/tests/editor/clipboard/fig-transfer-history.test.ts
index f7dcce0b5..0e3ac6d0a 100644
--- a/packages/core/tests/editor/clipboard/fig-transfer-history.test.ts
+++ b/packages/core/tests/editor/clipboard/fig-transfer-history.test.ts
@@ -6,8 +6,8 @@ import { initCodec } from '@open-pencil/core/kiwi'
import { materializeFigFragment } from '@open-pencil/fig'
import { CommittedGraphEventError } from '@open-pencil/scene-graph'
-import { expectDefined } from '../../helpers/assert'
-import { readFixtureJSON } from '../../helpers/fig/fixtures'
+import { expectDefined } from '#core-tests/helpers/assert'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const fixture = readFixtureJSON<Record<string, unknown>[]>('nested-binding-ownership-records.json')
diff --git a/packages/core/tests/editor/clipboard/figma-images.test.ts b/packages/core/tests/editor/clipboard/figma-images.test.ts
index e6f6c0dfa..785d884fc 100644
--- a/packages/core/tests/editor/clipboard/figma-images.test.ts
+++ b/packages/core/tests/editor/clipboard/figma-images.test.ts
@@ -5,7 +5,7 @@ import { buildFigmaClipboardHTML } from '@open-pencil/core/clipboard'
import { createEditor } from '@open-pencil/core/editor'
import type { ClipboardImageResolution } from '@open-pencil/core/editor'
-import { expectDefined } from '../../helpers/assert'
+import { expectDefined } from '#core-tests/helpers/assert'
const IMAGE_HASH_A = '1111111111111111111111111111111111111111'
const IMAGE_HASH_B = '2222222222222222222222222222222222222222'
diff --git a/packages/core/tests/editor/clipboard/import-nodes/components.test.ts b/packages/core/tests/editor/clipboard/import-nodes/components.test.ts
index 310e67bc4..70923e9e8 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/components.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/components.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, it } from 'bun:test'
import { importClipboardNodes } from '@open-pencil/core'
import type { NodeChange } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../../helpers/assert'
-import { createClipboardGraph } from '../../../helpers/clipboard'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createClipboardGraph } from '#core-tests/helpers/clipboard'
describe('importClipboardNodes: components', () => {
it('maps SYMBOL type to COMPONENT with auto-layout', () => {
diff --git a/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts b/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts
index 19d750d09..6ebcbfd3b 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/filtering.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, it } from 'bun:test'
import { importClipboardNodes } from '@open-pencil/core'
import type { NodeChange } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../../helpers/assert'
-import { createClipboardGraph } from '../../../helpers/clipboard'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createClipboardGraph } from '#core-tests/helpers/clipboard'
describe('importClipboardNodes: filtering', () => {
it('skips VARIABLE_SET and VARIABLE nodes', () => {
diff --git a/packages/core/tests/editor/clipboard/import-nodes/hierarchy.test.ts b/packages/core/tests/editor/clipboard/import-nodes/hierarchy.test.ts
index 650e3c721..f897b4efe 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/hierarchy.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/hierarchy.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, it } from 'bun:test'
import { importClipboardNodes } from '@open-pencil/core'
import type { NodeChange } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../../helpers/assert'
-import { createClipboardGraph } from '../../../helpers/clipboard'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createClipboardGraph } from '#core-tests/helpers/clipboard'
describe('importClipboardNodes: hierarchy', () => {
it('imports nested frames with children', () => {
diff --git a/packages/core/tests/editor/clipboard/import-nodes/instance-linkage.test.ts b/packages/core/tests/editor/clipboard/import-nodes/instance-linkage.test.ts
index 21df941fb..1010ba50b 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/instance-linkage.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/instance-linkage.test.ts
@@ -5,7 +5,7 @@ import type { NodeChange } from '@open-pencil/core'
import { linkImportedInstanceChildren } from '@open-pencil/fig/node-change'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { getNodeOrThrow } from '../../../helpers/assert'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
describe('importClipboardNodes: instance child linkage', () => {
it('links serialized instance children so a later component sync does not duplicate them', () => {
diff --git a/packages/core/tests/editor/clipboard/import-nodes/styling.test.ts b/packages/core/tests/editor/clipboard/import-nodes/styling.test.ts
index 699088cfd..9173b5701 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/styling.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/styling.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, it } from 'bun:test'
import { importClipboardNodes } from '@open-pencil/core'
import type { NodeChange } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../../helpers/assert'
-import { createClipboardGraph } from '../../../helpers/clipboard'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createClipboardGraph } from '#core-tests/helpers/clipboard'
describe('importClipboardNodes: styling', () => {
it('preserves fills and strokes', () => {
diff --git a/packages/core/tests/editor/clipboard/import-nodes/text/metrics.test.ts b/packages/core/tests/editor/clipboard/import-nodes/text/metrics.test.ts
index b9bcb5ae7..93937b7ce 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/text/metrics.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/text/metrics.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, it } from 'bun:test'
import { importClipboardNodes } from '@open-pencil/core'
import type { NodeChange } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../../../helpers/assert'
-import { createClipboardGraph } from '../../../../helpers/clipboard'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createClipboardGraph } from '#core-tests/helpers/clipboard'
describe('importClipboardNodes: text metrics', () => {
it('imports fontWeight from fontName.style via styleToWeight', () => {
diff --git a/packages/core/tests/editor/clipboard/import-nodes/undo/redo.test.ts b/packages/core/tests/editor/clipboard/import-nodes/undo/redo.test.ts
index 81a21a9c2..7c6556d65 100644
--- a/packages/core/tests/editor/clipboard/import-nodes/undo/redo.test.ts
+++ b/packages/core/tests/editor/clipboard/import-nodes/undo/redo.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, it } from 'bun:test'
import { importClipboardNodes } from '@open-pencil/core'
import type { NodeChange, SceneNode } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../../../helpers/assert'
-import { createClipboardGraph } from '../../../../helpers/clipboard'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createClipboardGraph } from '#core-tests/helpers/clipboard'
describe('importClipboardNodes: undo redo', () => {
it('undo removes all imported nodes including children', () => {
diff --git a/packages/core/tests/editor/clipboard/paste-target.test.ts b/packages/core/tests/editor/clipboard/paste-target.test.ts
index 9acbdc1b7..a6da637c2 100644
--- a/packages/core/tests/editor/clipboard/paste-target.test.ts
+++ b/packages/core/tests/editor/clipboard/paste-target.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, test } from 'bun:test'
import { createEditor, type EditorState } from '@open-pencil/core/editor'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { resolvePasteTarget } from '../../../src/editor/clipboard/paste-target'
+import { resolvePasteTarget } from '#core/editor/clipboard/paste-target'
function setup() {
const graph = new SceneGraph()
diff --git a/packages/core/tests/editor/components/sync-layout-scope.test.ts b/packages/core/tests/editor/components/sync-layout-scope.test.ts
index 5a35cdd9a..3a379aa72 100644
--- a/packages/core/tests/editor/components/sync-layout-scope.test.ts
+++ b/packages/core/tests/editor/components/sync-layout-scope.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, test } from 'bun:test'
import { computeAllLayouts } from '@open-pencil/core/layout'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { createComponentSyncScheduler } from '../../../src/editor/component-sync'
-import { expectDefined } from '../../helpers/assert'
+import { createComponentSyncScheduler } from '#core/editor/component-sync'
+import { expectDefined } from '#core-tests/helpers/assert'
function createGraph() {
const graph = new SceneGraph()
diff --git a/packages/core/tests/editor/components/transitive-sync.test.ts b/packages/core/tests/editor/components/transitive-sync.test.ts
index 040bc9622..8b4615888 100644
--- a/packages/core/tests/editor/components/transitive-sync.test.ts
+++ b/packages/core/tests/editor/components/transitive-sync.test.ts
@@ -3,7 +3,7 @@ import { expect, test } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { expectDefined } from '../../helpers/assert'
+import { expectDefined } from '#core-tests/helpers/assert'
test('component edits propagate across definition dependencies and undo/redo', async () => {
const graph = new SceneGraph()
diff --git a/packages/core/tests/editor/graph/events-integration.test.ts b/packages/core/tests/editor/graph/events-integration.test.ts
index f74b3905a..442c54d0d 100644
--- a/packages/core/tests/editor/graph/events-integration.test.ts
+++ b/packages/core/tests/editor/graph/events-integration.test.ts
@@ -5,7 +5,7 @@ import { SceneGraph } from '@open-pencil/scene-graph'
import {
createGraphEventSubscription,
type GraphEventRenderer
-} from '../../../src/editor/graph-events'
+} from '#core/editor/graph-events'
function createRenderer() {
const invalidated: string[] = []
diff --git a/packages/core/tests/editor/graph/events.test.ts b/packages/core/tests/editor/graph/events.test.ts
index 1c031c009..6ca990782 100644
--- a/packages/core/tests/editor/graph/events.test.ts
+++ b/packages/core/tests/editor/graph/events.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
-import { rendererInvalidationForChanges } from '../../../src/editor/graph-events'
+import { rendererInvalidationForChanges } from '#core/editor/graph-events'
describe('graph event renderer invalidation', () => {
test('committed updates always invalidate node pictures', () => {
diff --git a/packages/core/tests/editor/pages/loading.test.ts b/packages/core/tests/editor/pages/loading.test.ts
index 5e7226987..216902827 100644
--- a/packages/core/tests/editor/pages/loading.test.ts
+++ b/packages/core/tests/editor/pages/loading.test.ts
@@ -3,7 +3,7 @@ import { expect, test } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
import { SceneGraph } from '@open-pencil/scene-graph'
-import type { PageSwitchProgress } from '../../../src/editor/pages'
+import type { PageSwitchProgress } from '#core/editor/pages'
test('core page preparation only reports progress and never owns app suspension', async () => {
const graph = new SceneGraph()
diff --git a/packages/core/tests/editor/selection/alignment.test.ts b/packages/core/tests/editor/selection/alignment.test.ts
index 7bc944105..b14b8afd7 100644
--- a/packages/core/tests/editor/selection/alignment.test.ts
+++ b/packages/core/tests/editor/selection/alignment.test.ts
@@ -2,8 +2,8 @@ import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../helpers/assert'
-import { createRect, firstPageId } from '../../helpers/scene'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createRect, firstPageId } from '#core-tests/helpers/scene'
describe('single-node alignment to parent', () => {
function setup() {
diff --git a/packages/core/tests/editor/selection/flip.test.ts b/packages/core/tests/editor/selection/flip.test.ts
index aba630110..f8d213f9f 100644
--- a/packages/core/tests/editor/selection/flip.test.ts
+++ b/packages/core/tests/editor/selection/flip.test.ts
@@ -2,8 +2,8 @@ import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
-import { expectDefined, getNodeOrThrow } from '../../helpers/assert'
-import { createRect, firstPageId } from '../../helpers/scene'
+import { expectDefined, getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createRect, firstPageId } from '#core-tests/helpers/scene'
describe('flip', () => {
test('flipX defaults to false', () => {
diff --git a/packages/core/tests/editor/selection/properties.test.ts b/packages/core/tests/editor/selection/properties.test.ts
index 27c6d8b92..e18ae266a 100644
--- a/packages/core/tests/editor/selection/properties.test.ts
+++ b/packages/core/tests/editor/selection/properties.test.ts
@@ -2,8 +2,8 @@ import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
-import { getNodeOrThrow } from '../../helpers/assert'
-import { createRect, firstPageId } from '../../helpers/scene'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createRect, firstPageId } from '#core-tests/helpers/scene'
describe('multi-node property merging', () => {
test('same values merge to single value', () => {
diff --git a/packages/core/tests/editor/structure/flatten.test.ts b/packages/core/tests/editor/structure/flatten.test.ts
index aabe04893..588398fea 100644
--- a/packages/core/tests/editor/structure/flatten.test.ts
+++ b/packages/core/tests/editor/structure/flatten.test.ts
@@ -6,7 +6,7 @@ import { createEditor } from '@open-pencil/core/editor'
import { initCanvasKit } from '@open-pencil/core/io'
import { fontManager } from '@open-pencil/core/text'
-import { textNodeToOutlineLayout } from '../../../src/text/outlines'
+import { textNodeToOutlineLayout } from '#core/text/outlines'
async function createEditorWithRenderer() {
const ck = await initCanvasKit()
diff --git a/packages/core/tests/editor/structure/state.test.ts b/packages/core/tests/editor/structure/state.test.ts
index ef52a2fde..a49430e42 100644
--- a/packages/core/tests/editor/structure/state.test.ts
+++ b/packages/core/tests/editor/structure/state.test.ts
@@ -3,8 +3,8 @@ import { describe, expect, test } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
import { computeAllLayouts } from '@open-pencil/core/layout'
-import { getNodeOrThrow } from '../../helpers/assert'
-import { rect } from '../../helpers/layout'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
+import { rect } from '#core-tests/helpers/layout'
describe('structure state actions', () => {
test('toggleNodeVisibility reflows HUG auto-layout instance slots', async () => {
diff --git a/packages/core/tests/editor/undo/basic.test.ts b/packages/core/tests/editor/undo/basic.test.ts
index baf1af536..39cda4a29 100644
--- a/packages/core/tests/editor/undo/basic.test.ts
+++ b/packages/core/tests/editor/undo/basic.test.ts
@@ -1,6 +1,6 @@
import { describe, test, expect } from 'bun:test'
-import { createUndoManager, undoEntry } from '../../helpers/undo'
+import { createUndoManager, undoEntry } from '#core-tests/helpers/undo'
describe('UndoManager', () => {
test('initial state', () => {
diff --git a/packages/core/tests/editor/undo/batch-idle.test.ts b/packages/core/tests/editor/undo/batch-idle.test.ts
index e4eedd174..e45774ae7 100644
--- a/packages/core/tests/editor/undo/batch-idle.test.ts
+++ b/packages/core/tests/editor/undo/batch-idle.test.ts
@@ -1,6 +1,6 @@
import { describe, test, expect } from 'bun:test'
-import { createUndoManager, noop, undoEntry } from '../../helpers/undo'
+import { createUndoManager, noop, undoEntry } from '#core-tests/helpers/undo'
function assignValue(setValue: (value: number) => void, value: number) {
return () => setValue(value)
diff --git a/packages/core/tests/editor/undo/create-instance.test.ts b/packages/core/tests/editor/undo/create-instance.test.ts
index 529bd0830..0ee3881ca 100644
--- a/packages/core/tests/editor/undo/create-instance.test.ts
+++ b/packages/core/tests/editor/undo/create-instance.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, test } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
import { getAxisAlignedWorldBounds } from '@open-pencil/scene-graph/coordinate'
-import { expectDefined } from '../../helpers/assert'
+import { expectDefined } from '#core-tests/helpers/assert'
describe('create instance undo/redo', () => {
test('places a nested component beside its world bounds on the page', () => {
diff --git a/packages/core/tests/editor/undo/create-shape.test.ts b/packages/core/tests/editor/undo/create-shape.test.ts
index fe39c1445..4f8f2901f 100644
--- a/packages/core/tests/editor/undo/create-shape.test.ts
+++ b/packages/core/tests/editor/undo/create-shape.test.ts
@@ -2,7 +2,7 @@ import { describe, test, expect } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
-import { getNodeOrThrow } from '../../helpers/assert'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
describe('create shape undo/redo', () => {
test('batched create+resize undoes in one step', () => {
diff --git a/packages/core/tests/editor/undo/group-resize.test.ts b/packages/core/tests/editor/undo/group-resize.test.ts
index 3ead26fdf..fe9f26e38 100644
--- a/packages/core/tests/editor/undo/group-resize.test.ts
+++ b/packages/core/tests/editor/undo/group-resize.test.ts
@@ -4,7 +4,7 @@ import { createEditor } from '@open-pencil/core/editor'
import type { VectorNetwork } from '@open-pencil/scene-graph'
import { createResizeSnapshot } from '@open-pencil/scene-graph/resize'
-import { getNodeOrThrow } from '../../helpers/assert'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
const originalVectorNetwork: VectorNetwork = {
vertices: [
diff --git a/packages/core/tests/editor/undo/redo-sequence.test.ts b/packages/core/tests/editor/undo/redo-sequence.test.ts
index 7be6559f5..91d052801 100644
--- a/packages/core/tests/editor/undo/redo-sequence.test.ts
+++ b/packages/core/tests/editor/undo/redo-sequence.test.ts
@@ -1,7 +1,7 @@
import { describe, test, expect } from 'bun:test'
-import { expectDefined, getNodeOrThrow } from '../../helpers/assert'
-import { createHistoryFrame, setupEditorPage } from '../../helpers/editor-history'
+import { expectDefined, getNodeOrThrow } from '#core-tests/helpers/assert'
+import { createHistoryFrame, setupEditorPage } from '#core-tests/helpers/editor-history'
describe('undo/redo multi-step sequences', () => {
test('create → move → duplicate → move copy → undo all → redo all', () => {
diff --git a/packages/core/tests/editor/undo/variable-bindings.test.ts b/packages/core/tests/editor/undo/variable-bindings.test.ts
index 7cc1f4577..8ec50f23c 100644
--- a/packages/core/tests/editor/undo/variable-bindings.test.ts
+++ b/packages/core/tests/editor/undo/variable-bindings.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { createEditor } from '@open-pencil/core/editor'
-import { getNodeOrThrow } from '../../helpers/assert'
+import { getNodeOrThrow } from '#core-tests/helpers/assert'
function pageId(editor: ReturnType<typeof createEditor>): string {
return editor.graph.getPages()[0].id
diff --git a/packages/core/tests/figma-api/effects.test.ts b/packages/core/tests/figma-api/effects.test.ts
index 104ca79c4..12eb30f1a 100644
--- a/packages/core/tests/figma-api/effects.test.ts
+++ b/packages/core/tests/figma-api/effects.test.ts
@@ -88,7 +88,9 @@ describe('node.effects', () => {
test('accepts its own effects back', () => {
const rect = assign([shadow, { type: 'LAYER_BLUR', radius: 4, visible: true }])
const before = rect.effects
- rect.effects = rect.effects
+ // Assigning the live array back through the setter must not clear or duplicate it.
+ const ownEffects = rect.effects
+ rect.effects = ownEffects
expect(rect.effects).toEqual(before)
})
diff --git a/packages/core/tests/helpers/undo.ts b/packages/core/tests/helpers/undo.ts
index 0b3994b2c..c2e431b8c 100644
--- a/packages/core/tests/helpers/undo.ts
+++ b/packages/core/tests/helpers/undo.ts
@@ -1,6 +1,7 @@
import { UndoManager } from '@open-pencil/scene-graph'
-export function noop(): void {}
+/** An undo entry that records nothing, for tests that only care about the batching. */
+export const noop = (): void => undefined
export function createUndoManager(options?: ConstructorParameters<typeof UndoManager>[0]) {
return new UndoManager(options)
diff --git a/packages/core/tests/io/formats/fig/export/binding/authoring.test.ts b/packages/core/tests/io/formats/fig/export/binding/authoring.test.ts
index a1f01299c..128b67553 100644
--- a/packages/core/tests/io/formats/fig/export/binding/authoring.test.ts
+++ b/packages/core/tests/io/formats/fig/export/binding/authoring.test.ts
@@ -8,9 +8,9 @@ import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import { cloneInstanceOverrideState } from '@open-pencil/scene-graph'
-import { expectDefined } from '../../../../../helpers/assert'
-import { inheritedNestedBindingRecords } from '../../../../../helpers/fig/nested-binding'
-import { readFixtureJSON } from '../../../../../helpers/fig/fixtures'
+import { expectDefined } from '#core-tests/helpers/assert'
+import { inheritedNestedBindingRecords } from '#core-tests/helpers/fig/nested-binding'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const oracle = readFixtureJSON<Record<string, unknown>[]>('nested-binding-authoring.json')
diff --git a/packages/core/tests/io/formats/fig/export/binding/import.test.ts b/packages/core/tests/io/formats/fig/export/binding/import.test.ts
index 42184c6da..b3214ddae 100644
--- a/packages/core/tests/io/formats/fig/export/binding/import.test.ts
+++ b/packages/core/tests/io/formats/fig/export/binding/import.test.ts
@@ -5,7 +5,7 @@ import { exportFigFile } from '@open-pencil/core/io'
import { initCodec } from '@open-pencil/core/kiwi'
import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
-import { readFixtureJSON } from '../../../../../helpers/fig/fixtures'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const fixture = readFixtureJSON<Record<string, unknown>[]>('nested-binding-ownership-records.json')
diff --git a/packages/core/tests/io/formats/fig/export/definition-rescale.test.ts b/packages/core/tests/io/formats/fig/export/definition-rescale.test.ts
index 134e0b7f8..96fffa76a 100644
--- a/packages/core/tests/io/formats/fig/export/definition-rescale.test.ts
+++ b/packages/core/tests/io/formats/fig/export/definition-rescale.test.ts
@@ -6,9 +6,9 @@ import { exportFigFile } from '@open-pencil/core/io'
import { initCodec } from '@open-pencil/core/kiwi'
import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
-import { expectDefined } from '../../../../helpers/assert'
-import { inheritedNestedBindingRecords } from '../../../../helpers/fig/nested-binding'
-import { readFixtureJSON } from '../../../../helpers/fig/fixtures'
+import { expectDefined } from '#core-tests/helpers/assert'
+import { inheritedNestedBindingRecords } from '#core-tests/helpers/fig/nested-binding'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const fixture = readFixtureJSON<Record<string, unknown>[]>('nested-binding-ownership-records.json')
diff --git a/packages/core/tests/io/formats/fig/export/gold-edit.test.ts b/packages/core/tests/io/formats/fig/export/gold-edit.test.ts
index 5b2ad1359..30da38f12 100644
--- a/packages/core/tests/io/formats/fig/export/gold-edit.test.ts
+++ b/packages/core/tests/io/formats/fig/export/gold-edit.test.ts
@@ -6,7 +6,7 @@ import { initCodec } from '@open-pencil/core/kiwi'
import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
import type { SceneNode } from '@open-pencil/scene-graph'
-import { readFixtureArrayBuffer } from '../../../../helpers/fig/fixtures'
+import { readFixtureArrayBuffer } from '#core-tests/helpers/fig/fixtures'
test('Gold document exposes effective Boolean assignments and supports editor undo/redo', async () => {
const parsed = parseFigBuffer(readFixtureArrayBuffer('gold-preview.fig'))
diff --git a/packages/core/tests/io/formats/fig/export/layout-edit-export.test.ts b/packages/core/tests/io/formats/fig/export/layout-edit-export.test.ts
index eecbf7f15..21404b106 100644
--- a/packages/core/tests/io/formats/fig/export/layout-edit-export.test.ts
+++ b/packages/core/tests/io/formats/fig/export/layout-edit-export.test.ts
@@ -5,7 +5,7 @@ import { initCodec } from '@open-pencil/core/kiwi'
import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
-import { guid } from '../../../../helpers/fig/guid'
+import { guid } from '#core-tests/helpers/fig/guid'
test('retained implicit layout survives import but does not override an explicit sizing edit', async () => {
await initCodec()
diff --git a/packages/core/tests/io/formats/fig/export/layout-scale.test.ts b/packages/core/tests/io/formats/fig/export/layout-scale.test.ts
index ade945bcb..16c9a0724 100644
--- a/packages/core/tests/io/formats/fig/export/layout-scale.test.ts
+++ b/packages/core/tests/io/formats/fig/export/layout-scale.test.ts
@@ -8,7 +8,7 @@ import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
import type { SymbolData } from '@open-pencil/fig/instance-overrides'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import { hasInstanceOverride } from '@open-pencil/scene-graph'
-import { readFixtureJSON } from '../../../../helpers/fig/fixtures'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const fixture = readFixtureJSON<Record<string, unknown>[]>('nested-layout-scale.json')
diff --git a/packages/core/tests/io/formats/fig/export/live-variable-scale.test.ts b/packages/core/tests/io/formats/fig/export/live-variable-scale.test.ts
index 190d83ffd..e6e4160c5 100644
--- a/packages/core/tests/io/formats/fig/export/live-variable-scale.test.ts
+++ b/packages/core/tests/io/formats/fig/export/live-variable-scale.test.ts
@@ -6,7 +6,7 @@ import { initCodec } from '@open-pencil/core/kiwi'
import { materializeDocument, parseFigBuffer } from '@open-pencil/fig'
import type { SceneGraph, SceneNode } from '@open-pencil/scene-graph'
-import { readFixtureArrayBuffer } from '../../../../helpers/fig/fixtures'
+import { readFixtureArrayBuffer } from '#core-tests/helpers/fig/fixtures'
function tagsInInput(graph: SceneGraph, rootId: string): SceneNode {
const found: SceneNode[] = []
diff --git a/packages/core/tests/io/formats/fig/export/nested-override-address.test.ts b/packages/core/tests/io/formats/fig/export/nested-override-address.test.ts
index 788acb6f4..35e11123e 100644
--- a/packages/core/tests/io/formats/fig/export/nested-override-address.test.ts
+++ b/packages/core/tests/io/formats/fig/export/nested-override-address.test.ts
@@ -4,7 +4,7 @@ import { exportFigFile, FigmaAPI, initCodec, parseFigFile, SceneGraph } from '@o
import { parseFigBuffer } from '@open-pencil/fig'
import { guidToString } from '@open-pencil/kiwi/fig/guid'
-import { expectDefined } from '../../../../helpers/assert'
+import { expectDefined } from '#core-tests/helpers/assert'
// Captured from Figma's own clipboard encoding of the same edit: a text override inside a
// nested instance is addressed as [nested instance, the nested component's child], never as
diff --git a/packages/core/tests/io/formats/fig/export/rescale-export.test.ts b/packages/core/tests/io/formats/fig/export/rescale-export.test.ts
index 1ce858dd7..d0baf6595 100644
--- a/packages/core/tests/io/formats/fig/export/rescale-export.test.ts
+++ b/packages/core/tests/io/formats/fig/export/rescale-export.test.ts
@@ -9,8 +9,8 @@ import type { SymbolData } from '@open-pencil/fig/instance-overrides'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import { setInstanceOverride } from '@open-pencil/scene-graph'
-import { expectDefined } from '../../../../helpers/assert'
-import { readFixtureJSON } from '../../../../helpers/fig/fixtures'
+import { expectDefined } from '#core-tests/helpers/assert'
+import { readFixtureJSON } from '#core-tests/helpers/fig/fixtures'
const fixture = readFixtureJSON<Record<string, unknown>[]>('nested-binding-ownership-records.json')
diff --git a/packages/core/tests/io/formats/fig/import/stale-overrides.test.ts b/packages/core/tests/io/formats/fig/import/stale-overrides.test.ts
index 6fbb2ab2f..383bfcc88 100644
--- a/packages/core/tests/io/formats/fig/import/stale-overrides.test.ts
+++ b/packages/core/tests/io/formats/fig/import/stale-overrides.test.ts
@@ -6,8 +6,8 @@ import { parseFigBuffer } from '@open-pencil/fig'
import { readerDiagnostics, registerReaderSession } from '#core/kiwi/fig/session/document-state'
import { openReaderSession } from '#core/kiwi/fig/session/reader'
-import { readFixtureArrayBuffer } from '../../../../helpers/fig/fixtures'
-import { HEAVY_TEST_TIMEOUT_MS, runsHeavyTests } from '../../../../helpers/test-utils'
+import { readFixtureArrayBuffer } from '#core-tests/helpers/fig/fixtures'
+import { HEAVY_TEST_TIMEOUT_MS, runsHeavyTests } from '#core-tests/helpers/test-utils'
// material3.fig retains overrides on 58114:20598 that address 57994:10133, a node the
// archive no longer contains. Figma keeps such records; opening the file must not.
diff --git a/packages/core/tests/io/formats/fig/instance/component-sync.test.ts b/packages/core/tests/io/formats/fig/instance/component-sync.test.ts
index fafa191ed..677540b72 100644
--- a/packages/core/tests/io/formats/fig/instance/component-sync.test.ts
+++ b/packages/core/tests/io/formats/fig/instance/component-sync.test.ts
@@ -7,7 +7,7 @@ import { interpretInstance, materializeInstance } from '@open-pencil/fig/instanc
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { guid } from '../../../../helpers/fig/guid'
+import { guid } from '#core-tests/helpers/fig/guid'
test('nested instances retain their outer source-child correspondence during sync', () => {
const source: NodeChange[] = [
diff --git a/packages/core/tests/io/formats/fig/instance/derived-geometry.test.ts b/packages/core/tests/io/formats/fig/instance/derived-geometry.test.ts
index 7ae84fc17..c16383995 100644
--- a/packages/core/tests/io/formats/fig/instance/derived-geometry.test.ts
+++ b/packages/core/tests/io/formats/fig/instance/derived-geometry.test.ts
@@ -5,7 +5,7 @@ import { interpretInstance, materializeInstance } from '@open-pencil/fig/instanc
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { guid } from '../../../../helpers/fig/guid'
+import { guid } from '#core-tests/helpers/fig/guid'
test('text overrides discard inherited glyph data but accept occurrence-derived replacement data', () => {
const changes = [
diff --git a/packages/core/tests/io/formats/fig/instance/gold/preview.test.ts b/packages/core/tests/io/formats/fig/instance/gold/preview.test.ts
index 6c0943d08..6b969f148 100644
--- a/packages/core/tests/io/formats/fig/instance/gold/preview.test.ts
+++ b/packages/core/tests/io/formats/fig/instance/gold/preview.test.ts
@@ -1,23 +1,13 @@
import { expect, test } from 'bun:test'
-import { materializeComponentClosure } from '@open-pencil/fig/instance-overrides'
-import {
- linkInstanceSourceChildren,
- mapInstanceSourceChildren
-} from '@open-pencil/fig/instance-overrides'
-
+import { interpretInstance, linkInstanceSourceChildren, mapInstanceSourceChildren, materializeComponentClosure, materializeInstance, type InstanceOccurrence } from '@open-pencil/fig/instance-overrides'
import { FigmaAPI } from '@open-pencil/core'
import { exportFigFile, parseFigFile } from '@open-pencil/core/io'
import { initCodec } from '@open-pencil/core/kiwi'
import { parseFigBuffer } from '@open-pencil/fig'
-import {
- type InstanceOccurrence,
- interpretInstance,
- materializeInstance
-} from '@open-pencil/fig/instance-overrides'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { readFixtureArrayBuffer } from '../../../../../helpers/fig/fixtures'
+import { readFixtureArrayBuffer } from '#core-tests/helpers/fig/fixtures'
function named(node: InstanceOccurrence, name: string): InstanceOccurrence {
const child = node.children.find((candidate) => candidate.properties.name === name)
diff --git a/packages/core/tests/io/formats/fig/instance/source-children.test.ts b/packages/core/tests/io/formats/fig/instance/source-children.test.ts
index c185661c0..112cea6be 100644
--- a/packages/core/tests/io/formats/fig/instance/source-children.test.ts
+++ b/packages/core/tests/io/formats/fig/instance/source-children.test.ts
@@ -1,19 +1,13 @@
import { expect, test } from 'bun:test'
-import { interpretComponent } from '@open-pencil/fig/instance-overrides'
-import {
- linkInstanceSourceChildren,
- mapInstanceSourceChildren
-} from '@open-pencil/fig/instance-overrides'
-
+import { interpretComponent, interpretInstance, linkInstanceSourceChildren, mapInstanceSourceChildren, materializeInstance } from '@open-pencil/fig/instance-overrides'
import { FigmaAPI } from '@open-pencil/core'
import { exportFigFile, parseFigFile } from '@open-pencil/core/io'
import { initCodec } from '@open-pencil/core/kiwi'
-import { interpretInstance, materializeInstance } from '@open-pencil/fig/instance-overrides'
import type { NodeChange } from '@open-pencil/kiwi/fig/codec'
import { SceneGraph } from '@open-pencil/scene-graph'
-import { guid } from '../../../../helpers/fig/guid'
+import { guid } from '#core-tests/helpers/fig/guid'
test('derives repeated nested child correspondence from materialized component occurrences', async () => {
const changes: NodeChange[] = [
diff --git a/tests/engine/io/fig/roundtrip/basic.test.ts b/packages/core/tests/io/formats/fig/roundtrip/basic.test.ts
similarity index 98%
rename from tests/engine/io/fig/roundtrip/basic.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/basic.test.ts
index 7cbb9996f..07a13d627 100644
--- a/tests/engine/io/fig/roundtrip/basic.test.ts
+++ b/packages/core/tests/io/formats/fig/roundtrip/basic.test.ts
@@ -9,8 +9,8 @@ import {
} from '@open-pencil/core'
import { populateFigPage } from '@open-pencil/core/io/formats/fig'
-import { expectDefined } from '#tests/helpers/assert'
-import { collectAllNodes, countByType } from '#tests/helpers/fig/traversal'
+import { expectDefined } from '#core-tests/helpers/assert'
+import { collectAllNodes, countByType } from '#core-tests/helpers/fig/traversal'
setDefaultTimeout(60_000)
diff --git a/tests/engine/io/fig/roundtrip/exhaustive.test.ts b/packages/core/tests/io/formats/fig/roundtrip/exhaustive.test.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/exhaustive.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/exhaustive.test.ts
diff --git a/tests/engine/io/fig/roundtrip/export-settings.test.ts b/packages/core/tests/io/formats/fig/roundtrip/export-settings.test.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/export-settings.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/export-settings.test.ts
diff --git a/tests/engine/io/fig/roundtrip/glyph-blob.test.ts b/packages/core/tests/io/formats/fig/roundtrip/glyph-blob.test.ts
similarity index 93%
rename from tests/engine/io/fig/roundtrip/glyph-blob.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/glyph-blob.test.ts
index 045254eb4..a4d1a39f3 100644
--- a/tests/engine/io/fig/roundtrip/glyph-blob.test.ts
+++ b/packages/core/tests/io/formats/fig/roundtrip/glyph-blob.test.ts
@@ -6,10 +6,11 @@ import { exportFigFile, initCodec, parseFigFile, SceneGraph } from '@open-pencil
import { fontManager } from '@open-pencil/core/text'
import { parseFigBuffer } from '@open-pencil/fig'
-import { HEAVY_TEST_TIMEOUT_MS } from '#tests/helpers/test-utils'
+import { HEAVY_TEST_TIMEOUT_MS } from '#core-tests/helpers/test-utils'
-const FIXTURES = resolve(import.meta.dir, '../../../../fixtures')
-const INTER_ASSETS = resolve(import.meta.dir, '../../../../../packages/core/assets')
+import { FIXTURES } from '#core-tests/helpers/fig/fixtures'
+
+const INTER_ASSETS = resolve(import.meta.dir, '../../../../../assets')
function countGlyphBlobs(bytes: Uint8Array) {
const parsed = parseFigBuffer(
diff --git a/tests/engine/io/fig/roundtrip/group.test.ts b/packages/core/tests/io/formats/fig/roundtrip/group.test.ts
similarity index 93%
rename from tests/engine/io/fig/roundtrip/group.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/group.test.ts
index c5365cf34..b690e0a55 100644
--- a/tests/engine/io/fig/roundtrip/group.test.ts
+++ b/packages/core/tests/io/formats/fig/roundtrip/group.test.ts
@@ -2,7 +2,7 @@ import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
import { exportFigFile, initCodec, parseFigFile, SceneGraph } from '@open-pencil/core'
-import { collectAllNodes } from '#tests/helpers/fig/traversal'
+import { collectAllNodes } from '#core-tests/helpers/fig/traversal'
setDefaultTimeout(60_000)
diff --git a/tests/engine/io/fig/roundtrip/helpers.ts b/packages/core/tests/io/formats/fig/roundtrip/helpers.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/helpers.ts
rename to packages/core/tests/io/formats/fig/roundtrip/helpers.ts
diff --git a/tests/engine/io/fig/roundtrip/raw-verifiers/helpers.ts b/packages/core/tests/io/formats/fig/roundtrip/raw-verifiers/helpers.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/raw-verifiers/helpers.ts
rename to packages/core/tests/io/formats/fig/roundtrip/raw-verifiers/helpers.ts
diff --git a/tests/engine/io/fig/roundtrip/source-metadata.test.ts b/packages/core/tests/io/formats/fig/roundtrip/source-metadata.test.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/source-metadata.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/source-metadata.test.ts
diff --git a/tests/engine/io/fig/roundtrip/variables.test.ts b/packages/core/tests/io/formats/fig/roundtrip/variables.test.ts
similarity index 98%
rename from tests/engine/io/fig/roundtrip/variables.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/variables.test.ts
index eb9d4356f..c1daa5be4 100644
--- a/tests/engine/io/fig/roundtrip/variables.test.ts
+++ b/packages/core/tests/io/formats/fig/roundtrip/variables.test.ts
@@ -9,9 +9,9 @@ import {
type Color
} from '@open-pencil/core'
-import { expectDefined } from '#tests/helpers/assert'
-import { parseFixture } from '#tests/helpers/fig/fixtures'
-import { runsHeavyTests } from '#tests/helpers/test-utils'
+import { expectDefined } from '#core-tests/helpers/assert'
+import { parseFixture } from '#core-tests/helpers/fig/fixtures'
+import { runsHeavyTests } from '#core-tests/helpers/test-utils'
setDefaultTimeout(60_000)
diff --git a/tests/engine/io/fig/roundtrip/verifier-contracts.test.ts b/packages/core/tests/io/formats/fig/roundtrip/verifier-contracts.test.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/verifier-contracts.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/verifier-contracts.test.ts
diff --git a/tests/engine/io/fig/roundtrip/verifiers.test.ts b/packages/core/tests/io/formats/fig/roundtrip/verifiers.test.ts
similarity index 100%
rename from tests/engine/io/fig/roundtrip/verifiers.test.ts
rename to packages/core/tests/io/formats/fig/roundtrip/verifiers.test.ts
diff --git a/packages/scene-graph/tests/clone/node-props.test.ts b/packages/scene-graph/tests/clone/node-props.test.ts
index 0eaa7f881..d5670bab3 100644
--- a/packages/scene-graph/tests/clone/node-props.test.ts
+++ b/packages/scene-graph/tests/clone/node-props.test.ts
@@ -1,7 +1,6 @@
import { describe, expect, test } from 'bun:test'
-import { SceneGraph, type SceneNode } from '@open-pencil/scene-graph'
-import { getInstanceOverride, setInstanceOverride } from '@open-pencil/scene-graph'
+import { SceneGraph, getInstanceOverride, setInstanceOverride, type SceneNode } from '@open-pencil/scene-graph'
import { cloneNodeProps } from '@open-pencil/scene-graph/copy'
import { expectDefined, getNodeOrThrow } from '../helpers/assert'
diff --git a/packages/scene-graph/tests/variable/binding/instance-override.test.ts b/packages/scene-graph/tests/variable/binding/instance-override.test.ts
index c9292f040..8f49d63e0 100644
--- a/packages/scene-graph/tests/variable/binding/instance-override.test.ts
+++ b/packages/scene-graph/tests/variable/binding/instance-override.test.ts
@@ -1,8 +1,6 @@
import { describe, expect, test } from 'bun:test'
-import { SceneGraph } from '@open-pencil/scene-graph'
-import { getInstanceOverride } from '@open-pencil/scene-graph'
-
+import { SceneGraph, getInstanceOverride } from '@open-pencil/scene-graph'
function pageId(graph: SceneGraph): string {
return graph.getPages()[0].id
}
diff --git a/tests/AGENTS.md b/tests/AGENTS.md
index 42cfa45d7..45d21d493 100644
--- a/tests/AGENTS.md
+++ b/tests/AGENTS.md
@@ -6,6 +6,7 @@
- Package-local tests mirror source domains under `packages/<owner>/tests/`; central app tests mirror `src/app/**` under `tests/app/`; `tests/integration/` requires a genuinely cross-owner contract; E2E under `tests/e2e/` follows user workflows; native and Figma acceptance are explicit exceptions.
- Existing `tests/engine/**` domains migrate together with runner discovery: `tools/dev/unit-tests/src/shards.ts` lists each owner's canonical home and its current `tests/engine` directories, so a move is a `git mv` plus imports. `bun run check:test-homes` rejects any test added under `tests/engine` and any stale entry in `tools/checks/test-homes/engine-baseline.txt`; new tests go to the canonical home, and a moved file is removed from the baseline (`--write` regenerates it). Scene Graph has migrated to `packages/scene-graph/tests` and the editor domain to `packages/core/tests/editor`; put new Core tests there, mirroring `packages/core/src`.
+- Address a package's source by `#<pkg>/*` and its own helpers by `#<pkg>-tests/*` (`#core-tests/*`, `#fig-tests/*`); never drill with `../../`. Registering a new alias means `imports` in the package manifest and `PACKAGE_ALIASES`/`PACKAGE_ALIAS_OWNERS` in `tools/checks/architecture/src/steiger-rules/support.ts`.
- Owner-local helpers and fixtures stay local; only genuinely shared support goes under central `tests/helpers/<domain>/` and `tests/fixtures/`. MCP transport tests: `tests/engine/mcp/{server,stdio,transport}` with `tests/helpers/mcp`.
- Never commit temporary, diagnostic, or profile specs; keep them in ignored `scratch/`.
diff --git a/tools/checks/architecture/src/steiger-rules/support.ts b/tools/checks/architecture/src/steiger-rules/support.ts
index 61e9e3da6..412e7a4e5 100644
--- a/tools/checks/architecture/src/steiger-rules/support.ts
+++ b/tools/checks/architecture/src/steiger-rules/support.ts
@@ -43,6 +43,7 @@ export const ROOT_MARKDOWN_ALLOWLIST = new Set([
])
export const PACKAGE_ALIASES: Record<string, string> = {
'#core/': 'packages/core/src/',
+ '#core-tests/': 'packages/core/tests/',
'#fig/': 'packages/fig/src/',
'#fig-tests/': 'packages/fig/tests/',
'#vue/': 'packages/vue/src/',
@@ -54,6 +55,7 @@ export const PACKAGE_ALIAS_OWNERS: Record<string, string> = {
// A package's own tests mirror its source tree, so they address it by alias rather than
// drilling up through ../../src.
'#core/': 'packages/core/',
+ '#core-tests/': 'packages/core/tests/',
'#fig/': 'packages/fig/',
'#fig-tests/': 'packages/fig/tests/',
'#vue/': 'packages/vue/src/',
diff --git a/tools/checks/test-homes/engine-baseline.txt b/tools/checks/test-homes/engine-baseline.txt
index 657996b79..2ebe8d025 100644
--- a/tools/checks/test-homes/engine-baseline.txt
+++ b/tools/checks/test-homes/engine-baseline.txt
@@ -264,15 +264,6 @@ tests/engine/io/fig/instance/swap-roundtrip.test.ts
tests/engine/io/fig/instance/text-marker-roundtrip.test.ts
tests/engine/io/fig/page-manifest.test.ts
tests/engine/io/fig/plugin-data.test.ts
-tests/engine/io/fig/roundtrip/basic.test.ts
-tests/engine/io/fig/roundtrip/exhaustive.test.ts
-tests/engine/io/fig/roundtrip/export-settings.test.ts
-tests/engine/io/fig/roundtrip/glyph-blob.test.ts
-tests/engine/io/fig/roundtrip/group.test.ts
-tests/engine/io/fig/roundtrip/source-metadata.test.ts
-tests/engine/io/fig/roundtrip/variables.test.ts
-tests/engine/io/fig/roundtrip/verifier-contracts.test.ts
-tests/engine/io/fig/roundtrip/verifiers.test.ts
tests/engine/io/fig/thumbnail-page.test.ts
tests/engine/io/fig/thumbnail-range.test.ts
tests/engine/io/pptx/export/fidelity.test.ts
diff --git a/tools/dev/unit-tests/src/shards.ts b/tools/dev/unit-tests/src/shards.ts
index 7d3c7988d..dce62e6b3 100644
--- a/tools/dev/unit-tests/src/shards.ts
+++ b/tools/dev/unit-tests/src/shards.ts
@@ -74,9 +74,9 @@ export type UnitTestGroup = keyof typeof UNIT_TEST_GROUPS | 'all'
export const HEAVY_UNIT_TEST_PATTERNS = [
'tests/engine/clipboard/fixtures/',
'tests/engine/io/fig/heavy/',
- 'tests/engine/io/fig/roundtrip/exhaustive.test.ts',
- 'tests/engine/io/fig/roundtrip/glyph-blob.test.ts',
- 'tests/engine/io/fig/roundtrip/variables.test.ts',
+ 'packages/core/tests/io/formats/fig/roundtrip/exhaustive.test.ts',
+ 'packages/core/tests/io/formats/fig/roundtrip/glyph-blob.test.ts',
+ 'packages/core/tests/io/formats/fig/roundtrip/variables.test.ts',
'tests/engine/io/fig/export/text.test.ts',
'tests/engine/io/fig/export/worker.test.ts',
'tests/engine/io/fig/import/group-reclassify.test.ts',
diff --git a/tools/dev/unit-tests/tests/shards.test.ts b/tools/dev/unit-tests/tests/shards.test.ts
index c9958dd9d..91e37f53e 100644
--- a/tools/dev/unit-tests/tests/shards.test.ts
+++ b/tools/dev/unit-tests/tests/shards.test.ts
@@ -73,7 +73,9 @@ test('unit test groups cover all declared shards', () => {
test('heavy unit test matcher excludes fixture-heavy tests', () => {
expect(isHeavyUnitTest('tests/engine/io/fig/heavy/fixtures.test.ts')).toBe(true)
- expect(isHeavyUnitTest('tests/engine/io/fig/roundtrip/glyph-blob.test.ts')).toBe(true)
+ expect(isHeavyUnitTest('packages/core/tests/io/formats/fig/roundtrip/glyph-blob.test.ts')).toBe(
+ true
+ )
expect(isHeavyUnitTest('tests/engine/dom-css/runtime.test.ts')).toBe(false)
})