Testing - flight505/ContextCraft GitHub Wiki

Testing Guide

This document provides an overview of the testing approaches and commands available in this project.

Unit Tests

  • npm test - Runs Jest unit tests (currently 105 tests in 2 test suites)
  • npm run test:watch - Runs Jest in watch mode for continuous testing
  • npm run test:coverage - Runs Jest with coverage reporting

Build Tests

  • npm run test-build:mac - Tests macOS build
  • npm run test-build:win - Tests Windows build
  • npm run test-build:linux - Tests Linux build
  • npm run test-build:cross - Tests cross-platform builds

Native Module Tests

  • npm run rebuild-native-modules - Rebuilds all native modules with C++20 support

Development Environment

  • npm run dev:c++20 - Runs development environment with C++20 support
  • npm run dev:c++20 -- --rebuild - Rebuilds native modules before starting dev environment

Comprehensive Testing

  • npm run test-all - Runs unit tests, rebuilds native modules, and tests Mac and Windows builds
  • npm run test-comprehensive - Runs a complete test suite including:
    • Unit tests
    • Native module rebuilding
    • Build tests
    • Cross-platform verification
    • Development environment verification

The test-comprehensive script is the most thorough option as it:

  1. Runs all unit tests
  2. Rebuilds native modules with C++20 support
  3. Tests platform-specific builds
  4. Verifies cross-platform compatibility
  5. Checks development environment setup
  6. Even tests C++20 compatibility by compiling a small test program

This gives you a complete testing workflow to ensure your app works correctly across platforms with proper C++20 support for native modules.