Sync ng-mocks tests into the sandbox
Use this workflow only on the tests branch. It replaces src/tests and
src/examples with the sources from the upstream tag matching the exact
ng-mocks version in package.json.
Safety rules
- Start from a clean
testscheckout and merge the currentmasterfirst. - Run npm, npx, Node, formatting, and tests through
core, never on the host. - Keep upstream behavior. Replay only sandbox compatibility edits that are still necessary for the Angular version pinned here.
- During the one-file cleanup loop, use only the diff printed by the Step 3 script. If its classification is unclear, stop and report it.
- User instructions override this skill.
Workflow
Confirm the current branch is
testsand the worktree is clean.Merge
masterintotests.Import the matching tag:
docker compose run --rm core sh ./.agents/ng-mocks-sync-tests/scripts/step1_sync_upstream_sources.shRegenerate the import list:
docker compose run --rm core sh ./.agents/ng-mocks-sync-tests/scripts/step2_regenerate_e2e.shRepeatedly request the next changed file:
docker compose run --rm core sh ./.agents/ng-mocks-sync-tests/scripts/step3_list_changed_synced_files.shWhen the script prints a file and its diff:
- classify it as an upstream change, confirmed sandbox cleanup, or unclear;
- leave upstream changes untouched;
- for confirmed cleanup, patch only that file and complete only the same cleanup category in that file;
- format it with
docker compose run --rm core npx prettier --write <file>; - run Step 3 again;
- if the same file returns, stage only that file and continue, unless the user requested review-stop mode.
When no file is returned, run:
sh ./compose.sh docker compose run --rm core npm run prettier:check docker compose run --rm core npm run ts:check sh ./test.shFix only failures caused by the sync or the currently supported Angular version, then repeat the relevant checks until they pass.
test.sh forwards arguments to ng test; it has no special coverage
argument. CircleCI's WITH_COVERAGE=1 environment variable selects the JUnit
reporter in this repository; despite the historical name, it does not enable
Karma code coverage.
Confirmed compatibility cleanup catalog
Apply a cleanup only when the Step 3 diff proves it is sandbox-only noise.
- Replace computed Angular metadata shims such as
['standalone' as never]: falsewithstandalone: false; remove obsoletestandalone: trueandentryComponentsshims without dropping metadata braces that still contain real fields. - Remove obsolete
as nevercasts from decorator metadata and query options. - Use direct Jasmine runtime helpers. Keep a useful Jest alternative only as
an adjacent
// or ...comment. - Replace
new (InjectionToken as any)(...)withnew InjectionToken(...)and remove an adjacent Angular 5 comment when it only explains the shim. - Restore direct RxJS exports such as
EMPTY,NEVER, andfromEventinstead of local compatibility fallbacks. - Use
new RegExp(...), not regex literals, for normalized error matchers. - Convert synchronous
try/catchblocks used only to inspecterror.messagetotoThrowError(...). Preserve the original semantics: partial checks use regex matching and exact checks stay exact. - Keep an async
try/catchwhen conversion would make the spec less readable or would move setup and the throwing call out of the same block. - Prefer
TestBed.inject(...)when an old-version guard chooses between it andTestBed.get(...).
Do not use this catalog for unrelated refactors, comment rewrites, or genuine upstream behavior changes.