← Back to Documentation Index

Kimera Test Suite

This directory contains the test suite for Kimera.js. Tests are organized by the permissions they require.

Directory Structure

Tests are organized into subdirectories based on the permissions they need:

Running Tests

Run All Tests

The CI system automatically runs all tests with appropriate permissions:

go build -o kimera
# Tests are run automatically by directory

Run Tests by Category

Run tests in a specific directory with the appropriate flags:

# Filesystem tests
./kimera run testings/fs/file-read.js --fs

# Network tests
./kimera run testings/net/fetch-get.js --net

# Environment tests
./kimera run testings/env/permission-env-allowed.js --env

# Combined permission tests
./kimera run testings/combined/permission-demo.js --fs --env

# Basic tests (no flags needed)
./kimera run testings/basic/globals.js

Adding New Tests

When adding new tests, place them in the appropriate directory:

  1. Determine required permissions - What system access does your test need?

    • Filesystem access? → fs/
    • Network access? → net/
    • Environment variables? → env/
    • Multiple permissions? → combined/
    • No permissions? → basic/
  2. Create your test file - Use descriptive names:

    • Good: file-read-binary.js, fetch-headers.js
    • Avoid: test1.js, mytest.js
  3. Follow test conventions:

    • Tests should exit with code 0 on success
    • Use console.log() for output
    • Use descriptive messages (e.g., "PASS: Test description")
    • Handle errors appropriately
  4. No manual CI updates needed - The CI automatically discovers and runs tests based on directory structure!

Test File Naming

Use descriptive, kebab-case names that indicate what the test does:

Permission Flags

Tests are automatically run with the appropriate flags based on their directory.