diff --git a/.serena/memories/library/core.md b/.serena/memories/library/core.md index f739a817e9..6b074b9d75 100644 --- a/.serena/memories/library/core.md +++ b/.serena/memories/library/core.md @@ -3,5 +3,5 @@ - `library/` exposes a JS builder for in-memory files and `.penpot` exports. Start at `library/src/lib/builder.cljs` for the JS boundary, `app.common.files.builder` for state changes, and `library/src/lib/export.cljs` for the archive. Usage is in `library/README.md`; commands are in `package.json`. - The builder carries a current file, page and parent stack: add a file before a page and close nested boards or groups in order. Closing a group requires children and computes its geometry; a masked group uses its first child as the mask. `addBool` transforms an existing group rather than creating a separate object. See `app.common.files.builder` for the change records and compatibility feature defaults. - Export writes ZIP entries sequentially, realizing delayed JSON or blob data as each entry is written. Preserve that ordering and laziness when changing progress or adding entries; `on-progress` follows each completed entry. The manifest carries the optional builder `referer`. -- Tests import `#self`, which resolves to `target/library/penpot.js`. From `library/`, rebuild with `pnpm run build:bundle` before `pnpm run test`, or the tests can run against a stale bundle. `library/scripts/test` performs both but also installs dependencies. The default `./scripts/ci library` checks do not build the bundle; see `mem:scripts/ci`. +- Tests import `#self`, which resolves to `target/library/penpot.js`. From `library/`, rebuild with `pnpm run build:bundle` before a direct `pnpm run test`, or tests can run against a stale bundle. `./scripts/ci library` builds it before testing without the install step in `library/scripts/test`; see `mem:scripts/ci`. - Changes to file construction in `common/` can affect this external builder even when the app still works. For cross-cutting test design see `mem:testing`; for migrations see `mem:common/file-migrations`. diff --git a/.serena/memories/scripts/ci.md b/.serena/memories/scripts/ci.md index 4e65c097a4..9cd0f2704c 100644 --- a/.serena/memories/scripts/ci.md +++ b/.serena/memories/scripts/ci.md @@ -3,7 +3,7 @@ - From the repo root, use `./scripts/ci MODULE...` for the selected modules' lint, tests and format check. Build is opt-in. Run `./scripts/ci --help` for flags, modules and commands; `--dry-run` previews them without executing. For test design and output discipline, read `mem:testing`. - Pass every changed module. A `common` change can affect frontend, backend, exporter and library; select affected consumers too. Backend lint includes common sources but its format task does not check common, so include `common` explicitly. - The script appends `enable-backend-asserts` to `PENPOT_FLAGS`. Backend assertions are selected when code loads; running tests without the flag can compile them out. See `mem:backend/testing`. -- The default library test runs the existing bundle, unlike GitHub CI, which rebuilds first. Rebuild before relying on the result; see `mem:library/core`. `--fix library` currently calls the nonexistent `fmt:clj` script: from `library/` use `pnpm run fmt` instead until the orchestrator is corrected. +- The library test task builds its bundle before running tests, like GitHub CI. Direct `pnpm run test` does not rebuild it; see `mem:library/core`. `--fix library` uses the package's `fmt` script. - `--build` uses module build commands but does not run by default or package deployable bundles. It avoids some cache-clearing wrappers; consult the command in `scripts/ci` rather than assuming every module's build has identical behavior. Native WASM build scripts serialize through a lock, but manual Cargo commands do not; see `mem:render-wasm/core`. - `mcp` and `media-processor` have no lint task and are reported as skipped. The exporter test task supplies a fallback test secret when absent. `scripts/test_ci.py` tests orchestrator wiring and dry runs, not the module builds themselves. - Full task logs are in `.ci-logs/-.log`; inspect them after failure and do not pipe test output directly to filters. `--dry-run` executes no tasks. For long full-module runs allow ample time. The `local-ci` skill is the verification entry point. diff --git a/scripts/ci b/scripts/ci index 280b081a8e..4ed5c79e1e 100755 --- a/scripts/ci +++ b/scripts/ci @@ -47,7 +47,7 @@ declare -A TEST_CMD=( [exporter]="PENPOT_SECRET_KEY=${PENPOT_SECRET_KEY:-test-secret-key} pnpm run test:quiet" [mcp]="pnpm run test" [plugins]="pnpm run test" - [library]="pnpm run test" + [library]="pnpm run build:bundle && pnpm run test" [media-processor]="pnpm run test" ) @@ -71,7 +71,7 @@ declare -A FMT_FIX_CMD=( [exporter]="pnpm run fmt:clj" [mcp]="pnpm run fmt" [plugins]="pnpm run format" - [library]="pnpm run fmt:clj" + [library]="pnpm run fmt" [media-processor]="pnpm run fmt" ) diff --git a/scripts/test_ci.py b/scripts/test_ci.py index 6ad70101f5..99acab725b 100644 --- a/scripts/test_ci.py +++ b/scripts/test_ci.py @@ -73,7 +73,7 @@ class BuildTaskTests(unittest.TestCase): code, out = run_ci("--dry-run", "--all") self.assertEqual(code, 0, out) - self.assertNotIn("build:", out) + self.assertNotIn("build: would run", out) for task in ("lint", "test", "fmt"): self.assertIn(f"{task}: would run", out) @@ -145,6 +145,18 @@ class ModuleCommandTests(unittest.TestCase): self.assertEqual(code, 0, out) self.assertIn("pnpm run check-fmt", out) + def test_library_format_fix_uses_its_declared_script(self): + code, out = run_ci("--fmt", "--fix", "--dry-run", "library") + + self.assertEqual(code, 0, out) + self.assertIn("fmt: would run 'pnpm run fmt' in library/", out) + + def test_library_tests_rebuild_the_bundle_first(self): + code, out = run_ci("--test", "--dry-run", "library") + + self.assertEqual(code, 0, out) + self.assertIn("pnpm run build:bundle && pnpm run test", out) + class HelpTests(unittest.TestCase): def help_options(self, out):