# help-me-mom/ng-mocks architecture

> Architecture diagram of the GitHub repository help-me-mom/ng-mocks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/help-me-mom/ng-mocks
- Repository: https://github.com/help-me-mom/ng-mocks

## Overview

##### Project type and purpose
- This is a **mono-repo Angular library** named “ng-mocks” for **mocking Angular Components, Directives, Pipes, Modules, Services, and Tokens** in tests. It ships as an NPM package, provides a Docusaurus-based documentation site, and includes a comprehensive test suite (unit, e2e, examples).

##### File structure
- Top-level configuration: CI (​.circleci/​config.yml), lint/prettier/eslint, Husky hooks, Docker ignore, build scripts (webpack.config.js).
- `libs/ng-mocks/`: the core library source, organized into sub-directories by feature (common, mock-builder, mock-component, etc.).
- `docs/`: Docusaurus site source (config, sidebars, markdown articles, static assets).
- `examples/`: small Angular test projects illustrating API usage.
- `e2e/`, `tests-e2e/`: end-to-end test projects against various Angular versions and test runners (Jest, Karma).
- `tests/`, `tests-failures/`, `tests-performance/`: unit and integration tests covering edge cases, performance, regressions.
- Root scripts: `compose.yml`, `compose.sh` for Docker development; `test.sh`, `test.ts` for local runs; `package.json`, `tsconfig.json` for build and publishing.

