This project includes comprehensive Docker setup and Node.js version detection testing infrastructure.
Defines isolated test services for various Node.js runtime scenarios:
- test-fnm: FNM (Fast Node Manager) scenario
- test-nvm: NVM (Node Version Manager) scenario
- test-node-only: System Node without version managers
- test-node-setup: Auto-install scenario from base Ubuntu
Each service has:
- Isolated node_modules volume
- Proper environment configuration
- Build from custom Dockerfiles with required system dependencies
Main development environment for running OCcode editor.
Located in docker/ directory:
test-fnm.Dockerfile: FNM + Node development environmenttest-nvm.Dockerfile: NVM + Node development environmenttest-node-only.Dockerfile: System Node onlytest-node-setup.Dockerfile: Ubuntu base with NVM auto-install
All Dockerfiles include system dependencies:
build-essential- Compiler toolchainlibx11-dev,libxkbfile-dev- For native module compilation (native-keymap, etc.)
Comprehensive test runner for all Node.js scenarios.
Tests:
- fnm scenario: Verifies FNM installation and availability
- nvm scenario: Verifies NVM installation and availability
- node-only: Verifies system Node works
- node-setup: Verifies auto-install from clean Ubuntu
Usage:
make test # Run all tests via Makefile
bash scripts/test-node-version-detection.sh # Run directlyShared Node.js version detection and activation logic.
Priority order:
- Docker environment → use system Node
- fnm → install/use specified version
- nvm → install/use specified version
- System Node → if version matches
- Auto-install nvm → fallback
Environment activation script for shell configuration.
# Run all tests
make test
# Run individual docker-compose tests
docker-compose -f docker-compose.test.yml run --rm test-fnm
docker-compose -f docker-compose.test.yml run --rm test-nvm
docker-compose -f docker-compose.test.yml run --rm test-node-only
docker-compose -f docker-compose.test.yml run --rm test-node-setup# Start development environment
docker-compose up -d
# Stop
docker-compose down
# View logs
docker-compose logs -f editor
# Access container
docker-compose exec editor bashmake test- Run all Node version detection testsmake docker-test- Run all tests with docker-composemake docker-test-fnm- Test FNM scenario onlymake docker-test-nvm- Test NVM scenario onlymake docker-test-node-only- Test Node-only scenariomake docker-test-node-setup- Test setup scenario
make run-fnm- Run FNM test with direct dockermake run-nvm- Run NVM test with direct dockermake run-node-only- Run Node-only test with direct dockermake run-node-setup- Run setup test with direct docker
All 4 test scenarios pass successfully:
- ✓ fnm scenario - fnm 1.39.0 available
- ✓ nvm scenario - nvm 0.39.7 available
- ✓ Node only scenario - v22.22.2 detected
- ✓ Node setup scenario - v20.18.2 installed via auto-install
- Isolated Environments: Each test runs in its own container with isolated volumes
- System Dependencies: All Dockerfiles include required build tools and libraries
- Version Detection: Sophisticated priority-based Node version detection
- Clean Test Scripts: Test logic fixed to handle bash function returns properly
- Docker Optimization: .dockerignore configured to reduce build context
If docker-compose build times out, use:
DOCKER_BUILDKIT=0 docker-compose buildEnsure git safe.directory is configured:
git config --global safe.directory /path/to/occRebuild Dockerfiles to ensure xkbfile and other dev packages are installed:
docker-compose -f docker-compose.test.yml build --no-cache test-node-only