testplane
testplane copied to clipboard
feat: implement new cli command to read tests
What is done
Implement ability to read tests using cli command npx testplane list-tests
which support options like for run tests:
- --config;
- --browser;
- --set;
- --require;
- --grep; and new options:
- --ignore;
- --silent;
- --output-file;
- --formatter.
The formatter supports 2 values: list (default) and tree. When using list
user get plain list of unique tests, example:
[
{
"id": "5a105e8",
"titlePath": [
"test1"
],
"browserIds": [
"yandex",
"chrome"
],
"file": "tests/second.hermione.js"
},
{
"id": "d2b3179",
"titlePath": [
"suite",
"test2"
],
"browserIds": [
"yandex",
"chrome"
],
"file": "tests/second.hermione.js"
}
]
The same data in tree
formatter looks like:
[
{
"id": "36749990",
"title": "suite",
"line": 3,
"column": 1,
"file": "example.hermione.js",
"suites": [],
"tests": [
{
"id": "d2b3179",
"title": "test2",
"line": 4,
"column": 5,
"browserIds": [
"yandex"
]
}
]
},
{
"id": "5a105e8",
"title": "test1",
"line": 1,
"column": 1,
"browserIds": [
"yandex"
],
"file": "example.hermione.js"
}
]
the important difference is that the tree
formatter supports line
and column
fields. They can be used to find out exactly where the suite or test is declared in the file. It will be used in vscode extension.