Loading workspace insights... Statistics interval
7 days30 daysLatest CI Pipeline Executions
4f67dcc4 chore(repo): mock workspace-context to skip real workspace scans in unit tests
`--detectOpenHandles` (set globally in nx.json for the `test` target) makes
jest run in-band, so the parent jest process is the test runner. The custom
resolver's `argv`-based gate that points `NX_WORKSPACE_ROOT_PATH` at
`tmp/unit` only matches `jest-worker`, never the in-band parent — which left
the imported `workspaceRoot` constant frozen to the real CI workspace.
The release suites (`release-graph`, `release-group-processor`,
`multiple-release-groups`, `release-version`) call
`createProjectFileMapUsingProjectGraph(...)` from `test-utils.ts`, which
reads the global `workspaceRoot` and then constructs a native
`WorkspaceContext` at it. The rust walker recursively scans every plugin's
sources, generators, migrations, and templates — surfacing as ~4400
cross-project sandbox violations on `nx:test`.
Add a `workspace-context` mock that short-circuits to safe empty defaults
when handed the real workspace root, and a final-line `WorkspaceContext`
constructor guard that throws if anything bypasses the higher-level mock.
Tests using `TempFs` continue to pass through unchanged. The mocks use
plain functions (not `jest.fn`) so suites calling `jest.resetAllMocks()`
can't wipe them.
Drop `virtual: true` from `project-graph.spec.ts`'s workspace-context mock
so it correctly overrides the global setupFiles mock (the virtual flag
keys by literal specifier, leaving the resolved-path mock unshadowed).