@toa.io/cli 0.7.3 → 0.8.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/readme.md +7 -3
- package/src/commands/replay.js +24 -0
- package/src/handlers/replay.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-dev.0",
|
|
4
4
|
"description": "Toa CLI",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"find-up": "5.0.0",
|
|
32
32
|
"yargs": "17.6.2"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "c1fcff1dfbd211ed631d2f521a51bc1584af4b8c"
|
|
35
35
|
}
|
package/readme.md
CHANGED
|
@@ -48,6 +48,12 @@ format.
|
|
|
48
48
|
<dt><code>toa replay [paths...]</code></dt>
|
|
49
49
|
<dd>
|
|
50
50
|
<code>paths</code> path(s) to component(s) or a context (default <code>.</code>)<br/>
|
|
51
|
+
<code>--integration</code> replay integration tests only<br/>
|
|
52
|
+
<code>--component <id></code> replay samples for specified component id<br/>
|
|
53
|
+
<code>--operation <pattern></code> replay samples for specified operation<br/>
|
|
54
|
+
<code>--title <regexp></code> regexp to match sample titles<br/>
|
|
55
|
+
</dd>
|
|
56
|
+
</dl>
|
|
51
57
|
|
|
52
58
|
#### Examples
|
|
53
59
|
|
|
@@ -57,14 +63,12 @@ $ toa replay ./path/to/component
|
|
|
57
63
|
$ toa replay ./components/a ./components/b
|
|
58
64
|
$ toa replay ./components/*
|
|
59
65
|
$ toa replay ./path/to/context
|
|
66
|
+
$ toa replay --title "should add numbers"
|
|
60
67
|
```
|
|
61
68
|
|
|
62
69
|
If path is a context directory (containing `context.toa.yaml` file), samples for components within
|
|
63
70
|
the context will be found and replayed sequentially.
|
|
64
71
|
|
|
65
|
-
</dd>
|
|
66
|
-
</dl>
|
|
67
|
-
|
|
68
72
|
## Exporting
|
|
69
73
|
|
|
70
74
|
### export manifest
|
package/src/commands/replay.js
CHANGED
|
@@ -11,6 +11,30 @@ const builder = (yargs) => {
|
|
|
11
11
|
desc: 'Paths to components or context',
|
|
12
12
|
default: '.'
|
|
13
13
|
})
|
|
14
|
+
.option('component', {
|
|
15
|
+
alias: 'c',
|
|
16
|
+
type: 'string',
|
|
17
|
+
group: 'Command options:',
|
|
18
|
+
describe: 'Replay samples for specified component'
|
|
19
|
+
})
|
|
20
|
+
.option('integration', {
|
|
21
|
+
alias: 'i',
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
group: 'Command options:',
|
|
24
|
+
describe: 'Replay integration tests only'
|
|
25
|
+
})
|
|
26
|
+
.option('operation', {
|
|
27
|
+
alias: 'o',
|
|
28
|
+
type: 'string',
|
|
29
|
+
group: 'Command options:',
|
|
30
|
+
describe: 'Replay samples for specified operation'
|
|
31
|
+
})
|
|
32
|
+
.option('title', {
|
|
33
|
+
alias: 't',
|
|
34
|
+
type: 'string',
|
|
35
|
+
group: 'Command options:',
|
|
36
|
+
describe: 'Replay samples with titles matching given regexp'
|
|
37
|
+
})
|
|
14
38
|
}
|
|
15
39
|
|
|
16
40
|
exports.command = 'replay [paths...]'
|
package/src/handlers/replay.js
CHANGED
|
@@ -11,15 +11,23 @@ async function replay (argv) {
|
|
|
11
11
|
|
|
12
12
|
const paths = find.components(argv.paths, true)
|
|
13
13
|
|
|
14
|
+
/** @type {toa.samples.suite.Options} */
|
|
15
|
+
const options = {
|
|
16
|
+
component: argv.component,
|
|
17
|
+
integration: argv.integration,
|
|
18
|
+
operation: argv.operation,
|
|
19
|
+
title: argv.title
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
if (paths !== null) {
|
|
15
|
-
ok = await components(paths)
|
|
23
|
+
ok = await components(paths, options)
|
|
16
24
|
} else {
|
|
17
25
|
// no components found, checking context
|
|
18
26
|
const path = find.context(argv.paths[0], true)
|
|
19
27
|
|
|
20
28
|
if (path === null) throw new Error('Neither components nor context found in ' + argv.paths.join(','))
|
|
21
29
|
|
|
22
|
-
ok = await context(path)
|
|
30
|
+
ok = await context(path, options)
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
const message = (ok ? GREEN + 'PASSED' : RED + 'FAILED') + RESET
|