Перейти к содержимому

CLI

CLI — npm-пакет tsmc-cli (npx tsmc-cli …); в репозитории TSMC — pnpm tsmc …, в Docker-образе — tsmc …. Как он встраивается в CI — Результаты автотестов; кейсы в git — Кейсы как код.

Вывод tsmc --help (справка на английском):

tsmc — command line client for TSMC
Usage:
tsmc pull [--dir DIR] [--project KEY] [--force] [--prune]
tsmc push [--dir DIR] [--project KEY] [--dry-run] [--delete-missing]
tsmc junit upload <report.xml...> --project KEY (--run-name NAME | --run-id ID) [options]
tsmc impact [--base REF] [--files a,b] [--create-run NAME] [options]
Impact analysis (run in the product's git repository):
impact List cases affected by the changes of this branch, ranked, with reasons.
Cases are matched by "paths" globs on cases and suites, and by changed
automated test files.
--base Compare HEAD with this ref (default origin/main)
--uncommitted Also count uncommitted and untracked files
--files Comma-separated changed files instead of asking git
--drafts Include draft cases
--create-run NAME Create a run with the affected cases (--build, --env apply)
--limit N Cases to print (default 30)
--json Print the raw result
Cases as code:
pull Write the project's cases to DIR as Markdown files, one folder per suite.
Files edited locally are kept; if the server changed them too, the server
copy is written next to them as <file>.server to merge by hand.
push Send the files to the server as one atomic change. New files get an id,
edited files a new version. Conflicts reject the whole push.
--dir, -d Folder with case files (default: current folder)
--force pull: overwrite local edits and delete files of deleted cases
--prune pull: delete files of cases deleted on the server
--dry-run push: show what would change without changing anything
--delete-missing push: delete cases of the project that have no file
The project key is remembered in DIR/.tsmc.json after the first pull or push.
JUnit upload:
--project, -p Project key, e.g. SHOP
--run-name, -r Create a new run with this name
--run-id Append to an existing open run
--build, -b Build / version label of the new run
--env, -e Environment label of the new run
--create-missing Create cases for tests that match no case
--suite Suite for created cases (default "Автотесты")
--close Close the run after uploading
--no-attachments Skip files the report refers to ([[ATTACHMENT|path]] in test output)
--fail-on-failed Exit with code 2 if any case failed
Tests are matched to cases by the case's automation key ("classname.name")
or by a case key in the test name, e.g. "test_refund [SHOP-12]".
Other:
--version, -v Print the CLI version and the server API it speaks
Installed from npm as "tsmc-cli": npx tsmc-cli …, or npm i -g tsmc-cli (then "tsmc …").
Environment:
TSMC_LANG Language of server messages: ru or en (default: from LANG or the system)
TSMC_URL Server address (default http://127.0.0.1:3000)
TSMC_TOKEN Project API token (Project → Settings)