The built-inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Octopodo/kt-testing-suite-core/llms.txt
Use this file to discover all available pages before exploring further.
ConsoleReporter and JSONReporter cover the most common output scenarios, but there are plenty of reasons to go further. You might need to format results for a specific CI system’s log parser, post test outcomes to an external webhook, render results inside a custom Adobe panel UI, or suppress noise and show only failures. All of this is possible by implementing the TestReporter interface — a six-method contract that the TestRunner calls at every stage of a run.
When to Use a Custom Reporter
- CI output formatting
- External system integration
- VS Code extension output
Different CI providers recognise different log conventions. A custom reporter can emit results in JUnit XML, TAP (Test Anything Protocol), or any other format your pipeline expects — simply by writing the appropriate strings with
$.writeln inside each lifecycle method.The TestReporter Interface
ImplementTestReporter from kt-testing-suite-core and provide a concrete method for each of the six lifecycle hooks. All six must be present even if the body is a no-op, because the TestRunner calls them unconditionally.
Method reference
| Method | Parameters | Called when |
|---|---|---|
onStart() | — | Once, before the first suite runs |
onSuiteStart(suite) | suite: Suite | Entering a describe block |
onTestStart(test) | test: Test | Just before an it callback executes |
onTestEnd(test, result) | test: Test, result: TestResult | After an it callback completes (any outcome) |
onSuiteEnd(suite) | suite: Suite | After all tests and nested suites in a describe finish |
onFinished(results) | { passed, failed, total } | Once, after every suite has run |
TestResult in detail
Theresult argument passed to onTestEnd carries everything you need to classify and display a test outcome:
statusis always one of the three string literals — no numeric codes.errorisundefinedfor passing and skipped tests; it is populated only whenstatus === 'failed'.fileNameandlinecome from the raw ExtendScript error object and may be absent in some host environments.
The
Suite and Test types are defined in the core types module. A Suite carries description, tests, children (nested suites), and hook functions (beforeAll, afterAll, beforeEach, afterEach). A Test carries name and fn (the test callback).A Complete Custom Reporter Example
The example below is a minimal but fully functional reporter. It prefixes each test result with a plainOK or FAIL label rather than emoji, and prints a one-line summary when the run is complete — a format that many log parsers find easier to grep.
Extending ConsoleReporter as a Base
If you want all the standard human-readable output plus some additional behaviour, extendConsoleReporter and override only the methods you need. This pattern is useful for test utilities, mock reporters in meta-tests, and scenarios where you want to intercept results without losing the existing log output.
Registering a Custom Reporter
Pass your reporter instance as the second argument torunTests(), or provide it directly to the TestRunner constructor. Both paths lead to the same TestRunner internals.
A Note on $.writeln in ExtendScript
All output inside Adobe ExtendScript must use $.writeln() rather than console.log(). The $ object is the ExtendScript global host object, and $.writeln is the standard way to write a line to the host application’s JavaScript console (visible in the ExtendScript Toolkit or routed to an IDE extension’s output channel).
When building reporters intended for use in both ExtendScript and a Node.js test harness, you can guard the call:
typeof $ !== 'undefined' ? $.writeln(msg) : console.log(msg). For pure ExtendScript targets, $.writeln is always safe.