# reutenkoivan/codeceptjs-plugins architecture

> Architecture diagram of the GitHub repository reutenkoivan/codeceptjs-plugins, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reutenkoivan/codeceptjs-plugins
- Repository: https://github.com/reutenkoivan/codeceptjs-plugins

## Overview

##### Main Components

a. Core Framework Integration
- CodeceptJS as the parent framework
- Plugin registration system through `basePlugin.ts`
- Plugin lifecycle hooks

b. Plugin Architecture
- Logger system (`logger` directory)
- Plugin registration mechanism (`registerPlugin` directory)
- Type definitions (`codeceptjsTypes.ts`)

c. Specialized Plugins
- "HTML Snapshot on Fail" plugin showing:
- Failure detection system
- Screenshot capture mechanism
- File storage system

##### Component Relationships

- How the base plugin provides core functionality to other plugins
- Dependency flow from CodeceptJS → Base Plugin → Specialized Plugins
- Interaction between plugins and the test execution environment

##### Technical Implementation Details

Key technical aspects:
- TypeScript as the primary language (evident from tsconfig files)
- Build and packaging system (shown in `scripts` directory)
- Documentation generation system (shown in `docs` directory)

**┌─ Test Framework Layer ─┐**
- (CodeceptJS)      │

- Base Plugin Layer ───┤
- Logger            │
- Plugin Registry   │
- Type Definitions  │

- Specialized Plugins ─┤
- HTML Snapshot     │
- Future Plugins    │
- ┘

##### Important Elements to Highlight

a. Plugin Communication Flow:
- How plugins interact with the base plugin
- Error handling paths
- Logging mechanisms

b. Configuration System:
- How plugin settings are managed
- Configuration inheritance

c. Build and Distribution:
- Publishing workflow
- Documentation generation process

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Framework["Test Framework Layer"]
        CodeceptJS["CodeceptJS Testing Framework"]:::framework
    end

    subgraph BasePlugin["Base Plugin Layer"]
        Base["Base Plugin System"]:::base
        Logger["Logger System"]:::base
        Registry["Plugin Registration"]:::base
        Types["Type Definitions"]:::base
        PluginTypes["Plugin Type Definitions"]:::base
    end

    subgraph Plugins["Specialized Plugins Layer"]
        HTMLSnapshot["HTML Snapshot Plugin"]:::plugin
        subgraph SnapshotComponents["Snapshot Components"]
            FileStorage["File Storage System"]:::component
            Screenshot["Screenshot Capture"]:::component
        end
    end

    subgraph Build["Build and Distribution"]
        BuildSystem["Build System"]:::build
        PackagePublish["Package Publishing"]:::build
        VersionMgmt["Version Management"]:::build
    end

    subgraph Docs["Documentation"]
        DocSystem["Documentation System"]:::docs
        DocConfig["Documentation Config"]:::docs
        DocComponents["Documentation Components"]:::docs
    end

    subgraph CICD["CI/CD"]
        DevPipeline["Development Pipeline"]:::cicd
        ReleasePipeline["Release Pipeline"]:::cicd
    end

    %% Relationships
    CodeceptJS --> Base
    Base --> Logger
    Base --> Registry
    Base --> Types
    Base --> PluginTypes
    Base --> HTMLSnapshot
    HTMLSnapshot --> FileStorage
    HTMLSnapshot --> Screenshot
    BuildSystem --> PackagePublish
    BuildSystem --> VersionMgmt
    DocSystem --> DocConfig
    DocSystem --> DocComponents
    DevPipeline --> BuildSystem
    ReleasePipeline --> PackagePublish

    %% Click Events
    click Base "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/packages/base/src/basePlugin.ts"
    click Logger "https://github.com/reutenkoivan/codeceptjs-plugins/tree/main/packages/base/src/logger/"
    click Registry "https://github.com/reutenkoivan/codeceptjs-plugins/tree/main/packages/base/src/registerPlugin/"
    click Types "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/packages/base/src/codeceptjsTypes.ts"
    click PluginTypes "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/packages/base/src/types.ts"
    click HTMLSnapshot "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/packages/html-snapshot-on-fail/src/htmlSnapshotOnFail.ts"
    click FileStorage "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/packages/html-snapshot-on-fail/src/utils/writeFile.ts"
    click Screenshot "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/packages/html-snapshot-on-fail/src/utils/getDriver.ts"
    click BuildSystem "https://github.com/reutenkoivan/codeceptjs-plugins/tree/main/scripts/"
    click PackagePublish "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/scripts/publish.js"
    click VersionMgmt "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/scripts/utils/increasePackageVersion.js"
    click DocSystem "https://github.com/reutenkoivan/codeceptjs-plugins/tree/main/docs/"
    click DocConfig "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/docs/docusaurus-tde.config.js"
    click DocComponents "https://github.com/reutenkoivan/codeceptjs-plugins/tree/main/docs/react-pages/"
    click DevPipeline "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/.github/workflows/development.yml"
    click ReleasePipeline "https://github.com/reutenkoivan/codeceptjs-plugins/blob/main/.github/workflows/release.yml"

    %% Styling
    classDef framework fill:#3498db,stroke:#2980b9,color:white
    classDef base fill:#2ecc71,stroke:#27ae60,color:white
    classDef plugin fill:#e67e22,stroke:#d35400,color:white
    classDef component fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef build fill:#9b59b6,stroke:#8e44ad,color:white
    classDef docs fill:#1abc9c,stroke:#16a085,color:white
    classDef cicd fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        L1["Framework Component"]:::framework
        L2["Base Plugin Component"]:::base
        L3["Specialized Plugin"]:::plugin
        L4["Utility Component"]:::component
        L5["Build Component"]:::build
        L6["Documentation"]:::docs
        L7["CI/CD Pipeline"]:::cicd
    end
```