##### README for additional insights
- The library integrates with Angular TestBed, supports Jasmine and Jest, Ivy and View-Engine, Standalone Components.
- It references API entry points: `MockBuilder`, `MockRender`, `ngMocks.*` methods.
- It highlights global default-mock configuration and auto-spying features.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Systems
    Developer["Developer Workstation"]:::external
    GitHub["GitHub Repo"]:::external
    NPM["NPM Registry"]:::storage
    Consumers["Consumers (Angular Apps)"]:::external

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        CI["CircleCI & GitHub Actions"]:::ci
    end

    %% Build System
    subgraph "Build System" 
        TSCompile["TypeScript Compile"]:::build
        Webpack["Webpack Bundle"]:::build
    end

    %% Library Modules
    subgraph "Library Core (libs/ng-mocks)" 
        Common["common"]:::module
        Builder["mock-builder"]:::module
        Component["mock-component"]:::module
        Declaration["mock-declaration"]:::module
        Directive["mock-directive"]:::module
        Helper["mock-helper"]:::module
        Instance["mock-instance"]:::module
        ModuleMock["mock-module"]:::module
        Pipe["mock-pipe"]:::module
        Provider["mock-provider"]:::module
        Render["mock-render"]:::module
        Service["mock-service"]:::module
        Core["mock"]:::module
    end

    %% Testing Infrastructure
    subgraph "Test Runners" 
        Jest["Jest"]:::test
        Karma["Karma"]:::test
    end

    subgraph "E2E Matrix" 
        E2EA5["Angular 5+"]:::test
        E2EA20["Angular 20"]:::test
        TestsE2E["tests-e2e"]:::test
    end

    %% Documentation Site
    subgraph "Documentation (Docusaurus)" 
        DocsConfig["docusaurus.config.js"]:::doc
        DocsContent["Articles & Static"]:::doc
    end

    %% Examples
    Examples["Examples Projects"]:::external

    %% Root Scripts
    subgraph "Dev & Docker Scripts"
        ComposeYML["compose.yml"]:::build
        ComposeSH["compose.sh"]:::build
        TestSH["test.sh"]:::build
        TestTS["test.ts"]:::build
    end

    %% NPM Publishing
    subgraph "Publishing"
        NpmPublish["package.json & Metadata"]:::build
    end

    %% Flows
    Developer -->|commits & pushes| GitHub
    GitHub -->|triggers| CI
    CI -->|runs| TSCompile
    CI -->|runs| Webpack
    CI -->|builds| LibraryCore[Library Core] 
    CI -->|executes| Jest
    CI -->|executes| Karma
    CI -->|executes| E2EA5
    CI -->|executes| E2EA20
    CI -->|executes| TestsE2E
    CI -->|builds docs| DocsConfig
    DocsConfig --> DocsContent
    CI -->|publishes package| NPM
    CI -->|deploys docs| GitHub
    NPM -->|installed by| Consumers
    Examples -->|use library| LibraryCore
    TestsE2E -->|use library| LibraryCore

    %% Click Events - CI/CD Pipeline
    click CI "https://github.com/help-me-mom/ng-mocks/blob/master/.circleci/config.yml"
    click CI "https://github.com/help-me-mom/ng-mocks/blob/master/.github/workflows/codeql.yml"

    %% Click Events - Build System
    click TSCompile "https://github.com/help-me-mom/ng-mocks/blob/master/tsconfig.json"
    click Webpack "https://github.com/help-me-mom/ng-mocks/blob/master/webpack.config.js"
    click TSCompile "https://github.com/help-me-mom/ng-mocks/blob/master/libs/ng-mocks/tsconfig.build.cjs.json"
    click TSCompile "https://github.com/help-me-mom/ng-mocks/blob/master/libs/ng-mocks/tsconfig.build.mjs.json"

    %% Click Events - Library Modules
    click Common "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/common"
    click Builder "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-builder"
    click Component "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-component"
    click Declaration "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-declaration"
    click Directive "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-directive"
    click Helper "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-helper"
    click Instance "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-instance"
    click ModuleMock "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-module"
    click Pipe "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-pipe"
    click Provider "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-provider"
    click Render "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-render"
    click Service "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock-service"
    click Core "https://github.com/help-me-mom/ng-mocks/tree/master/libs/ng-mocks/src/lib/mock"

    %% Click Events - Test Runners
    click Jest "https://github.com/help-me-mom/ng-mocks/tree/master/e2e/jest/"
    click TestsE2E "https://github.com/help-me-mom/ng-mocks/tree/master/tests-e2e/"
    click Karma "https://github.com/help-me-mom/ng-mocks/blob/master/karma.conf.ts"
    click Karma "https://github.com/help-me-mom/ng-mocks/tree/master/e2e/jasmine/"
    click Karma "https://github.com/help-me-mom/ng-mocks/blob/master/tests-e2e/karma.conf.js"

    %% Click Events - Documentation Site
    click DocsConfig "https://github.com/help-me-mom/ng-mocks/blob/master/docs/docusaurus.config.js"
    click DocsConfig "https://github.com/help-me-mom/ng-mocks/blob/master/docs/package.json"
    click DocsConfig "https://github.com/help-me-mom/ng-mocks/blob/master/docs/sidebars.js"
    click DocsContent "https://github.com/help-me-mom/ng-mocks/tree/master/docs/articles/"
    click DocsContent "https://github.com/help-me-mom/ng-mocks/tree/master/docs/static/"

    %% Click Events - Examples & E2E
    click Examples "https://github.com/help-me-mom/ng-mocks/tree/master/examples/"
    click E2EA5 "https://github.com/help-me-mom/ng-mocks/tree/master/e2e/a5es2015"
    click E2EA20 "https://github.com/help-me-mom/ng-mocks/tree/master/e2e/a20/"
    click TestsE2E "https://github.com/help-me-mom/ng-mocks/tree/master/tests-e2e/"

    %% Click Events - Root Scripts & Config
    click ComposeYML "https://github.com/help-me-mom/ng-mocks/blob/master/compose.yml"
    click ComposeSH "https://github.com/help-me-mom/ng-mocks/blob/master/compose.sh"
    click TestSH "https://github.com/help-me-mom/ng-mocks/blob/master/test.sh"
    click TestTS "https://github.com/help-me-mom/ng-mocks/blob/master/test.ts"

    %% Click Events - NPM Publishing
    click NpmPublish "https://github.com/help-me-mom/ng-mocks/blob/master/package.json"
    click NpmPublish "https://github.com/help-me-mom/ng-mocks/blob/master/package-lock.json"
    click NpmPublish "https://github.com/help-me-mom/ng-mocks/blob/master/.releaserc.yml"
    click NpmPublish "https://github.com/help-me-mom/ng-mocks/blob/master/CHANGELOG.md"
    click NpmPublish "https://github.com/help-me-mom/ng-mocks/blob/master/README.md"

    %% Styles
    classDef external fill:#e0e0e0,stroke:#888,stroke-width:1px
    classDef ci fill:#b3e5fc,stroke:#0288d1,stroke-width:1px
    classDef build fill:#c8e6c9,stroke:#2e7d32,stroke-width:1px
    classDef module fill:#bbdefb,stroke:#1e88e5,stroke-width:1px
    classDef test fill:#ffe0b2,stroke:#f57c00,stroke-width:1px
    classDef doc fill:#e1bee7,stroke:#8e24aa,stroke-width:1px
    classDef storage fill:#ffffff,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5
```
