CLI
Команда testplane
Основная команда для запуска тестов.
> testplane --help
Usage: testplane [options] [command] [paths...]
Run tests
Options:
-V, --version output the version number
-c, --config <path> path to configuration file
-b, --browser <browser> run tests only in specified browser
-s, --set <set> run tests only in the specified set
-r, --require <module> require module
--grep <grep> run only tests matching the pattern
--tag <tag> run only tests with specified tags
--reporter <name> test reporters
--update-refs update screenshot references or gather them if they do not exist ("assertView" command)
--inspect [inspect] nodejs inspector on [=[host:]port]
--inspect-brk [inspect-brk] nodejs inspector with break at the start
--repl [type] run one test, call `browser.switchToRepl` in test code to open repl interface (default: false)
--repl-before-test [type] open repl interface before test run (default: false)
--repl-on-fail [type] open repl interface on test fail only (default: false)
--devtools switches the browser to the devtools mode with using CDP protocol
--local use automatically downloaded browsers and drivers, provided by Testplane
--keep-browser do not close browser session after test completion
--keep-browser-on-fail do not close browser session when test fails
-h, --help output usage information
Например,
npx testplane --config ./config.js --reporter flat --browser firefox --grep name
Опции
Version
Вывести текущую версию testplane.
testplane --version
Config
Использовать пользовательский файл конфигурации.
testplane --config ./local.testplane.config.ts
Browser
Запускать тесты только в указанном браузере.
testplane --browser chrome
Set
Запускать тесты только в указанном наборе.
testplane --set desktop
Require
Загрузить внешние модули, локально существующие на вашей машине, перед запуском testplane. Это полезно для загрузчиков, таких как ECMAScript модули через esm.
testplane --require ./tsconfig-register-paths.js
Reporter
Может использоваться для установки одного из следующих репортеров:
flat- вся информация о неудачных и повторно выполненных тестах будет сгруппирована по браузерам в конце отчета;plain- информация о сбоях и повторениях будет размещена после каждого теста;jsonl- отображает подробную информацию о каждом результате теста в формате jsonl.
По умолчанию используется flat.
Информация о результатах тестов выводится в командную строку по умолчанию. Но есть возможность перенаправить вывод в файл:
testplane --reporter '{"type": "jsonl", "path": "./some-path/result.jsonl"}'
Вы также можете указать несколько репортеров:
testplane --reporter '{"type": "jsonl", "path": "./some-path/result.jsonl"}' --reporter flat
Помимо этих терминальных репортеров, вы можете использовать плагин html-reporter, чтобы генерировать HTML-отчеты.
Grep
Запускать только тесты, полное название которых совпадает с шаблоном.
Пример
Если у вас есть некоторые тесты:
describe("test", () => {
describe("with", () => {
describe("nested path", () => {
...
});
describe("other path", () => {
...
})
});
});
Вы можете запустить тесты внутри "nested path" набора, не запуская тесты внутри "other path" набора, с любым из этих вариантов:
testplane --grep "nested path"
testplane --grep "with nested path"
testplane --grep "test with nested path"
Tag
Доступно начиная с testplane v8.37.0
Запуск только тестов, соответствующих паттерну.