Reportage VSCode Extension

Syntax highlighting and code snippets for reportage test files.
What is Reportage?
Reportage is a declarative test framework for command-line tools and shell scripts.
It lets you write test cases that specify commands to run, files to create, and assertions to verify behavior.
Features
Syntax Highlighting
Full syntax highlighting for .repor files with support for all reportage constructs: cases, actions, assertions, and operators.
Code Snippets
Snippets covering every reportage construct, from case scaffolding to individual assertions; see the full list below.
Language Support
Embedded shell syntax highlighting for action steps and automatic bracket matching and auto-closing pairs.
Quick Start
- Install the extension from the VSCode marketplace
- Open or create a
.repor file
- Start typing and use snippets to scaffold test cases
Snippets
Each snippet below is documented with a runnable example.
The example files under examples/ are run by reportage's own e2e suite, so they always reflect working syntax.
Case block
case — Reportage case block
Example
case "Case block" {
$ true
assert { exit 0 }
}
From examples/case_block.repor.
Action step
$ / action — Run a command (action step)
Example
case "Action step" {
$ printf 'one\ntwo\n' | grep 'two'
assert {
exit 0
stdout contains "two"
}
}
From examples/action_step.repor.
Write step (string)
write — Write a string literal to a workspace path
Example
case "Write step (string)" {
write <"greeting.txt"> "hello\n"
$ cat greeting.txt
assert {
exit 0
stdout text_equals "hello\n"
}
}
From examples/write_step_string.repor.
Write step (heredoc)
writeh — Write a heredoc literal to a workspace path
Example
case "Write step (heredoc)" {
write <"report.md"> ```
# Report
Heredoc bodies are dedented relative to the closing fence.
```
$ cat report.md
assert {
exit 0
stdout contains "# Report"
}
}
From examples/write_step_heredoc.repor.
Assert (single expectation)
assert — Single-line assertion block with exactly one expectation
Example
case "Assert (single expectation)" {
$ true
assert { exit 0 }
}
From examples/assert_single_expectation.repor.
Assert (block)
assertb — Multi-line assertion block, one expectation per line
Example
case "Assert (block)" {
$ printf 'ok\n'
assert {
exit 0
stdout contains "ok"
}
}
From examples/assert_block.repor.
Exit expectation
exit — Assert the process exit code
Example
case "Exit expectation" {
$ sh -c 'exit 3'
assert { exit 3 }
}
From examples/exit_expectation.repor.
Stdout contains
stdout-contains — Assert stdout contains the given text
Example
case "Stdout contains" {
$ printf 'alpha beta\n'
assert { stdout contains "beta" }
}
From examples/stdout_contains.repor.
Stdout empty
stdout-empty — Assert stdout is empty
Example
case "Stdout empty" {
$ true
assert { stdout empty }
}
From examples/stdout_empty.repor.
Stdout contents_equals
stdout-contents-equals — Assert stdout is byte-for-byte equal to a workspace file (use @"..." for a fixture reference)
Example
case "Stdout contents_equals" {
$ printf 'hello\n' > expected.txt
$ printf 'hello\n'
assert { stdout contents_equals <"expected.txt"> }
}
From examples/stdout_contents_equals.repor.
Stdout text_equals
stdout-text-equals — Assert stdout is byte-for-byte equal to inline text
Example
case "Stdout text_equals" {
$ printf 'hello\n'
assert { stdout text_equals "hello\n" }
}
From examples/stdout_text_equals.repor.
Stdout text_equals (heredoc)
stdout-text-equals-heredoc — Assert stdout is byte-for-byte equal to a heredoc literal's content
Example
case "Stdout text_equals (heredoc)" {
$ printf 'hello\n'
assert {
stdout text_equals ```
hello
```
}
}
From examples/stdout_text_equals_heredoc.repor.
Stderr contains
stderr-contains — Assert stderr contains the given text
Example
case "Stderr contains" {
$ printf 'warning: low disk\n' 1>&2
assert { stderr contains "warning" }
}
From examples/stderr_contains.repor.
Stderr empty
stderr-empty — Assert stderr is empty
Example
case "Stderr empty" {
$ printf 'quiet\n'
assert { stderr empty }
}
From examples/stderr_empty.repor.
Stderr contents_equals
stderr-contents-equals — Assert stderr is byte-for-byte equal to a workspace file (use @"..." for a fixture reference)
Example
case "Stderr contents_equals" {
$ printf 'hello\n' > expected.txt
$ printf 'hello\n' 1>&2
assert { stderr contents_equals <"expected.txt"> }
}
From examples/stderr_contents_equals.repor.
Stderr text_equals
stderr-text-equals — Assert stderr is byte-for-byte equal to inline text
Example
case "Stderr text_equals" {
$ printf 'hello\n' 1>&2
assert { stderr text_equals "hello\n" }
}
From examples/stderr_text_equals.repor.
Stderr text_equals (heredoc)
stderr-text-equals-heredoc — Assert stderr is byte-for-byte equal to a heredoc literal's content
Example
case "Stderr text_equals (heredoc)" {
$ printf 'hello\n' 1>&2
assert {
stderr text_equals ```
hello
```
}
}
From examples/stderr_text_equals_heredoc.repor.
File exists
file-exists — Assert a file exists
Example
case "File exists" {
$ touch marker.txt
assert { file <"marker.txt"> exists }
}
From examples/file_exists.repor.
File contains
file-contains — Assert a file contains the given text
Example
case "File contains" {
write <"notes.txt"> "remember the milk\n"
$ true
assert { file <"notes.txt"> contains "milk" }
}
From examples/file_contains.repor.
File contains (heredoc)
file-contains-heredoc — Assert a file contains a heredoc literal's content
Example
case "File contains (heredoc)" {
write <"notes.txt"> ```
line one
line two
```
$ true
assert {
file <"notes.txt"> contains ```
line one
```
}
}
From examples/file_contains_heredoc.repor.
File contents_equals
file-contents-equals — Assert a file is byte-for-byte equal to a workspace file (use @"..." for a fixture reference)
Example
case "File contents_equals" {
$ printf 'hello\n' > actual.txt
assert { file <"actual.txt"> contents_equals @"fixtures/expected.txt" }
}
From examples/file_contents_equals.repor.
File text_equals
file-text-equals — Assert a file is byte-for-byte equal to inline text
Example
case "File text_equals" {
write <"greeting.txt"> "hello\n"
$ true
assert { file <"greeting.txt"> text_equals "hello\n" }
}
From examples/file_text_equals.repor.
File text_equals (heredoc)
file-text-equals-heredoc — Assert a file is byte-for-byte equal to a heredoc literal's content
Example
case "File text_equals (heredoc)" {
$ printf 'hello\n' > actual.txt
assert {
file <"actual.txt"> text_equals ```
hello
```
}
}
From examples/file_text_equals_heredoc.repor.
Dir exists
dir-exists — Assert a directory exists
Example
case "Dir exists" {
$ mkdir out
assert { dir <"out"> exists }
}
From examples/dir_exists.repor.
Dir contains
dir-contains — Assert a directory contains an entry with the given name
Example
case "Dir contains" {
$ mkdir out && touch out/result.json
assert { dir <"out"> contains "result.json" }
}
From examples/dir_contains.repor.
Not block
not — Negate the group result of the child expectations as a whole
Example
case "Not block" {
$ printf 'alpha\n'
assert {
not {
stdout contains "missing"
}
}
}
From examples/not_block.repor.
All block
all — Pass only when every child expectation passes
Example
case "All block" {
$ printf 'alpha\n'
assert {
all {
exit 0
stdout contains "alpha"
}
}
}
From examples/all_block.repor.
Any block
any — Pass when at least one child expectation passes
Example
case "Any block" {
$ printf 'alpha\n'
assert {
any {
stdout contains "unused"
stdout contains "alpha"
}
}
}
From examples/any_block.repor.
Workspace path literal
wpath — Workspace path literal (case-workspace filesystem reference)
Example
case "Workspace path literal" {
write <"data.txt"> "payload\n"
$ cat data.txt
assert {
exit 0
file <"data.txt"> exists
}
}
From examples/workspace_path_literal.repor.
Fixture reference literal
fixture — Fixture reference literal (test-definition-side file reference, contents_equals only)
Example
case "Fixture reference literal" {
$ printf 'hello\n' > actual.txt
assert { file <"actual.txt"> contents_equals @"fixtures/expected.txt" }
}
From examples/fixture_reference_literal.repor.
Learn More
For documentation on reportage syntax and usage, visit the reportage repository.
License
Licensed under the Apache License 2.0. See LICENSE for details.