Naite Viewer Overview
Real-time Visualization
Unix Socket Communication
Project Isolation
Auto Connection
What is Naite Viewer?
Naite Viewer is a feature included in the Sonamu VSCode Extension that visualizes Naite logs recorded during test execution in real-time. Naite transmits all data recorded withNaite.t() during test execution to the VSCode Extension, allowing developers to visually track test flows. This is especially useful for complex business logic or situations involving multiple intertwined function calls.
Key Features
Real-time Log Display
Naite.t() during test execution in the VSCode panel. View structured logs without searching through the console.Grouping by Test
Callstack Tracking
Filtering and Search
user:*), or search log contents by keyword.Architecture
1. Unix Socket Communication
Naite Viewer communicates with the test process through Unix Socket. This method allows direct inter-process communication without using the file system, making it fast and secure. Benefits of socket communication:- Fast transmission: Much faster IPC (Inter-Process Communication) than HTTP or files
- Real-time: Logs are delivered to Extension immediately as tests run
- Isolation: Independent sockets per project prevent conflicts
- macOS / Linux
- Windows
{hash} is the first 8 characters of the MD5 hash of the sonamu.config.ts path.See Hash Generation Method in Detail
See Hash Generation Method in Detail
sonamu.config.ts file:2. Message Protocol
Three types of messages are transmitted between the test process and Extension.run/start - Test Run Start
Sent when a test run starts. The Extension clears all existing logs and prepares for a new test run upon receiving this message.run/start message is sent each time, reinitializing the Viewer.test/result - Test Result
Sent each time a test case completes. Includes the test result along with Naite logs (traces).- Test metadata: Suite name, file path, line number
- Test result: Pass/fail status, duration, error info
- Naite traces: All logs recorded with
Naite.t()
run/end - Test Run End
Sent when all tests complete. The Extension recognizes the test run has ended with this message.3. Transmission Flow
Let’s look at the order in which messages are sent throughout the test execution process.Transmission Flow in Code
Transmission Flow in Code
Installation and Setup
1. Extension Installation
Install from VSCode Marketplace
- Click the Extensions icon in VSCode’s left sidebar
- Search for “Sonamu”
- Click the Install button
Verify Extension Activation
2. Auto Connection
The Extension automatically starts the socket server when it runs:Project Detection
sonamu.config.ts file in the current workspace.Hash Calculation
sonamu.config.ts.Socket Server Start
~/.sonamu/naite-{hash}.sock.Wait for Test Process
3. Running Tests
- Regular Execution
- Watch Mode
- Specific File
Usage
1. Opening the Naite Viewer Panel

Running ‘Naite: Open Viewer’ from Command Palette to open the panel
- Command Palette
- Keyboard Shortcut
Cmd+Shift+P(macOS) orCtrl+Shift+P(Windows/Linux)- Type “Naite: Open Viewer”
- Enter
2. Viewing Logs
Logs automatically appear in Naite Viewer when tests run.Viewer Screen Layout
Naite Viewer displays tests in a 3-level hierarchy:- Hierarchy Structure
- Actual Screen
- Structure Explanation

Test logs displayed in actual Naite Viewer (Suite > Test > Trace hierarchy)
3. Checking Callstack
Click on a log to see detailed information about thatNaite.t() call.
Callstack Information Example
Callstack Information Example
test(line 20): Location whereNaite.t()was called in test codecreateUser(line 45): Actual business logic called by testrunWithMockContext: Sonamu’s Context wrapper (displayed up to here)

Callstack information and code navigation feature when clicking on a log
4. Filtering and Search
In large-scale tests, hundreds of logs can be generated. Use filtering to quickly find desired logs.- Key Pattern Filter
- Text Search
- Status Filter
Practical Use Cases
1. Debugging Complex Business Logic
When debugging complex logic that goes through multiple steps, you can track the state at each step.Viewing in Viewer
Viewing in Viewer
- Logs only up to
order:payment:start - Clearly identify which step succeeded
- Use callstack to confirm exact failure location
order:payment:*→ Show only payment-related logsorder:*:start→ Show only start logs for all steps
2. Syncer Code Generation Tracking
Track which templates Sonamu’s Syncer rendered and which files it created.Syncer Log Example
Syncer Log Example
- See order of file creation
- Measure each template rendering time
- Filter and check specific templates (
syncer:renderTemplate:*)
3. API Call Chain Tracking
When calling multiple APIs in sequence, track inputs and outputs of each API.4. Identifying Performance Bottlenecks
Find sections that take long and optimize them.Performance Analysis
Performance Analysis
processDatatakes longest at 3.3 seconds (bottleneck)fetchLargeDatais acceptable at 1.5 secondssaveToDatabaseis fast at 0.4 seconds
processData5. Error Cause Tracking
Track which step and what data caused an error.console.log.Understanding Internal Structure
NaiteReporter Connection Management
NaiteReporter includes buffering and reconnection logic for stable socket connection management.Full NaiteReporter Structure
Full NaiteReporter Structure
- Buffering: Stores messages in buffer even if Extension isn’t ready
- Lazy connection: Connection failure is not treated as error
- Auto resend: Sends all buffered messages on successful connection
- CI detection: Skips socket communication in CI environment
Per-Project Socket Isolation
Isolate logs when working on multiple Sonamu projects simultaneously.- Hash Generation
- Socket Path
- Result
- Complete isolation of logs between projects
- Simultaneous execution support (test A while testing B)
- Stable operation without conflicts
Integration with bootstrap.ts
Sonamu’s test bootstrap callsNaite.getAllTraces() for each test to collect logs.
Naite Integration in bootstrap.ts
Naite Integration in bootstrap.ts
- test() wrapper: Wraps Vitest’s
test()to auto-collect traces - Both try-catch branches: Collects traces on both success/failure for error debugging
- task.meta usage: Uses Vitest’s metadata system to pass traces
- afterEach send: Sends to Reporter after each test ends
Troubleshooting
Extension Not Receiving Logs
Extension Not Running
Extension Not Running
- No Sonamu icon in VSCode bottom status bar
- Can’t open Naite Viewer panel
- Check Sonamu Extension in Extensions tab
- Click “Enable” or “Reload” button
- Restart VSCode:
Cmd+Shift+P→ “Reload Window”
Socket Path Mismatch
Socket Path Mismatch
- Extension is running
- Tests succeed but logs don’t appear
- “ENOENT” or “ECONNREFUSED” error in console
- Open project folder directly in VSCode
- Restart Extension
Socket File Permission Issue
Socket File Permission Issue
- “Permission denied” error
- Socket file exists but can’t access
Too Many Logs Causing Slowdown
- Bad Example
- Good Example
- Conditional Logging
Socket Connection Error in CI Environment
process.env.CI === "true"- Automatically set in GitHub Actions, GitLab CI, CircleCI, etc.
Logs Accumulating in Watch Mode
When modifying files multiple times in watch mode, previous test logs may remain. Manual clear methods:- Click “Clear All” button at top of Naite Viewer panel
- Or Command Palette → “Naite: Clear Logs”