Command line
Introduction
CSTesting provides a command line interface for running tests, scaffolding a project, and running config-driven flows. Use the cstesting command (or the short alias cst). There are no optional flags (such as --headed or --grep); you control what runs by passing a file path, directory, or pattern.
Invocation
npx cstesting [command-or-pattern]
npx cst [command-or-pattern]
If you install CSTesting globally, you can run cstesting or cst without npx.
Essential commands
Run tests
Run test files. Discovered files must match one of: *.test.js, *.spec.js, *.test.ts, *.spec.ts. Tests run in headless mode by default (no visible browser). To see the browser, set headless: false in your test code or use a config file with headed=true.
Syntax
npx cstesting [pattern]
- No argument — Uses default pattern
**/*.test.jsin the current directory (and subdirectories, excludingnode_modulesanddist). - Pattern — A file path, directory path, or glob. Only matching test files are run.
Examples
# Run all tests (default: **/*.test.js)
npx cstesting
# Run a single test file
npx cstesting tests/example.test.js
npx cstesting tests/landing-page.spec.ts
# Run all tests in a directory (and subdirectories)
npx cstesting tests/
npx cstesting tests/todo-page/
npx cstesting tests/landing-page/
# Run tests matching a glob
npx cstesting "**/*.test.js"
npx cstesting "**/login*.test.js"
# Run only tests that have a given tag (tag-based running)
npx cstesting --tag smoke
npx cstesting --tag smoke,regression tests/
npx cstesting -t login example/browser1.test.js
See Tags for how to tag tests and suites and use --tag / -t.
Test files are run one file after another (sequential). After the run, a summary is printed (Passed, Failed, Skipped, Total, duration) and the path to the HTML report is shown (e.g. report/report.html).
Discovered file types
| Extension | Discovered |
|---|---|
.test.js | Yes |
.spec.js | Yes |
.test.ts | Yes (requires ts-node in project) |
.spec.ts | Yes (requires ts-node in project) |
Scaffold (init)
Create the Page Object Model structure: pages/ and tests/ folders with sample HomePage.js and home.test.js. Does not overwrite existing files.
Syntax
npx cstesting init
npx cst init
Example
npx cstesting init
Output: lists created files and reminds you to run npx cstesting tests/.
Run config file
Run a config-driven flow from a .conf or .config file (no test code). See Config-driven tests.
Syntax
npx cstesting run <config-file>
npx cstesting <config-file>
Examples
# Using the run subcommand
npx cstesting run login.conf
npx cstesting run path/to/demo.config
# Or pass the config file directly (only for .conf / .config extension)
npx cstesting login.conf
The CLI looks for the file in the current directory (or the given path). After the run, the summary and report path are printed.
Output and report
- Terminal — For each test file, the relative path is printed. Failed tests show suite name, test name, and error. At the end:
Passed: X Failed: Y Skipped: Z Total: N (duration ms)andReport: <path>. - HTML report — Written to
report/report.html(relative to current working directory). The report is not opened automatically. Open it manually (e.g.start report\report.htmlon Windows,open report/report.htmlon macOS). - Exit code — Process exits with code
1if any test failed or if a config run had failures; otherwise0.
There is no show-report command. Open the report file in your browser yourself.
What is not supported (current version)
The following CLI features from other tools are not implemented in CSTesting. Use the workarounds where applicable.
| Feature | Supported? | Workaround |
|---|---|---|
| Run tests (file, dir, pattern) | Yes | — |
| init (scaffold) | Yes | — |
| run config file | Yes | — |
| --help | No | See this doc or README. |
| --headed | No | Set headless: false in code or use headed=true in a .conf file. |
| --grep / -g (filter by test title) | No | Filter by file path or directory: run specific files or folders. |
| --workers / -j (parallel workers) | No | Tests run sequentially per file. |
| --debug | No | Use Node/IDE debugger; run with headless: false to watch the browser. |
| --ui (interactive UI mode) | No | Not available. |
| --project (browser/project) | No | CSTesting uses a single browser (Chrome/Chromium). |
| --timeout | No | No per-run or per-test timeout flag. |
| --max-failures / -x | No | All test files run; no "stop after N failures" option. |
| --last-failed | No | Re-run failed tests manually by path if needed. |
| --list (list tests without running) | No | Not available. |
| show-report (open HTML report) | No | Open report/report.html manually. |
| install (browsers) | No | CSTesting uses system Chrome/Chromium; no browser install command. |
| codegen (record and generate tests) | No | Not available. |
| show-trace / trace viewer | No | Not available. |
| merge-reports | No | Not available. |
| clear-cache | No | Not available. |
| Config file (-c / --config) | No | No global config file; options are per call in code or in .conf for config-driven runs. |
Run test at line (e.g. file.spec.ts:42) | No | Pass the whole file path only. |
| Test list file (--test-list) | No | Not available. |
Summary
| Command | Description |
|---|---|
npx cstesting | Run all tests (default pattern **/*.test.js). |
npx cstesting <path> | Run tests: path can be a file, directory, or glob (e.g. tests/, tests/a.test.js, **/*.test.js). |
npx cstesting init | Scaffold pages/ and tests/ with sample POM files. |
npx cstesting run <config> | Run a config-driven flow (e.g. login.conf). |
npx cstesting <file.conf> | Same as run when the argument has extension .conf or .config. |
Alias: npx cst is the same as npx cstesting.
No other subcommands or flags exist. For the latest behavior, run the CLI and refer to this document or the project README.