ExTester Runner

Quick Start
Section titled “Quick Start”- Install the ExTester Runner extension from the VS Code marketplace or the Open VSX Registry
- Open your VS Code extension project
- Open the Testing view and expand ExTester
- Press the play button (▶️) next to a test, or next to a suite or test in the editor gutter
What is ExTester Runner?
Section titled “What is ExTester Runner?”ExTester Runner is a VS Code extension that runs and manages the UI tests of a VS Code extension written with ExTester, without leaving VS Code.
It adds your tests to VS Code’s built-in Testing view, under the ExTester test controller, and two views below the test tree in the same sidebar:
- Screenshots: the screenshots ExTester takes of failed tests, one folder per run
- Logs: the log files of the test runs
How it Works
Section titled “How it Works”Core Functionality
Section titled “Core Functionality”-
Test Discovery
- Discovers the test files that match
testFileGloband lists them as folders, files, suites and tests - Parses the suites and tests from the sources, so the tree is ready before the tests are compiled. It reads Mocha’s BDD interface (
describeandit) and its TDD interface (suiteandtest); see Mocha interfaces - Shows
onlyorskipnext to tests marked with.onlyor.skip, and.onlynext to files that contain.only, which makes Mocha skip every other test in the run - Tags marked tests, so
@extesterRunner:onlyor@extesterRunner:skipin the filter of the Testing view shows only them - Clicking a test opens its source at the
describe,it,suiteortestthat defines it - Refreshes the tree when test files are added, removed or changed, and when the settings or
extester.config.jsonchange. Refresh Tests in the Testing view refreshes it by hand
- Discovers the test files that match
-
Test Execution
- Runs everything, a workspace folder, a folder, a file, a suite or a single test from the Testing view, or from the gutter buttons next to each suite and test in the editor
- Test: Run Tests in Current File, Test: Rerun Last Run, run history and the other Test: commands of VS Code work as for any test controller
- Debug any of them with Debug Test in the Testing view or the gutter menu. Debug runs the same command in a JavaScript Debug Terminal, so breakpoints in your tests stop them, and turns off Mocha’s timeouts so a paused test does not fail. A test that sets its own timeout with
this.timeout()keeps it. The command must start Node.js from the debug terminal, asnpx extestand npm scripts do. The debug run ends by itself when the last Node.js process of the command exits, so the terminal left at its prompt does not keep the run going - Stop a run with the stop button of the Testing view. Only one run starts at a time; starting another one offers to stop the current run
- Each run calls
extest setup-and-run, or your custom run command, in a VS Code task, with the VS Code version, release type and extra arguments from your settings. The task terminal shows the full output - Runs a build task before the tests with
preRunTask, and passes environment variables to the tests withenv; see Build before running and environment variables
-
Test Results
- Each test shows whether it passed, failed or was skipped, with its duration
- A failure shows the error message, a diff of the expected and actual values when the assertion has them, and a stack trace whose frames open your test code
- A failure also shows a thumbnail of the screenshot ExTester took of it. Click it, or Open Screenshot in the failure view, to open the full image
- Test Results shows the output of the run, and the output each test wrote while it ran
- When the run fails before any test starts, for example because
preRunTaskfailed orextestis not installed, the tests are marked as errored with the reason
The results come from a small hook that the Runner preloads into the
extestprocess withNODE_OPTIONS. It listens to Mocha’s events and copies the output to a temporary file that the Runner reads during the run. It does not change how the tests run. A test that runs more than once, for example oneitin a loop, shows as one test in the tree: it fails if any of its runs failed, with the error of each failed run. A failedafterhook (suiteTeardownin TDD) fails its suite, and a failedafterEachhook (teardownin TDD) fails the test it ran for. A test whose title the parser cannot match to the run, for example a title computed by a function, is shown as skipped and its result is in the output. -
Logs and Screenshots Management
- The Screenshots and Logs views refresh when files are created, deleted or modified during a run
- Displays screenshots and logs sorted newest-first so the latest run is always at the top
- Timestamp-named run folders show a human-readable date/time label (e.g.
Jan 15, 2025, 14:30:22) with the raw folder name as secondary text - Clear all — removes the entire contents of the Logs or Screenshots directory in one click (with confirmation)
- Delete individual item — removes a single file or folder from either view (inline trash icon or right-click > Delete, with confirmation)
- Reveal in File Explorer — opens the Logs or Screenshots root directory, or any individual item, in the OS file manager (Finder on macOS, Explorer on Windows)
Configuration
Section titled “Configuration”The extension supports both VS Code settings and a project configuration in extester.config.json. All setting IDs are prefixed with extesterRunner. when editing settings.json by hand (e.g. extesterRunner.testFileGlob):
-
View Configuration
testFileGlob: Pattern to locate test files (default:**/ui-test/**/*.test.ts)excludeGlob: Pattern to exclude paths from test search (default:**/node_modules/**)ignorePathPart: Path segment hidden from folder labels in the test tree
-
Test Execution Settings
runSources: Run the TypeScript test sources without compiling them; see Running TypeScript Sources (default:false)outputFolder: Directory for compiled test files (default:out). Ignored whenrunSourcesis enabledrootFolder: Root source directory for test files (default: not set). Ignored whenrunSourcesis enabledtempFolder: Directory for temporary test files (default: not set — the system temporary folder is used)visualStudioCode.Version: VS Code version for test execution —max,min,latest, or an exact version such as1.97.1(default:max)visualStudioCode.Type: VS Code build type —stableorinsider(default:stable)additionalArgs: Additional CLI arguments for test runner (default:[])configFile: Path of the ExTester configuration file, relative to the workspace folder; see Configuration file in a subfolder (default: not set —extester.config.jsonin the workspace folder)env: Environment variables for test runs (default:{})preRunTask: VS Code task to run before each test run, such asnpm: compile(default: not set)runCommand: Command that runs the tests instead ofnpx extest setup-and-run; see Custom run command (default: not set)hiddenWindow: Experimental. Run the tests in a VS Code window that is never shown or focused; see Running tests with a hidden window (default:false)virtualDisplay: Linux only. Run the tests on a virtual display (Xvfb) instead of your screen; see Running tests on a virtual display (default:false)virtualDisplayScreen: Screen size of the virtual display (default:1920x1080x24)
-
Log Management
hideEmptyLogFolders: Controls visibility of empty log directories (default:true)
Setup and Configuration
Section titled “Setup and Configuration”Project configuration
Section titled “Project configuration”ExTester Runner reads shared project settings from extester.config.json, the same file that configures the extest CLI. One file holds the settings of both tools, so the team does not have to commit .vscode/settings.json.
Put the Runner settings in the runner section, next to setup and run:
{ "$schema": "./node_modules/vscode-extension-tester/resources/extester.schema.json", "setup": { "vscodeVersion": "max", "type": "stable" }, "run": { "mochaConfig": ".mocharc.js" }, "runner": { "testFileGlob": "src/ui-test/**/*.test.ts", "rootFolder": "src", "outputFolder": "out", "ignorePathPart": "src/", "additionalArgs": [] }}The runner section accepts testFileGlob, excludeGlob, ignorePathPart, rootFolder, outputFolder, runSources, additionalArgs, env, preRunTask and runCommand, with the same meaning as the settings in the Configuration section. Unknown properties and invalid values are reported as configuration errors. The $schema reference gives completion and validation for the whole file. The CLI ignores the runner section.
The VS Code version, the release type and the storage folder are not repeated in runner. The Runner reads them from the CLI sections, in the same order as extest setup-and-run:
| Runner setting | Read from |
|---|---|
visualStudioCode.Version |
setup.vscodeVersion, then run.vscodeVersion |
visualStudioCode.Type |
setup.type, then run.type |
tempFolder |
setup.storage, then run.storage |
Relative paths and globs in the file are relative to the folder of the file, as for the CLI. extends works as for the CLI: the Runner merges the base files in the same way. See Using a Config File for the rest of the format.
Settings are resolved per key in this order, from lowest to highest priority:
- the extension’s built-in default,
- your user settings (global, apply to every project),
extester.config.json(shared with the team),- workspace and workspace-folder settings (e.g.
.vscode/settings.json).
The shared file therefore beats personal global defaults, while workspace settings act as a local, per-project override: once .vscode/settings.json is no longer committed, every contributor can use it to adjust a value such as tempFolder or the VS Code version for themselves. When a workspace setting overrides a value from the file, the extension shows a one-time notice that names the setting.
When the VS Code version, type or storage folder comes from the file, the Runner does not pass --code_version, --type or --storage, and the CLI reads the value from the file itself. When a VS Code setting overrides it, the Runner passes the setting, and it wins over the file for that run.
Omitted properties keep the VS Code setting or its default. An empty array replaces the settings array; it does not append to it. Empty strings and false are also explicit values. Projects without extester.config.json keep using VS Code settings.
The extension watches the file and updates test discovery, views and file watchers when it is created, edited or deleted, without reloading VS Code. It does not watch base files that the file extends: after editing one, use Refresh Tests in the Testing view. An invalid file stops the test runs of its workspace folder, so they never run with fallback settings: their tests are marked as errored with the reported error. Fix it to continue. Running all tests still runs the tests of the other workspace folders.
Configuration file in a subfolder
Section titled “Configuration file in a subfolder”By default, the Runner reads extester.config.json in the workspace root, where the CLI finds it too: the Runner starts extest in the workspace root. In a monorepo where the file is in a package folder, point the extesterRunner.configFile setting to it, relative to the workspace root:
{ "extesterRunner.configFile": "packages/ui-tests/extester.config.json"}The Runner then reads that file and passes it to extest setup-and-run with --config. The file must be inside the workspace folder. Do not also put --config in additionalArgs: the Runner reports that as an error. configFile is a VS Code setting only, because it tells the Runner where the file is.
Multi-root workspaces
Section titled “Multi-root workspaces”In a multi-root workspace, each root has its own extester.config.json (or extesterRunner.configFile folder setting). Test discovery and the test runs use the configuration of the root that owns the tests, and run extest in that root. Running all tests runs the tests of each root separately, one root after another, and labels each task with the root name. Nested files are not discovered. The Logs and Screenshots views and their commands keep using the configuration of the first workspace folder.
Migrating from workspace settings
Section titled “Migrating from workspace settings”- Move your shared
extesterRunner.*values into therunnersection ofextester.config.json, without theextesterRunner.prefix. MovevisualStudioCode.Version,visualStudioCode.TypeandtempFoldertosetup.vscodeVersion,setup.typeandsetup.storage. - If
additionalArgscontains--config, setextesterRunner.configFileinstead. - Remove the moved entries from
.vscode/settings.json. Workspace settings take precedence over the file, so entries left behind keep overriding the shared values (the extension points this out with a notice). Then check test discovery and a test run. - If your project no longer needs to track any workspace settings, stop tracking that file and add
.vscode/settings.jsonto.gitignore. Keep other shared.vscodefiles, such as extension recommendations and launch configurations, versioned.
The extension only reads extester.config.json. It does not write or migrate workspace settings.
Initial Setup
Section titled “Initial Setup”The extension provides a built-in walkthrough to help you get started quickly. To open it, run Welcome: Open Walkthrough… from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and pick Get started with ExTester Runner.
The walkthrough has these steps:
- Find Your Tests in the Testing View: where the tests, their
onlyandskiplabels and the Screenshots and Logs views are - Configure Test File Pattern: the pattern that finds your test files (default:
**/ui-test/**/*.test.ts) - Configure Excluded Paths: the paths left out of the search (default:
**/node_modules/**) - Share Settings in extester.config.json (Optional): the
runnersection of the project configuration - Choose Compiled Tests or TypeScript Sources: the Root and Output folders of compiled tests, or Run Sources to run the
.tsfiles (see Running TypeScript Sources) - Build and Set Environment Before Runs (Optional):
preRunTaskandenv - Run Tests and Read the Results: running tests and reading their results, failures and screenshots
- Customize Path Display (Optional): hide a path segment from the folder labels of the test tree
- Additional Arguments (Optional): extra command line arguments for ExTester
- Additional Configuration Options: the remaining ExTester Runner settings
Manual Configuration
Section titled “Manual Configuration”If you prefer to configure the extension manually, you can access all settings through VS Code’s settings panel:
- Open VS Code Settings (Ctrl+, / Cmd+,)
- Search for “ExTester Runner”
- Configure the settings listed in the Configuration section above (prefixed
extesterRunner.*when editingsettings.jsondirectly)
Running a single test
Section titled “Running a single test”Each suite and test has a play button in the Testing view and in the editor gutter. The Runner runs the file and passes the full title of the suite or test to Mocha’s grep option in the MOCHA_GREP environment variable, so only that suite or test runs. Titles with template literal expressions, such as `works on ${platform}`, match any value of the expression.
Mocha interfaces
Section titled “Mocha interfaces”The Runner lists the suites and tests of two of Mocha’s interfaces:
| Interface | Suites | Tests |
|---|---|---|
| BDD (Mocha’s default) | describe, context, xdescribe, xcontext |
it, specify, xit, xspecify |
| TDD | suite |
test |
.only and .skip work in both, and the x functions show as skipped, like .skip.
There is nothing to set in the Runner: it reads the interface from the functions each file calls. Only Mocha’s functions count, the globals that Mocha defines and the functions imported from mocha: a helper function that the file declares or imports from another module does not add suites or tests to the tree, even when it is named like a Mocha function. A file that calls a BDD function is read as BDD. A TDD suite is listed when its callback is written in the call, as in suite('Name', () => { ... }). To run TDD tests, set Mocha’s ui option in your Mocha configuration file, which ExTester passes to Mocha:
{ "ui": "tdd"}ExTester takes a screenshot when a hook fails with Mocha’s TDD hooks, suiteSetup, setup, teardown and suiteTeardown, as with the BDD ones. In ExTester 8.29.0 and older, only the hooks imported from vscode-extension-tester take screenshots, and they fail with ReferenceError: before is not defined under TDD: with these versions, use Mocha’s own TDD hooks, without screenshots of failed hooks.
Tests of the QUnit and exports interfaces still run when you run their file or folder, but the Testing view does not list their tests, so they cannot be run one by one and their results are only in the output.
Build before running and environment variables
Section titled “Build before running and environment variables”Set preRunTask to a VS Code task, as named in Tasks: Run Task, to run it before every test run, for example to compile the tests. The tests start only when the task ends successfully; if it fails or is not found, the tests are marked as errored with the reason. Use a task that ends, not a background (watch) task.
Set env to pass environment variables to the tests, for example account names or feature flags. Only the variable names are written to the ExTester Runner log.
{ "runner": { "preRunTask": "npm: compile", "env": { "TEST_USER": "tester" } }}Running tests with a hidden window
Section titled “Running tests with a hidden window”Turn on hiddenWindow to keep the test VS Code window off your screen, so you can keep working while the tests run. The Runner then sets EXTESTER_HIDDEN_WINDOW=true for the run, for npx extest setup-and-run and for a custom runCommand alike. A value of EXTESTER_HIDDEN_WINDOW in env wins over the setting. To turn it on for the whole team, set run.hiddenWindow in the run section of extester.config.json instead; the CLI reads it there.
It needs an ExTester release with the hidden window mode and VS Code 1.147 or newer. VS Code runs in extension test mode, so dialogs are not shown and UI state is not kept between runs. The hidden window guide lists every difference. On Linux, virtualDisplay keeps the window off your screen without these differences.
Custom run command
Section titled “Custom run command”By default the Runner runs npx extest setup-and-run <target> with the arguments from its settings. Set runCommand to run your own command instead, for example an npm script that also starts a mock server, or extest run-tests when VS Code and ChromeDriver are already set up:
{ "runner": { "runCommand": "npm run ui-test -- ${target}" }}${target}is replaced by the quoted path or glob of the tests to run: the test file, a glob of the files in a folder, or a glob of all test files. If the command has no${target}, the target is appended at the end.- The command runs in the workspace folder and gets the
envvariables and, when a single test ordescribeblock runs,MOCHA_GREP.preRunTaskstill runs first. - The VS Code version, type, temp folder,
additionalArgsandconfigFileare not added to the command. Put the options it needs in the command itself. - The Testing view still shows the result of each test when the command keeps the environment variables (
NODE_OPTIONSloads the result hook) for the Node.js process that runs Mocha, as npm scripts and shell scripts do. A command that drops them, such asdocker runwithout-e, still runs the tests, but they show as skipped and the results are only in the output.
Running Tests on a Virtual Display
Section titled “Running Tests on a Virtual Display”Set virtualDisplay to run the tests on a virtual X display instead of your screen. The VS Code window under test then does not cover your editor or take the keyboard focus, so you can keep working while the tests run:
{ "extesterRunner.virtualDisplay": true }- Linux only. The Runner starts
Xvfbon the first run, keeps it for the next runs and stops it when VS Code closes or the setting is turned off. Install it first, for examplesudo apt install xvfb(Debian, Ubuntu) orsudo dnf install xorg-x11-server-Xvfb(Fedora). If it cannot start, the run reports why in the Testing view. VS Code installed as a Flatpak or Snap cannot see the host’s Xvfb, so the Runner reports it as missing there. - Like
xvfb-run, the Runner gives Xvfb a random cookie and passes it to the tests throughXAUTHORITY, so other users of the machine cannot connect to the display. virtualDisplayScreensets the screen size (default1920x1080x24), which is also the largest size of the window and its screenshots.- In a Wayland session (
WAYLAND_DISPLAYset orXDG_SESSION_TYPE=wayland) the test command runs withoutWAYLAND_DISPLAY, so VS Code uses the X display. The command still runs in the shell VS Code runs tasks in. - It works with
runCommandtoo. Do not wrap that command inxvfb-runthen. - A
DISPLAYinenvwins over the virtual display: the Runner then starts no Xvfb and runs the tests on that display. Use it to watch a run on a display you can see, such as an Xephyr or VNC server, for example{ "DISPLAY": ":1" }. - These are VS Code settings, not
runnerkeys ofextester.config.json: whether the window may appear is your choice, not the project’s. - On macOS and Windows there is no Xvfb, and the setting is ignored with a warning. Use the experimental
hiddenWindowsetting there instead. On Linux prefervirtualDisplay: it keeps VS Code in its normal mode, while a hidden window runs in extension test mode and can start slowly under X11.
Running TypeScript Sources
Section titled “Running TypeScript Sources”By default, ExTester Runner runs the compiled JavaScript tests. It maps the selected file or folder from rootFolder to outputFolder. For example, with rootFolder set to src, src/ui-test/a.test.ts runs as out/ui-test/a.test.js. You have to compile the tests before each run.
ExTester 8.29.0 and later can load TypeScript tests with tsx. To run the test sources without compiling them, enable runSources:
{ "runner": { "testFileGlob": "packages/ui-tests/src/**/*.test.ts", "runSources": true }}The example uses the runner section of extester.config.json (see Project configuration); the extesterRunner.testFileGlob and extesterRunner.runSources settings work the same way. Runs then pass the sources to extest setup-and-run as they are and ignore rootFolder and outputFolder:
| Running | Passes | Example |
|---|---|---|
| A file | The file | packages/ui-tests/src/editor/Flow.test.ts |
| A folder | The matching files directly in the folder | packages/ui-tests/src/editor/*.test.ts |
| All tests | The matching files below the deepest folder that contains all tests | packages/ui-tests/src/**/*.test.ts |
The file pattern is the last segment of testFileGlob. The Runner passes absolute paths; the examples are relative to the workspace folder.
Requirements:
vscode-extension-tester8.29.0 or later.tsxthat resolves from the workspace folder of the tests. The Runner startsextestin that folder, and ExTester resolvestsxfrom its working directory. In a monorepo, installtsxin the repository root, or let the package manager hoist it there.
The Runner does not check for tsx itself. If it is missing, ExTester reports it with install instructions before it downloads VS Code.
tsx does not type-check the tests, so keep a separate type check. The extension under test still has to be built as usual. See Type checking and extension builds.
