Library tsconfig.spec rootDir: "src" blocks cross-library-importing unit tests (38 libs) #789

Closed
opened 2026-07-22 05:35:33 +00:00 by spikerj · 2 comments
Owner

Problem

38 library tsconfig.spec.json files set "rootDir": "src", while 37 (the working majority) set "rootDir": "../..". A restrictive rootDir: "src" makes the Angular @angular/build:unit-test compiler reject any spec that (transitively) imports source from another library — e.g. @spikersoft/environment, @spikersoft/models — with TS6059: File ... is not under rootDir '<lib>/src'.

Impact

Any service in these libraries that imports cross-library source (most import @spikersoft/environment) cannot be unit-tested at all. The libraries look "tested" only because their scaffolded smoke spec imports nothing. This silently caps achievable coverage across ~half the workspace. Surfaced while adding real specs during the frontend coverage push (learn.spikersoft.com, 14.6% baseline).

Fix

Change "rootDir": "src""rootDir": "../.." in each affected tsconfig.spec.json (the established working convention — low-risk, mechanical). dev-tools-ipv4 is already fixed in the coverage PR that surfaced this (unblocks its ipv4.service spec). The remaining 37 need a dedicated sweep PR verifying each nx test <lib> stays green.

Affected libraries (rootDir: "src")

  • domain/blog/tsconfig.spec.json
  • domain/geo/tsconfig.spec.json
  • features/dev-tools-blockly/tsconfig.spec.json
  • features/dev-tools-common-commands-helper/tsconfig.spec.json
  • features/dev-tools-conversions-monaco/tsconfig.spec.json
  • features/dev-tools-decompiler/tsconfig.spec.json
  • features/dev-tools-diagram/tsconfig.spec.json
  • features/dev-tools-difference/tsconfig.spec.json
  • features/dev-tools-image-to-avif/tsconfig.spec.json
  • features/dev-tools-img-to-ico/tsconfig.spec.json
  • features/dev-tools-qr-code/tsconfig.spec.json
  • features/dev-tools-quick-type/tsconfig.spec.json
  • marks-site-models/tsconfig.spec.json
  • platform/avif-encoder/tsconfig.spec.json
  • platform/content-locale/tsconfig.spec.json
  • platform/intro-launching/tsconfig.spec.json
  • platform/intro-tour/tsconfig.spec.json
  • platform/lesson-catalog/tsconfig.spec.json
  • platform/loading/tsconfig.spec.json
  • platform/monaco-editor/tsconfig.spec.json
  • platform/pyodide-runtime/tsconfig.spec.json
  • platform/step-debugger-core/tsconfig.spec.json
  • platform/tool-file-menu/tsconfig.spec.json
  • platform/tool-storage/tsconfig.spec.json
  • shared/api-config/tsconfig.spec.json
  • shared/js-formatting-options/tsconfig.spec.json
  • shared/lesson-platform/tsconfig.spec.json
  • shared/save-load-dialogs/tsconfig.spec.json
  • shared/utils/crc32/tsconfig.spec.json
  • spikersoft-environment/tsconfig.spec.json
  • spikersoft-models/tsconfig.spec.json
  • spikersoft-theme/tsconfig.spec.json
  • ui/avatar-stack/tsconfig.spec.json
  • ui/confirm-dialog/tsconfig.spec.json
  • ui/destination-chips/tsconfig.spec.json
  • ui/mrz-crop/tsconfig.spec.json
  • ui/user-picker/tsconfig.spec.json
