Test mode is Tea’s built-in debugging environment. When active, every macro invocation — and some non-macro markup such as links and images — is wrapped in an additional HTML element called a debug view. Debug views make the underlying code visible on screen and can be hovered over to reveal additional information about what was executed. In versions ≥2.23.0 the debugging interface also includes a persistent debug bar offering variable watches and arbitrary history navigation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
Enabling Test Mode
- Tweego
- Twine 2 (≥v2.2)
- Twine 2 (<v2.2)
- Twine 1
Pass the test flag when compiling:
Enabling test mode manually
You can force test mode on at runtime by settingConfig.debug to true in your Story JavaScript:
The Debug Bar (≥v2.23.0)
In Tea ≥v2.23.0 a debug bar appears in the bottom-right corner of the page. It provides three tools:Variable watch panel
The watch panel shows the current value of any story or temporary variable you add to it.- Toggle the panel — click the Watch button.
- Add a watch — type the variable name (including the
$or_sigil) into the Add field and press Enter or click the+button. Depending on your browser, a list of all current variables may appear as you type. - Watch all current variables — click the magic wand button.
- Delete a single watch — click the trash icon next to its name.
- Delete all watches — click the trash-can button.
Debug views toggle
Click the Views toggle button in the debug bar to show or hide the inline debug views without leaving the page.History navigation
The Turn select field lets you jump directly to any moment within the available history, equivalent to using the UI bar’s forward/backward buttons but for any arbitrary position in the history.Debug Views (≤v2.22.0)
In older versions of Tea, debug views are the primary debugging tool. They wrap every macro invocation in a visible HTML element showing the macro’s name and arguments. Toggle them on and off using the Debug View button at the top of the UI bar. If you’ve removed or hidden the UI bar, you can wire up your own toggle:The button above only toggles the visibility of existing views. Test mode itself must still be enabled first for debug views to be generated at all.
Using <<script>> and <<run>> for Testing
During development you can execute arbitrary JavaScript inline with<<script>> or run TwineScript expressions with <<run>>. These are useful for setting up specific variable states without navigating through many passages.