UTest for VS Code
Adds Run actions above UTest(...), UTest.create(...), and each test or group in *.spec.ts files.
// Run → npx atma test <current-file>
UTest({
// Run → npx atma test <current-file> -q "should return a result"
async 'should return a result'() {
// Your test
}
});
Commands run in VS Code's integrated task terminal. The current file is saved before running. Node.js and npx must be available on PATH, and the project must already be configured to run tests with Atma/UTest.
The working directory is the workspace folder containing the test (including multi-root workspaces). Test paths are relative to this directory, with a ./ prefix and forward slashes, for example npx atma test ./test/rpc/RpcTimeout.spec.ts. Open the project's root folder so Atma can resolve its configuration. For a file opened without a workspace, the extension uses the nearest parent containing package.json, or the file's directory if none exists.
Supported tests
UTest({ ... }), its alias UTest.create({ ... }), new UTest({ ... }), and named definitions such as UTest('name', { ... }).
- Quoted or identifier method names, including async methods, function properties, and arrow functions.
- Nested object groups and their tests.
- Literal computed names such as
['my test'].
UTest hooks ($before, $after, $setup, $teardown) and $config do not receive actions. Definitions are parsed as TypeScript; comments and unrelated object methods are ignored. Test objects supplied through variables, spreads, and dynamically computed names are not resolved. A file action still appears for UTest(tests).
Suite actions pass the name unchanged to -q. UTest interprets this value as a regular expression, so regex characters retain their meaning and duplicate or matching names can select multiple tests. Nested actions pass the member's own name, without adding a group prefix. The action above any UTest call runs the entire file.
If actions are missing, check that the file ends in .spec.ts, the language mode is TypeScript, and editor.codeLens is enabled. The extension requires a trusted local or remote filesystem workspace; virtual workspaces are not supported.
Development
Use Node.js 22 or newer for the development and packaging tools.
npm install
npm test
Press F5 to launch an Extension Development Host. Open a UTest project there, open a .spec.ts file, and click the actions. Check both a file action and a suite action, including a project path containing spaces. Terminal output shows the executed command and test results.
Package and install locally
npm run package
code --install-extension atma-utest-vscode-0.1.1.vsix
You can also use Extensions: Install from VSIX... in VS Code. The package includes the TypeScript parser as a runtime dependency.
Publish
- Create a publisher on the Visual Studio Marketplace management page.
- Set the release version in
package.json, run npm install to synchronize the lockfile, then run npm test and npm run package.
- In the Marketplace management page, select your publisher, choose New extension → Visual Studio Code, and upload the generated
.vsix. For later releases, increment the version and upload the new package to the existing extension.
For CLI or automated publishing, configure authentication according to the official publishing guide, then use npx vsce publish. The guide also covers Microsoft Entra ID authentication for CI. Packaging locally does not publish anything.