test: move prefixed splits into domain folders

- Move newly split tests under explicit domain subfolders
- Update nested helper imports after the moves
- Add a lint guard against repeating existing sibling domains as filename prefixes
This commit is contained in:
Danila Poyarkov 2026-05-06 14:27:21 +03:00
parent b9da0dcb76
commit aad26b535e
57 changed files with 49 additions and 33 deletions

View file

@ -1167,6 +1167,20 @@ const noTopLevelPrefixedTestFiles = createProgramFilenameRule({
}
})
const noSiblingDomainPrefixedTestFiles = createProgramFilenameRule({
description: 'Disallow test files that repeat an existing sibling domain folder as a filename prefix',
check(file) {
const match = file.match(/^(.*\/tests\/(?:engine|e2e)\/.+\/)([^/]+)-[^/]+\.(?:test|spec)\.ts$/)
if (!match) return false
const [, dir, prefix] = match
if (!existsSync(`${dir}${prefix}`)) return false
const filename = file.slice(dir.length)
return `Move '${filename}' under the existing '${prefix}/' folder instead of repeating the domain as a filename prefix.`
}
})
const noFlatKiwiModules = createProgramFilenameRule({
description: 'Disallow flat top-level Kiwi modules — group code under Kiwi subdomains',
check(file) {
@ -1228,7 +1242,8 @@ const plugin = {
'no-useless-pass-through-wrappers': noUselessPassThroughWrappers,
'no-function-alias-imports': noFunctionAliasImports,
'no-flat-kiwi-modules': noFlatKiwiModules,
'no-top-level-prefixed-test-files': noTopLevelPrefixedTestFiles
'no-top-level-prefixed-test-files': noTopLevelPrefixedTestFiles,
'no-sibling-domain-prefixed-test-files': noSiblingDomainPrefixedTestFiles
}
}

View file

@ -154,7 +154,8 @@
"open-pencil/non-component-source-directories-kebab-case": "error",
"open-pencil/no-component-root-sibling-folder": "error",
"open-pencil/no-flat-kiwi-modules": "error",
"open-pencil/no-top-level-prefixed-test-files": "error"
"open-pencil/no-top-level-prefixed-test-files": "error",
"open-pencil/no-sibling-domain-prefixed-test-files": "error"
},
"overrides": [
{

View file

@ -4,7 +4,7 @@ import { importNodeChanges } from '@open-pencil/core'
import { expectDefined } from '#tests/helpers/assert'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: arc data', () => {
test('partial ellipse', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: auto-layout alignment', () => {
test('maps SPACE_EVENLY kiwi primary alignment to Figma space-between', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: blend mode', () => {
test('node blend mode', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: clipsContent with resizeToFit', () => {
test('regular FRAME with frameMaskDisabled=false clips content', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: component set detection', () => {
test('FRAME with VARIANT componentPropDefs becomes COMPONENT_SET', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: image fills', () => {
test('image fill with hash', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: independent stroke weights', () => {
test('border weights imported', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: multiple fills', () => {
test('solid + gradient stacked', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { importNodeChanges } from '@open-pencil/core'
import { canvas, doc, node } from './helpers'
import { canvas, doc, node } from '../helpers'
describe('fig-import: node types', () => {
test('ROUNDED_RECTANGLE imported as its own type', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('absolute position', () => {
test('absoluteBoundingBox accounts for nesting', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('auto-layout', () => {
test('layoutMode', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('auto-layout extras', () => {
test('primaryAxisSizingMode maps FIXED/AUTO', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('corner radius', () => {
test('uniform corner radius', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('createComponentFromNode', () => {
test('converts frame to component', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { expectDefined } from '#tests/helpers/assert'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('document & pages', () => {
test('root has pages as children', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('findAllWithCriteria', () => {
test('filters by type', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { type Fill } from '@open-pencil/core'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('frozen arrays', () => {
test('fills returns frozen clone', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('internals not exposed', () => {
test('node has no _id, _graph, _api properties', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { getNodeOrThrow } from '#tests/helpers/assert'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('layout sizing', () => {
test('child in horizontal parent: h=primary, v=counter', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('min/max dimensions', () => {
test('defaults to null', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { expectDefined } from '#tests/helpers/assert'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('node creation', () => {
test('createFrame', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('property access', () => {
test('name get/set', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('stroke details', () => {
test('strokeWeight and strokeAlign', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('text', () => {
test('characters maps to text content', () => {

View file

@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('text extras', () => {
test('textTruncation', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { expectDefined } from '#tests/helpers/assert'
import { createAPI } from './helpers'
import { createAPI } from '../helpers'
describe('tree operations', () => {
test('appendChild reparents', () => {

View file

@ -4,7 +4,7 @@ import { SceneGraph, sceneNodeToKiwi } from '@open-pencil/core'
import { expectDefined, getNodeOrThrow } from '#tests/helpers/assert'
import { ROOT_GUID, pageId } from './helpers'
import { ROOT_GUID, pageId } from '../helpers'
describe('Fix 1: auto-layout child transforms', () => {
test('auto-layout child gets zero transform regardless of its x/y', () => {

View file

@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
import { pageId, toKiwi } from './helpers'
import { pageId, toKiwi } from '../helpers'
describe('Fix 3: bordersTakeSpace serialization', () => {
test('auto-layout frame with strokesIncludedInLayout=true gets bordersTakeSpace=true', () => {

View file

@ -4,7 +4,7 @@ import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
import { expectDefined } from '#tests/helpers/assert'
import { pageId, toKiwi } from './helpers'
import { pageId, toKiwi } from '../helpers'
describe('Fix 5: font family normalization in derivedTextData', () => {
test('optical size suffix stripped in roundtrip', async () => {

View file

@ -4,7 +4,7 @@ import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
import { expectDefined } from '#tests/helpers/assert'
import { pageId, toKiwi } from './helpers'
import { pageId, toKiwi } from '../helpers'
describe('Fix 2: frameMaskDisabled is inverse of clipsContent', () => {
test('FRAME without clipsContent gets frameMaskDisabled=true', () => {

View file

@ -4,7 +4,7 @@ import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
import { expectDefined } from '#tests/helpers/assert'
import { pageId, toKiwi } from './helpers'
import { pageId, toKiwi } from '../helpers'
describe('Fix 4: text lineHeight serialization', () => {
test('text node with explicit lineHeight uses that value', () => {