## Problem 38 library `tsconfig.spec.json` files set `"rootDir": "src"`, while 37 (the working majority) set `"rootDir": "../.."`. A restrictive `rootDir: "src"` makes the Angular `@angular/build:unit-test` compiler reject any spec that (transitively) imports source from **another** library — e.g. `@spikersoft/environment`, `@spikersoft/models` — with `TS6059: File ... is not under rootDir '<lib>/src'`. ## Impact Any service in these libraries that imports cross-library source (most import `@spikersoft/environment`) **cannot be unit-tested at all**. The libraries look "tested" only because their scaffolded smoke spec imports nothing. This silently caps achievable coverage across ~half the workspace. Surfaced while adding real specs during the frontend coverage push (learn.spikersoft.com, 14.6% baseline). ## Fix Change `"rootDir": "src"` → `"rootDir": "../.."` in each affected `tsconfig.spec.json` (the established working convention — low-risk, mechanical). `dev-tools-ipv4` is **already fixed** in the coverage PR that surfaced this (unblocks its ipv4.service spec). The remaining 37 need a dedicated sweep PR verifying each `nx test <lib>` stays green. ## Affected libraries (rootDir: "src") - `domain/blog/tsconfig.spec.json` - `domain/geo/tsconfig.spec.json` - `features/dev-tools-blockly/tsconfig.spec.json` - `features/dev-tools-common-commands-helper/tsconfig.spec.json` - `features/dev-tools-conversions-monaco/tsconfig.spec.json` - `features/dev-tools-decompiler/tsconfig.spec.json` - `features/dev-tools-diagram/tsconfig.spec.json` - `features/dev-tools-difference/tsconfig.spec.json` - `features/dev-tools-image-to-avif/tsconfig.spec.json` - `features/dev-tools-img-to-ico/tsconfig.spec.json` - `features/dev-tools-qr-code/tsconfig.spec.json` - `features/dev-tools-quick-type/tsconfig.spec.json` - `marks-site-models/tsconfig.spec.json` - `platform/avif-encoder/tsconfig.spec.json` - `platform/content-locale/tsconfig.spec.json` - `platform/intro-launching/tsconfig.spec.json` - `platform/intro-tour/tsconfig.spec.json` - `platform/lesson-catalog/tsconfig.spec.json` - `platform/loading/tsconfig.spec.json` - `platform/monaco-editor/tsconfig.spec.json` - `platform/pyodide-runtime/tsconfig.spec.json` - `platform/step-debugger-core/tsconfig.spec.json` - `platform/tool-file-menu/tsconfig.spec.json` - `platform/tool-storage/tsconfig.spec.json` - `shared/api-config/tsconfig.spec.json` - `shared/js-formatting-options/tsconfig.spec.json` - `shared/lesson-platform/tsconfig.spec.json` - `shared/save-load-dialogs/tsconfig.spec.json` - `shared/utils/crc32/tsconfig.spec.json` - `spikersoft-environment/tsconfig.spec.json` - `spikersoft-models/tsconfig.spec.json` - `spikersoft-theme/tsconfig.spec.json` - `ui/avatar-stack/tsconfig.spec.json` - `ui/confirm-dialog/tsconfig.spec.json` - `ui/destination-chips/tsconfig.spec.json` - `ui/mrz-crop/tsconfig.spec.json` - `ui/user-picker/tsconfig.spec.json`
Author
Owner

Board-sweep status (2026-07-22): partial — angular PR #526 (merged, 9ab22f04, on master) fixed the rootDir for exactly ONE library (features/dev-tools-ipv4, the one whose new ipv4 coverage it was blocking). 33 libraries still carry "rootDir": "src" in tsconfig.spec.json (verified by grep on current master), so any cross-library-importing spec in those remains blocked. Remaining work: the sweep across the other 33 (mechanical, same one-line change), plus updating the workspace-plugin library generator template so new libs don't regress — note #742 is already open against that generator for the ^undefined peers bug; both template fixes could land together. Leaving open.

Board-sweep status (2026-07-22): **partial** — angular PR #526 (merged, `9ab22f04`, on master) fixed the `rootDir` for exactly ONE library (`features/dev-tools-ipv4`, the one whose new ipv4 coverage it was blocking). **33 libraries still carry `"rootDir": "src"` in `tsconfig.spec.json`** (verified by grep on current master), so any cross-library-importing spec in those remains blocked. Remaining work: the sweep across the other 33 (mechanical, same one-line change), plus updating the workspace-plugin library generator template so new libs don't regress — note #742 is already open against that generator for the `^undefined` peers bug; both template fixes could land together. Leaving open.
Author
Owner

Resolved across spikersoft-angular PR #526 (dev-tools-ipv4, merged) and PR #528 (the remaining 37 libraries, merged to master). Each library’s tsconfig.spec.json rootDir now resolves to libraries/ using the depth-correct relative path (depth-1 .., depth-2 ../.., depth-3 ../../..). Verified nx run-many --target=test green across all affected projects. Closing.

Resolved across spikersoft-angular PR #526 (dev-tools-ipv4, merged) and PR #528 (the remaining 37 libraries, merged to `master`). Each library’s `tsconfig.spec.json` `rootDir` now resolves to `libraries/` using the depth-correct relative path (depth-1 `..`, depth-2 `../..`, depth-3 `../../..`). Verified `nx run-many --target=test` green across all affected projects. Closing.
Sign in to join this conversation.