Skip to content

Commit e19b80a

Browse files
polok“Marcin
andauthored
test: give ability to run tests against a single feature (#88)
* test: give ability to run tests against a single feature * Add information about new test option '--feature' to run tests against single feature --------- Co-authored-by: “Marcin <“[email protected]”>
1 parent 0cea912 commit e19b80a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,16 @@ $ swift run featurevisor test .
374374

375375
If you are interested to see only the test specs that fail:
376376

377+
```bash
378+
'--feature feature_key_xxx'
379+
```
380+
381+
Only if you are interested to run tests only for specific feature:
382+
377383
Example command:
378384

379385
```
380-
$ swift run featurevisor test --only-failures .
386+
$ swift run featurevisor test --only-failures --feature feature_key_xxx .
381387
```
382388

383389
### Benchmarking

Sources/Featurevisor/Featurevisor.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ extension Featurevisor {
165165
@Argument(help: "The path to features test directory.")
166166
var featuresTestDirectoryPath: String
167167

168+
@Option(
169+
help:
170+
"The option is used to specify the feature key which will be used for testing."
171+
)
172+
var feature: String?
173+
168174
@Flag(help: "If you are interested to see only the test specs that fail.")
169175
var onlyFailures = false
170176

@@ -176,10 +182,14 @@ extension Featurevisor {
176182
// TODO: Handle better, react on errors etc.
177183
Commands.Task.run("bash -c cd \(featuresTestDirectoryPath) && npx featurevisor build")
178184

179-
let testSuits = try loadAllFeatureTestSuits(
185+
var testSuits = try loadAllFeatureTestSuits(
180186
featuresTestDirectoryPath: featuresTestDirectoryPath
181187
)
182188

189+
if let feature {
190+
testSuits = testSuits.filter { $0.feature == feature }
191+
}
192+
183193
let features = try loadAllFeatures(featuresTestDirectoryPath: featuresTestDirectoryPath)
184194

185195
var totalTestSpecs = 0

0 commit comments

Comments
 (0)