Skip to content

Build your personal knowledge base with Trilium Notes

chore(skills): correct test-file convention to co-located *.spec.ts default

Elian Dorandd67a6e39f9f
diff --git a/.claude/skills/ckeditor5-testing/SKILL.md b/.claude/skills/ckeditor5-testing/SKILL.md
index 0f6c98ae99..f4ccaade0d 100644
--- a/.claude/skills/ckeditor5-testing/SKILL.md
+++ b/.claude/skills/ckeditor5-testing/SKILL.md
@@ -15,9 +15,11 @@ description: >-
# CKEditor 5 testing (Trilium)
-Testing CKEditor 5 plugins in the **Trilium (TriliumNext Notes) monorepo**. Each plugin lives in
-`packages/ckeditor5-<name>/` and owns its tests in `tests/`. Browser-mode packages gate `src/**`
-at **100% coverage**, so every code change should ship with a test.
+Testing CKEditor 5 plugins in the **Trilium (TriliumNext Notes) monorepo**. **Tests are co-located
+`*.spec.ts` next to the source** for the aggregator (`packages/ckeditor5`), in-aggregator plugins,
+and any new code — matching the repo-wide convention. The existing standalone packages
+(`packages/ckeditor5-<name>/`) keep their legacy `tests/` directories. Browser-mode packages gate
+`src/**` at **100% coverage**, so every code change should ship with a test.
## Scope & sources
@@ -48,8 +50,12 @@ Trilium testing (Preact components, jQuery widgets, server routes), use `writing
in Trilium — those live only in the upstream ckeditor5 monorepo's `tests/_utils`.
- **Helpers from `'ckeditor5'`:** `_setModelData`, `_getModelData`, `_getViewData` are imported
from the `ckeditor5` package.
-- **Test files:** `tests/**/*.[jt]s` (no `.spec`/`.test` suffix). `globals: true`. Coverage
- provider `v8`, `include: src/**`.
+- **Test-file location:** **co-located `*.spec.ts`** next to the source is the default — the
+ aggregator, in-aggregator plugins (`src/plugins/foo.spec.ts`), and new code, with vitest
+ `include: ['src/**/*.spec.ts']` (as on `feature/collapsible_experiment`). The existing standalone
+ packages instead use a `tests/` dir (`include: ['tests/**/*.[jt]s']`, no `.spec` suffix) — leave
+ them; new standalone packages should use co-located `.spec.ts` too. `globals: true`. Coverage
+ provider `v8`, `include: src/**` (test files themselves excluded from coverage).
- **Imports** from `'ckeditor5'`; in-package source imports use a file extension.
- **License key:** tests pass `licenseKey: 'GPL'` in the editor config.
- Some packages (`admonition`, `footnotes`, `keyboard-marker`) have a vitest config but **no
diff --git a/.claude/skills/ckeditor5-testing/references/running-and-config.md b/.claude/skills/ckeditor5-testing/references/running-and-config.md
index 4bffd6e3c0..1bb7e6ccbd 100644
--- a/.claude/skills/ckeditor5-testing/references/running-and-config.md
+++ b/.claude/skills/ckeditor5-testing/references/running-and-config.md
@@ -85,9 +85,17 @@ export default defineConfig( {
} );
```
-Common to both: `globals: true`, test glob `tests/**/*.[jt]s` (no `.spec`/`.test` suffix), the
-`vite-plugin-svgo` plugin so `import icon from './x.svg'` resolves, and coverage via `v8` over
-`src/**`.
+Common to both: `globals: true`, the `vite-plugin-svgo` plugin so `import icon from './x.svg'`
+resolves, and coverage via `v8` over `src/**` (test files themselves excluded).
+
+**Test-file location depends on where the code lives.** The two configs above are the existing
+**standalone packages**, which use a `tests/` directory (`include: ['tests/**/*.[jt]s']`, no
+`.spec` suffix) — keep them that way. The **aggregator** (`packages/ckeditor5`), **in-aggregator
+plugins** (`src/plugins/`), and **any new code** instead use **co-located `*.spec.ts`** next to the
+source — vitest `include: ['src/**/*.spec.ts']` (e.g. `src/plugins/collapsible_list_items.spec.ts`).
+This is the repo-wide convention (see the `writing-unit-tests` skill) and what
+`feature/collapsible_experiment` uses. New standalone packages should also adopt co-located
+`.spec.ts`.
## Debugging
diff --git a/.claude/skills/ckeditor5-testing/references/test-conventions.md b/.claude/skills/ckeditor5-testing/references/test-conventions.md
index 3ebd1ab592..c64126a38a 100644
--- a/.claude/skills/ckeditor5-testing/references/test-conventions.md
+++ b/.claude/skills/ckeditor5-testing/references/test-conventions.md
@@ -65,7 +65,9 @@ directly: `expect( _getModelData( model ) ).toEqual( '<paragraph>…</paragraph>
- Import `_setModelData`, `_getModelData`, `_getViewData` (and editor classes, `keyCodes`, etc.)
from `'ckeditor5'`. In-package source imports use a file extension (`../src/foo.js`).
- Spies/mocks via `vi` (`vi.spyOn` / `vi.fn` / `vi.useFakeTimers`).
-- Test files: `tests/**/*.[jt]s`, no `.spec`/`.test` suffix.
+- Test-file location: **co-located `*.spec.ts`** by default (aggregator, in-aggregator plugins,
+ new code; `include: ['src/**/*.spec.ts']`). The existing standalone packages keep a `tests/` dir
+ (`tests/**/*.[jt]s`, no `.spec` suffix); new packages should use co-located `.spec.ts`.
## Running math & mermaid