# jasmine/jasmine-npm architecture

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

- Interactive diagram: https://gitdiagram.com/jasmine/jasmine-npm
- Repository: https://github.com/jasmine/jasmine-npm

## Overview

Jasmine is a Node.js CLI and programmatic runner for executing Jasmine specs. The main flow is a user invoking the CLI, which selects a runner, loads project configuration and test modules, then reports results. The package also supports spec filtering, global setup and teardown, ES module and CommonJS loading, and parallel execution with worker processes. The README documents initialization and example seeding; their implementations are in the CLI module. Some parallel-worker wiring is only partially shown, so that relationship is marked unverified.

Main entry points: [`lib/jasmine.js`](https://github.com/jasmine/jasmine-npm/blob/main/lib/jasmine.js) (Jasmine runner), [`lib/runner_base.js`](https://github.com/jasmine/jasmine-npm/blob/main/lib/runner_base.js) (Runner base), [`lib/command.js`](https://github.com/jasmine/jasmine-npm/blob/main/lib/command.js) (CLI commands), [`lib/parallel_runner.js`](https://github.com/jasmine/jasmine-npm/blob/main/lib/parallel_runner.js) (Parallel runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and API"]
  node_cli["CLI commands<br/>[command.js]"]
  node_cli_entry["CLI entry point<br/>[jasmine.js]"]
  node_runner_api["Jasmine runner<br/>[jasmine.js]"]
end

subgraph group_execution["Test execution"]
  node_runner_base["Runner base<br/>[runner_base.js]"]
  node_config_setup["Global setup and teardown"]
  node_path_filter["Suite path filter"]
  node_regex_filter["Name regex filter"]
  node_exit_handler["Exit handling<br/>[exit_handler.js]"]
end

subgraph group_loading["Configuration and loading"]
  node_module_loader["Module loader<br/>[loader.js]"]
  node_normalization["Path normalization<br/>[unWindows.js]"]
end

subgraph group_parallel["Parallel execution"]
  node_parallel_api["Parallel runner<br/>[parallel_runner.js]"]
  node_randomization["Test randomization<br/>[randomize.js]"]
  node_worker_entry["Worker entry point<br/>[worker.js]"]
  node_worker["Parallel worker<br/>[parallel_worker.js]"]
end

node_user(("Project user"))
node_test_modules["Project test modules"]
node_results["Terminal results"]

node_user -->|"invokes"| node_cli_entry
node_cli_entry -->|"starts"| node_cli
node_cli -->|"selects runner"| node_runner_api
node_cli -->|"selects runner"| node_parallel_api
node_runner_api -->|"inherits"| node_runner_base
node_parallel_api -->|"inherits"| node_runner_base
node_runner_base -->|"loads configuration"| node_module_loader
node_runner_api -->|"loads test files"| node_module_loader
node_runner_api -->|"filters suites"| node_path_filter
node_runner_api -->|"filters names"| node_regex_filter
node_runner_api -->|"guards execution"| node_exit_handler
node_runner_base -->|"normalizes paths"| node_normalization
node_runner_base -.->|"runs hooks"| node_config_setup
node_runner_api -->|"executes specs"| node_test_modules
node_parallel_api -->|"uses randomization"| node_randomization
node_worker_entry -->|"starts worker"| node_worker
node_parallel_api -.->|"dispatches work"| node_worker_entry
node_worker -->|"filters names"| node_regex_filter
node_cli -.->|"prints results"| node_results

click node_cli "https://github.com/jasmine/jasmine-npm/blob/main/lib/command.js"
click node_cli_entry "https://github.com/jasmine/jasmine-npm/blob/main/bin/jasmine.js"
click node_runner_api "https://github.com/jasmine/jasmine-npm/blob/main/lib/jasmine.js"
click node_parallel_api "https://github.com/jasmine/jasmine-npm/blob/main/lib/parallel_runner.js"
click node_runner_base "https://github.com/jasmine/jasmine-npm/blob/main/lib/runner_base.js"
click node_module_loader "https://github.com/jasmine/jasmine-npm/blob/main/lib/loader.js"
click node_config_setup "https://github.com/jasmine/jasmine-npm/blob/main/lib/global_setup_or_teardown_runner.js"
click node_path_filter "https://github.com/jasmine/jasmine-npm/blob/main/lib/filters/path_spec_filter.js"
click node_regex_filter "https://github.com/jasmine/jasmine-npm/blob/main/lib/filters/regex_spec_filter.js"
click node_exit_handler "https://github.com/jasmine/jasmine-npm/blob/main/lib/exit_handler.js"
click node_normalization "https://github.com/jasmine/jasmine-npm/blob/main/lib/unWindows.js"
click node_randomization "https://github.com/jasmine/jasmine-npm/blob/main/lib/randomize.js"
click node_worker_entry "https://github.com/jasmine/jasmine-npm/blob/main/bin/worker.js"
click node_worker "https://github.com/jasmine/jasmine-npm/blob/main/lib/parallel_worker.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_cli_entry,node_runner_api,node_user toneBlue
class node_runner_base,node_config_setup,node_path_filter,node_regex_filter,node_exit_handler toneAmber
class node_module_loader,node_normalization toneMint
class node_parallel_api,node_randomization,node_worker_entry,node_worker toneRose
class node_test_modules,node_results toneIndigo
```

## Components

### CLI and API

- [CLI commands](https://github.com/jasmine/jasmine-npm/blob/main/lib/command.js): `lib/command.js`
- [CLI entry point](https://github.com/jasmine/jasmine-npm/blob/main/bin/jasmine.js): `bin/jasmine.js`
- [Jasmine runner](https://github.com/jasmine/jasmine-npm/blob/main/lib/jasmine.js): `lib/jasmine.js`

### Test execution

- [Runner base](https://github.com/jasmine/jasmine-npm/blob/main/lib/runner_base.js): `lib/runner_base.js`
- [Global setup and teardown](https://github.com/jasmine/jasmine-npm/blob/main/lib/global_setup_or_teardown_runner.js): `lib/global_setup_or_teardown_runner.js`
- [Suite path filter](https://github.com/jasmine/jasmine-npm/blob/main/lib/filters/path_spec_filter.js): `lib/filters/path_spec_filter.js`
- [Name regex filter](https://github.com/jasmine/jasmine-npm/blob/main/lib/filters/regex_spec_filter.js): `lib/filters/regex_spec_filter.js`
- [Exit handling](https://github.com/jasmine/jasmine-npm/blob/main/lib/exit_handler.js): `lib/exit_handler.js`

### Configuration and loading

- [Module loader](https://github.com/jasmine/jasmine-npm/blob/main/lib/loader.js): `lib/loader.js`
- [Path normalization](https://github.com/jasmine/jasmine-npm/blob/main/lib/unWindows.js): `lib/unWindows.js`

### Parallel execution

- [Parallel runner](https://github.com/jasmine/jasmine-npm/blob/main/lib/parallel_runner.js): `lib/parallel_runner.js`
- [Test randomization](https://github.com/jasmine/jasmine-npm/blob/main/lib/randomize.js): `lib/randomize.js`
- [Worker entry point](https://github.com/jasmine/jasmine-npm/blob/main/bin/worker.js): `bin/worker.js`
- [Parallel worker](https://github.com/jasmine/jasmine-npm/blob/main/lib/parallel_worker.js): `lib/parallel_worker.js`

### Other components

- **Project user**
- **Project test modules**
- **Terminal results**

## Connections

- Project user → CLI entry point: invokes (evidence: `README.md`)
- CLI entry point → CLI commands: starts (evidence: `bin/jasmine.js`)
- CLI commands → Jasmine runner: selects runner (evidence: `lib/command.js`)
- CLI commands → Parallel runner: selects runner (evidence: `lib/command.js`)
- Jasmine runner → Runner base: inherits (evidence: `lib/jasmine.js`)
- Parallel runner → Runner base: inherits (evidence: `lib/parallel_runner.js`)
- Runner base → Module loader: loads configuration (evidence: `lib/runner_base.js`)
- Jasmine runner → Module loader: loads test files (evidence: `lib/jasmine.js`)
- Jasmine runner → Suite path filter: filters suites (evidence: `lib/jasmine.js`)
- Jasmine runner → Name regex filter: filters names (evidence: `lib/jasmine.js`)
- Jasmine runner → Exit handling: guards execution (evidence: `lib/jasmine.js`)
- Runner base → Path normalization: normalizes paths (evidence: `lib/runner_base.js`)
- Runner base → Global setup and teardown: runs hooks (evidence: `lib/runner_base.js`)
- Jasmine runner → Project test modules: executes specs (evidence: `lib/jasmine.js`)
- Parallel runner → Test randomization: uses randomization (evidence: `lib/parallel_runner.js`)
- Worker entry point → Parallel worker: starts worker (evidence: `bin/worker.js`)
- Parallel runner → Worker entry point: dispatches work
- Parallel worker → Name regex filter: filters names (evidence: `lib/parallel_worker.js`)
- CLI commands → Terminal results: prints results
