.ai-rulez/skills/test-execution-patterns/SKILL.md
test execution patterns
npx skillsauth add kreuzberg-dev/kreuzberg test-execution-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Proper test execution using Taskfile with required environment setup
NEVER run tests directly. The Taskfile ensures correct env vars, dependencies (PDFium, ONNX Runtime), library paths, FFI bindings, and platform-specific quirks.
# WRONG: go test ./... | pytest tests/ | npm test
# CORRECT: task <language>:test
| Command | Purpose |
|---------|---------|
| task go:test | Go tests (standard) |
| task go:test:ci | Go tests (CI mode with enhanced debugging) |
| task python:test | Python tests |
| task python:test:ci | Python tests with coverage |
| task typescript:test | TypeScript tests |
| task java:test | Java tests |
| task ruby:test | Ruby tests |
| task csharp:test | C# tests |
| task php:test | PHP tests |
| task elixir:test | Elixir tests |
All language task definitions are in .task/languages/<lang>.yml with corresponding scripts in scripts/<lang>/test.sh.
Embedding tests require ONNX Runtime. Set ORT_LIB_LOCATION to the library directory:
| Platform | Install | Path |
|----------|---------|------|
| macOS (Apple Silicon) | brew install onnxruntime | /opt/homebrew/opt/onnxruntime/lib |
| macOS (Intel) | brew install onnxruntime | /usr/local/opt/onnxruntime/lib |
| Linux | Download from GitHub releases | /path/to/onnxruntime-linux-x64-<version>/lib (also add to LD_LIBRARY_PATH) |
| Windows | Download binaries | Set ORT_LIB_LOCATION and add to PATH |
| CI | .github/actions/setup-onnx-runtime | Automatic (sets ORT_LIB_LOCATION, ORT_DYLIB_PATH, library search paths) |
If ORT_LIB_LOCATION is not set, tests fail with: libonnxruntime.dylib: cannot open shared object file
task <lang>:test
-> scripts/<lang>/test.sh
-> source scripts/lib/common.sh
-> source scripts/lib/library-paths.sh
-> setup_go_paths() # CGO flags, PKG_CONFIG_PATH, platform lib paths
-> setup_pdfium_paths() # PDFium library location
-> setup_onnx_paths() # ONNX Runtime if ORT_LIB_LOCATION set
-> run tests with fully configured environment
cargo build --release --package kreuzberg-ffi (Rust FFI library)ORT_LIB_LOCATION if testing embeddingstask <lang>:testexport CI=true VERBOSE_MODE=true && task go:test
Shows: Go version, working directory, library paths, CGO flags.
ls target/release/libkreuzberg_ffi.{dylib,so,dll}
echo $ORT_LIB_LOCATION && ls $ORT_LIB_LOCATION/libonnxruntime*
| Error | Cause | Fix |
|-------|-------|-----|
| Package 'kreuzberg-ffi' not found | PKG_CONFIG_PATH not set | Use task go:test (auto-sets), or export PKG_CONFIG_PATH=$PWD/crates/kreuzberg-ffi:$PKG_CONFIG_PATH |
| libonnxruntime.dylib: cannot open | ORT_LIB_LOCATION not set | Set ORT_LIB_LOCATION per platform table above |
| undefined reference to kreuzberg_extract_file_sync | FFI library not built or not in path | cargo build --release --package kreuzberg-ffi then verify DYLD_LIBRARY_PATH |
| Segmentation fault | Version mismatch, threading issue | Set RUST_BACKTRACE=full, run single test with -run TestName -v, check -race flag |
sync.Mutex in packages/go/v4/ffi.go (PDFium is not thread-safe)@pytest.mark.asyncio and pytest-asyncio for async isolationBest Practice: Always test locally with task commands BEFORE pushing to CI.
Before running tests:
cargo build --release --package kreuzberg-ffi)ORT_LIB_LOCATION if testing embeddingstask <language>:test (NOT direct test commands)When tests fail in CI:
task <language>:testtools
Extract text, tables, metadata, and images from 91+ document formats (PDF, Office, images, HTML, email, archives, academic) using Kreuzberg. Use when writing code that calls Kreuzberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins.
development
ocr uackend management
data-ai
mime detection routing
development
format specific extraction