vanya build
Usage
vanya build [OPTIONS] <FILES>... -o <OUTPUT_DIR>Description
Transpiles vanya files to the target language specified by the plugin. Generates:
- Test files in the target language
- Source maps (
.vanyamap) for debugging
Arguments
| Argument | Description |
|---|---|
<FILES> | One or more .vanya files to build |
Options
| Option | Description |
|---|---|
-o, --output <DIR> | Output directory (required) |
--config <PATH> | Path to config file |
--format <FORMAT> | Output format: raw (default), pytest-function |
Output Formats
| Format | Description | Use Case |
|---|---|---|
raw | Plain Python code with sync_playwright() wrapper | Custom test runners, scripts |
pytest-function | Wrapped in def test_...() with proper naming | pytest integration (recommended for most users) |
For browser tests, use --format pytest-function to generate tests that pytest can discover and run.
Exit codes
| Code | Meaning |
|---|---|
0 | Build successful |
1 | Build failed (validation or generation error) |
Output structure
out/├── test_login.py # Generated test├── test_login.py.vanyamap # Source map├── test_checkout.py└── test_checkout.py.vanyamapExamples
# Build to out/ directory (raw format)vanya build tests/*.vanya -o out/
# Build for pytest (recommended for browser tests)vanya build tests/*.vanya -o out/ --format pytest-function
# Build with custom configvanya build --config ./prod.toml tests/*.vanya -o out/ --format pytest-functionSource maps
Source maps allow tools to map generated code back to the original vanya source. The format is JSON:
{ "source": "login.vanya", "lines": [ null, null, { "start": 100, "end": 150 }, { "start": 100, "end": 150 } ]}Each index in the lines array corresponds to a generated line number (0-indexed). The value is either null (for generated preamble code with no source) or a span object with start and end byte offsets into the original .vanya file.