name: architecture description: Architecture deep-dive for poku covering project structure, execution flow, config discovery, runtime detection, and competitive context. Use when navigating the codebase or understanding how components fit together.
How the project is organized and where to look. Read the actual directories and source to confirm details, since file lists change over time.
1. Directory Structure
Read the src/ tree to understand module organization. Each directory has a clear responsibility:
src/modules/: public surface. The barrel files exposed to consumers are the ones listed underexportsinpackage.json(read it for the current entrypoints). Subfolders hold the essentials (corepoku/assert/strict) and the helper APIs (describe,it,test,skip,kill,env, etc.)src/services/: runtime services. The runner, per-file execution, watch mode, and reporters live heresrc/parsers/: CLI and config parsing. Argument reading, config discovery, runtime detection, and runner resolutionsrc/configs/: global state, including theGLOBALsingletonsrc/builders/: chainable builders (assert, reporter)src/polyfills/: cross-runtime compatibility shimssrc/bin/: CLI entry.src/bin/index.tsis the published binarysrc/@types/: TypeScript type definitions
To find a specific file, read the relevant directory rather than relying on a fixed list here.
2. Execution Flow
Trace the path from CLI invocation to test results:
- The CLI entry (
src/bin/index.ts) parses args, loads config, and callspoku() - The
poku()orchestrator in the essentials module starts the run - The runner service builds a concurrency-bounded queue and iterates the matched files
- Each test file is spawned in its own process with
shell: false - Child processes inherit
POKU_*environment variables set by the parent - The selected reporter renders results
3. Config System
- Auto-discovered files (in order):
poku.config.js,.pokurc.json,.pokurc.jsonc. The discovery logic lives in the options parser undersrc/parsers/.poku.config.cjsandpoku.config.tsare supported only via an explicit--config=flag, not auto-discovery - For the available options, read the config types in
src/@types/and the CLI help insrc/bin/. They are the source of truth and stay current as options evolve
4. Runtime Detection
Read the runtime detection and runner resolution in src/parsers/:
- Detection order:
POKU_RUNTIMEenv var, thentypeof Deno, thentypeof Bun, otherwise default'node' - Runner: Bun (
['bun']), Deno (['deno', 'run', ...perms]), Node (['node'], or['node', '--import=tsx']for TypeScript files)
5. Competitive Context
Poku differentiates from Jest/Vitest/Mocha/etc. by:
- No internal test mapping: tests are not registered or mapped internally, only their execution is reported. This is the core architectural decision that makes tests behave as plain JavaScript (see the Philosophy in
CLAUDE.md) - Zero runtime dependencies
- Faster than Jest and Vitest in the project's own benchmarks (see
benchmark/for current numbers and the caveats stated there) - Process-per-file isolation by default (
--isolation=noneruns all files in the same process, useful for debugging) - Cross-platform (Node/Bun/Deno) zero-config
- Built-in service management (
startService,waitForPort,kill, and related helpers)