@featurevisor/core 2.26.1 → 3.0.1
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/CHANGELOG.md +8 -0
- package/coverage/clover.xml +4991 -3130
- package/coverage/coverage-final.json +63 -39
- package/coverage/lcov-report/block-navigation.js +1 -1
- package/coverage/lcov-report/index.html +248 -98
- package/coverage/lcov-report/sorter.js +21 -7
- package/coverage/lcov-report/src/assess-distribution/index.html +116 -0
- package/coverage/lcov-report/src/assess-distribution/index.ts.html +754 -0
- package/coverage/lcov-report/{list → src/benchmark}/index.html +30 -30
- package/coverage/lcov-report/src/benchmark/index.ts.html +793 -0
- package/coverage/lcov-report/{builder → src/builder}/allocator.ts.html +38 -38
- package/coverage/lcov-report/{builder/buildScopedConditions.ts.html → src/builder/applyContextToConditions.ts.html} +80 -65
- package/coverage/lcov-report/{builder/buildScopedDatafile.ts.html → src/builder/applyContextToDatafile.ts.html} +92 -92
- package/coverage/lcov-report/{builder/buildScopedSegments.ts.html → src/builder/applyContextToSegments.ts.html} +103 -67
- package/coverage/lcov-report/{builder → src/builder}/buildDatafile.ts.html +336 -306
- package/coverage/lcov-report/src/builder/buildProject.ts.html +1117 -0
- package/coverage/lcov-report/src/builder/buildRuntimeDatafiles.ts.html +256 -0
- package/coverage/lcov-report/{builder → src/builder}/getFeatureRanges.ts.html +22 -22
- package/coverage/lcov-report/{builder → src/builder}/hashes.ts.html +50 -50
- package/coverage/lcov-report/{builder → src/builder}/index.html +114 -84
- package/coverage/lcov-report/{tester/cliFormat.ts.html → src/builder/index.ts.html} +17 -29
- package/coverage/lcov-report/{builder → src/builder}/mutateVariables.ts.html +55 -55
- package/coverage/lcov-report/{builder → src/builder}/mutator.ts.html +118 -118
- package/coverage/lcov-report/{builder → src/builder}/revision.ts.html +15 -15
- package/coverage/lcov-report/{builder → src/builder}/traffic.ts.html +86 -86
- package/coverage/lcov-report/src/cli/cli.ts.html +400 -0
- package/coverage/lcov-report/{tester → src/cli}/index.html +41 -41
- package/coverage/lcov-report/src/cli/plugins.ts.html +214 -0
- package/coverage/lcov-report/{config → src/config}/index.html +31 -31
- package/coverage/lcov-report/{config → src/config}/index.ts.html +12 -12
- package/coverage/lcov-report/{config → src/config}/projectConfig.ts.html +312 -96
- package/coverage/lcov-report/{datasource → src/datasource}/adapter.ts.html +28 -73
- package/coverage/lcov-report/{datasource → src/datasource}/datasource.ts.html +191 -104
- package/coverage/lcov-report/{datasource → src/datasource}/filesystemAdapter.ts.html +233 -635
- package/coverage/lcov-report/{datasource → src/datasource}/index.html +48 -48
- package/coverage/lcov-report/{datasource → src/datasource}/index.ts.html +14 -14
- package/coverage/lcov-report/src/evaluate/index.html +116 -0
- package/coverage/lcov-report/src/evaluate/index.ts.html +814 -0
- package/coverage/lcov-report/src/find-duplicate-segments/findDuplicateSegments.ts.html +313 -0
- package/coverage/lcov-report/src/find-duplicate-segments/index.html +131 -0
- package/coverage/lcov-report/src/find-duplicate-segments/index.ts.html +307 -0
- package/coverage/lcov-report/src/find-usage/index.html +116 -0
- package/coverage/lcov-report/src/find-usage/index.ts.html +1780 -0
- package/coverage/lcov-report/src/generate-code/index.html +131 -0
- package/coverage/lcov-report/src/generate-code/index.ts.html +403 -0
- package/coverage/lcov-report/{generate-code → src/generate-code}/typescript.ts.html +266 -1361
- package/coverage/lcov-report/{generate-code → src}/index.html +38 -23
- package/coverage/lcov-report/src/info/index.html +116 -0
- package/coverage/lcov-report/src/info/index.ts.html +472 -0
- package/coverage/lcov-report/src/init/index.html +116 -0
- package/coverage/lcov-report/src/init/index.ts.html +280 -0
- package/coverage/lcov-report/{linter → src/linter}/attributeSchema.ts.html +160 -157
- package/coverage/lcov-report/{linter → src/linter}/checkCircularDependency.ts.html +25 -25
- package/coverage/lcov-report/{linter → src/linter}/checkPercentageExceedingSlot.ts.html +42 -42
- package/coverage/lcov-report/{linter → src/linter}/conditionSchema.ts.html +207 -207
- package/coverage/lcov-report/{linter → src/linter}/featureSchema.ts.html +462 -471
- package/coverage/lcov-report/{linter → src/linter}/groupSchema.ts.html +25 -22
- package/coverage/lcov-report/{linter → src/linter}/index.html +129 -99
- package/coverage/lcov-report/src/linter/index.ts.html +88 -0
- package/coverage/lcov-report/{linter → src/linter}/lintProject.ts.html +740 -332
- package/coverage/lcov-report/{linter → src/linter}/mutationNotation.ts.html +130 -130
- package/coverage/lcov-report/{linter → src/linter}/printError.ts.html +27 -27
- package/coverage/lcov-report/{linter → src/linter}/schema.ts.html +153 -150
- package/coverage/lcov-report/{linter → src/linter}/segmentSchema.ts.html +18 -15
- package/coverage/lcov-report/src/linter/targetSchema.ts.html +223 -0
- package/coverage/lcov-report/{linter → src/linter}/testSchema.ts.html +54 -48
- package/coverage/lcov-report/{linter → src/linter}/zodHelpers.ts.html +17 -17
- package/coverage/lcov-report/src/list/index.html +131 -0
- package/coverage/lcov-report/src/list/index.ts.html +2065 -0
- package/coverage/lcov-report/{list → src/list}/matrix.ts.html +43 -58
- package/coverage/lcov-report/src/promoter/index.html +116 -0
- package/coverage/lcov-report/src/promoter/index.ts.html +3883 -0
- package/coverage/lcov-report/src/sets.ts.html +313 -0
- package/coverage/lcov-report/src/targeting.ts.html +403 -0
- package/coverage/lcov-report/src/tester/cliFormat.ts.html +133 -0
- package/coverage/lcov-report/{tester → src/tester}/helpers.ts.html +15 -15
- package/coverage/lcov-report/src/tester/index.html +206 -0
- package/coverage/lcov-report/src/tester/prettyDuration.ts.html +187 -0
- package/coverage/lcov-report/src/tester/printTestResult.ts.html +337 -0
- package/coverage/lcov-report/src/tester/testFeature.ts.html +1186 -0
- package/coverage/lcov-report/src/tester/testProject.ts.html +1018 -0
- package/coverage/lcov-report/src/tester/testSegment.ts.html +316 -0
- package/coverage/lcov-report/{utils → src/utils}/extractKeys.ts.html +68 -68
- package/coverage/lcov-report/{utils → src/utils}/git.ts.html +44 -68
- package/coverage/lcov-report/{utils → src/utils}/index.html +44 -44
- package/coverage/lcov-report/{utils → src/utils}/index.ts.html +14 -14
- package/coverage/lcov-report/{utils → src/utils}/pretty.ts.html +20 -20
- package/coverage/lcov.info +10121 -5723
- package/jest.config.js +13 -4
- package/lib/assess-distribution/index.d.ts +1 -1
- package/lib/assess-distribution/index.js +59 -40
- package/lib/assess-distribution/index.js.map +1 -1
- package/lib/benchmark/index.d.ts +8 -5
- package/lib/benchmark/index.js +82 -65
- package/lib/benchmark/index.js.map +1 -1
- package/lib/builder/applyContextToConditions.d.ts +5 -0
- package/lib/builder/{buildScopedConditions.js → applyContextToConditions.js} +19 -14
- package/lib/builder/applyContextToConditions.js.map +1 -0
- package/lib/builder/applyContextToDatafile.d.ts +2 -0
- package/lib/builder/{buildScopedDatafile.js → applyContextToDatafile.js} +26 -26
- package/lib/builder/applyContextToDatafile.js.map +1 -0
- package/lib/builder/applyContextToSegments.d.ts +5 -0
- package/lib/builder/{buildScopedSegments.js → applyContextToSegments.js} +19 -14
- package/lib/builder/applyContextToSegments.js.map +1 -0
- package/lib/builder/buildDatafile.d.ts +9 -6
- package/lib/builder/buildDatafile.js +86 -51
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +17 -3
- package/lib/builder/buildProject.js +151 -59
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/buildRuntimeDatafiles.d.ts +12 -0
- package/lib/builder/buildRuntimeDatafiles.js +35 -0
- package/lib/builder/buildRuntimeDatafiles.js.map +1 -0
- package/lib/builder/getFeatureRanges.js +34 -1
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/builder/hashes.js +34 -1
- package/lib/builder/hashes.js.map +1 -1
- package/lib/builder/index.d.ts +0 -1
- package/lib/builder/index.js +0 -1
- package/lib/builder/index.js.map +1 -1
- package/lib/cli/cli.js +0 -4
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/plugins.js +7 -2
- package/lib/cli/plugins.js.map +1 -1
- package/lib/config/projectConfig.d.ts +17 -17
- package/lib/config/projectConfig.js +101 -15
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/datasource/adapter.d.ts +7 -9
- package/lib/datasource/adapter.js +0 -7
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +15 -5
- package/lib/datasource/datasource.js +37 -9
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +4 -10
- package/lib/datasource/filesystemAdapter.js +111 -149
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/evaluate/index.d.ts +1 -7
- package/lib/evaluate/index.js +81 -67
- package/lib/evaluate/index.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +34 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.js +21 -13
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/find-usage/index.js +57 -41
- package/lib/find-usage/index.js.map +1 -1
- package/lib/generate-code/index.d.ts +1 -1
- package/lib/generate-code/index.js +64 -21
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.d.ts +1 -1
- package/lib/generate-code/typescript.js +59 -333
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/info/index.js +57 -16
- package/lib/info/index.js.map +1 -1
- package/lib/init/index.d.ts +2 -2
- package/lib/init/index.js +39 -3
- package/lib/init/index.js.map +1 -1
- package/lib/linter/attributeSchema.d.ts +1 -0
- package/lib/linter/attributeSchema.js +1 -0
- package/lib/linter/attributeSchema.js.map +1 -1
- package/lib/linter/conditionSchema.js +5 -5
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +4 -1
- package/lib/linter/featureSchema.js +15 -13
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/groupSchema.d.ts +1 -0
- package/lib/linter/groupSchema.js +1 -0
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.d.ts +1 -3
- package/lib/linter/lintProject.js +198 -68
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/schema.js +1 -0
- package/lib/linter/schema.js.map +1 -1
- package/lib/linter/segmentSchema.d.ts +1 -0
- package/lib/linter/segmentSchema.js +1 -0
- package/lib/linter/segmentSchema.js.map +1 -1
- package/lib/linter/targetSchema.d.ts +16 -0
- package/lib/linter/targetSchema.js +40 -0
- package/lib/linter/targetSchema.js.map +1 -0
- package/lib/linter/testSchema.d.ts +4 -3
- package/lib/linter/testSchema.js +9 -4
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +131 -12
- package/lib/list/index.js.map +1 -1
- package/lib/list/matrix.js +3 -7
- package/lib/list/matrix.js.map +1 -1
- package/lib/promoter/index.d.ts +50 -0
- package/lib/promoter/index.js +880 -0
- package/lib/promoter/index.js.map +1 -0
- package/lib/sets.d.ts +11 -0
- package/lib/sets.js +81 -0
- package/lib/sets.js.map +1 -0
- package/lib/targeting.d.ts +14 -0
- package/lib/targeting.js +82 -0
- package/lib/targeting.js.map +1 -0
- package/lib/tester/cliFormat.d.ts +7 -1
- package/lib/tester/cliFormat.js +11 -2
- package/lib/tester/cliFormat.js.map +1 -1
- package/lib/tester/printTestResult.js +2 -2
- package/lib/tester/printTestResult.js.map +1 -1
- package/lib/tester/testFeature.d.ts +0 -1
- package/lib/tester/testFeature.js +8 -25
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +2 -3
- package/lib/tester/testProject.js +93 -86
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +1 -1
- package/lib/tester/testSegment.js +3 -21
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils/git.js +45 -19
- package/lib/utils/git.js.map +1 -1
- package/package.json +12 -12
- package/src/assess-distribution/index.ts +72 -52
- package/src/benchmark/index.ts +124 -91
- package/src/builder/{buildScopedConditions.spec.ts → applyContextToConditions.spec.ts} +160 -142
- package/src/builder/{buildScopedConditions.ts → applyContextToConditions.ts} +19 -14
- package/src/builder/{buildScopedDatafile.spec.ts → applyContextToDatafile.spec.ts} +141 -81
- package/src/builder/{buildScopedDatafile.ts → applyContextToDatafile.ts} +33 -33
- package/src/builder/{buildScopedSegments.spec.ts → applyContextToSegments.spec.ts} +171 -151
- package/src/builder/{buildScopedSegments.ts → applyContextToSegments.ts} +26 -14
- package/src/builder/buildDatafile.spec.ts +192 -14
- package/src/builder/buildDatafile.ts +74 -64
- package/src/builder/buildProject.ts +171 -86
- package/src/builder/buildRuntimeDatafiles.ts +57 -0
- package/src/builder/index.ts +0 -1
- package/src/cli/cli.ts +0 -5
- package/src/cli/plugins.ts +7 -2
- package/src/config/projectConfig.spec.ts +171 -8
- package/src/config/projectConfig.ts +100 -28
- package/src/datasource/adapter.ts +8 -23
- package/src/datasource/datasource.ts +50 -21
- package/src/datasource/filesystemAdapter.spec.ts +133 -74
- package/src/datasource/filesystemAdapter.ts +93 -227
- package/src/evaluate/index.ts +109 -97
- package/src/find-duplicate-segments/index.ts +34 -16
- package/src/find-usage/index.ts +89 -44
- package/src/generate-code/index.ts +36 -24
- package/src/generate-code/typescript.spec.ts +106 -0
- package/src/generate-code/typescript.ts +33 -398
- package/src/index.ts +2 -1
- package/src/info/index.ts +72 -16
- package/src/init/index.ts +1 -1
- package/src/linter/attributeSchema.ts +1 -0
- package/src/linter/conditionSchema.spec.ts +23 -3
- package/src/linter/conditionSchema.ts +5 -5
- package/src/linter/featureSchema.spec.ts +107 -18
- package/src/linter/featureSchema.ts +25 -28
- package/src/linter/groupSchema.ts +1 -0
- package/src/linter/lintProject.spec.ts +131 -92
- package/src/linter/lintProject.ts +233 -97
- package/src/linter/schema.ts +1 -0
- package/src/linter/segmentSchema.spec.ts +5 -3
- package/src/linter/segmentSchema.ts +1 -0
- package/src/linter/targetSchema.spec.ts +159 -0
- package/src/linter/targetSchema.ts +46 -0
- package/src/linter/testSchema.spec.ts +70 -5
- package/src/linter/testSchema.ts +12 -10
- package/src/list/index.spec.ts +135 -0
- package/src/list/index.ts +188 -12
- package/src/list/matrix.ts +3 -8
- package/src/promoter/index.spec.ts +617 -0
- package/src/promoter/index.ts +1266 -0
- package/src/sets.ts +76 -0
- package/src/targeting.spec.ts +74 -0
- package/src/targeting.ts +106 -0
- package/src/tester/cliFormat.ts +11 -1
- package/src/tester/printTestResult.ts +12 -3
- package/src/tester/testFeature.ts +10 -36
- package/src/tester/testProject.spec.ts +50 -0
- package/src/tester/testProject.ts +89 -140
- package/src/tester/testSegment.ts +5 -22
- package/src/utils/git.ts +13 -21
- package/tsconfig.cjs.json +5 -1
- package/tsconfig.typecheck.json +9 -0
- package/coverage/lcov-report/builder/convertToV1.ts.html +0 -583
- package/lib/builder/allocator.spec.d.ts +0 -1
- package/lib/builder/allocator.spec.js +0 -85
- package/lib/builder/allocator.spec.js.map +0 -1
- package/lib/builder/buildDatafile.spec.d.ts +0 -1
- package/lib/builder/buildDatafile.spec.js +0 -233
- package/lib/builder/buildDatafile.spec.js.map +0 -1
- package/lib/builder/buildScopedConditions.d.ts +0 -5
- package/lib/builder/buildScopedConditions.js.map +0 -1
- package/lib/builder/buildScopedConditions.spec.d.ts +0 -1
- package/lib/builder/buildScopedConditions.spec.js +0 -2167
- package/lib/builder/buildScopedConditions.spec.js.map +0 -1
- package/lib/builder/buildScopedDatafile.d.ts +0 -2
- package/lib/builder/buildScopedDatafile.js.map +0 -1
- package/lib/builder/buildScopedDatafile.spec.d.ts +0 -1
- package/lib/builder/buildScopedDatafile.spec.js +0 -2277
- package/lib/builder/buildScopedDatafile.spec.js.map +0 -1
- package/lib/builder/buildScopedSegments.d.ts +0 -5
- package/lib/builder/buildScopedSegments.js.map +0 -1
- package/lib/builder/buildScopedSegments.spec.d.ts +0 -1
- package/lib/builder/buildScopedSegments.spec.js +0 -1062
- package/lib/builder/buildScopedSegments.spec.js.map +0 -1
- package/lib/builder/convertToV1.d.ts +0 -10
- package/lib/builder/convertToV1.js +0 -119
- package/lib/builder/convertToV1.js.map +0 -1
- package/lib/builder/mutateVariables.spec.d.ts +0 -1
- package/lib/builder/mutateVariables.spec.js +0 -1074
- package/lib/builder/mutateVariables.spec.js.map +0 -1
- package/lib/builder/mutator.spec.d.ts +0 -1
- package/lib/builder/mutator.spec.js +0 -368
- package/lib/builder/mutator.spec.js.map +0 -1
- package/lib/builder/revision.spec.d.ts +0 -1
- package/lib/builder/revision.spec.js +0 -21
- package/lib/builder/revision.spec.js.map +0 -1
- package/lib/builder/traffic.spec.d.ts +0 -1
- package/lib/builder/traffic.spec.js +0 -872
- package/lib/builder/traffic.spec.js.map +0 -1
- package/lib/config/projectConfig.spec.d.ts +0 -1
- package/lib/config/projectConfig.spec.js +0 -24
- package/lib/config/projectConfig.spec.js.map +0 -1
- package/lib/datasource/filesystemAdapter.spec.d.ts +0 -1
- package/lib/datasource/filesystemAdapter.spec.js +0 -88
- package/lib/datasource/filesystemAdapter.spec.js.map +0 -1
- package/lib/generate-code/typescript.spec.d.ts +0 -1
- package/lib/generate-code/typescript.spec.js +0 -78
- package/lib/generate-code/typescript.spec.js.map +0 -1
- package/lib/linter/attributeSchema.spec.d.ts +0 -1
- package/lib/linter/attributeSchema.spec.js +0 -266
- package/lib/linter/attributeSchema.spec.js.map +0 -1
- package/lib/linter/conditionSchema.spec.d.ts +0 -1
- package/lib/linter/conditionSchema.spec.js +0 -380
- package/lib/linter/conditionSchema.spec.js.map +0 -1
- package/lib/linter/featureSchema.spec.d.ts +0 -1
- package/lib/linter/featureSchema.spec.js +0 -1552
- package/lib/linter/featureSchema.spec.js.map +0 -1
- package/lib/linter/lintProject.spec.d.ts +0 -1
- package/lib/linter/lintProject.spec.js +0 -211
- package/lib/linter/lintProject.spec.js.map +0 -1
- package/lib/linter/mutationNotation.spec.d.ts +0 -1
- package/lib/linter/mutationNotation.spec.js +0 -598
- package/lib/linter/mutationNotation.spec.js.map +0 -1
- package/lib/linter/schema.spec.d.ts +0 -1
- package/lib/linter/schema.spec.js +0 -535
- package/lib/linter/schema.spec.js.map +0 -1
- package/lib/linter/segmentSchema.spec.d.ts +0 -1
- package/lib/linter/segmentSchema.spec.js +0 -303
- package/lib/linter/segmentSchema.spec.js.map +0 -1
- package/lib/linter/testSchema.spec.d.ts +0 -1
- package/lib/linter/testSchema.spec.js +0 -162
- package/lib/linter/testSchema.spec.js.map +0 -1
- package/lib/list/matrix.spec.d.ts +0 -1
- package/lib/list/matrix.spec.js +0 -42
- package/lib/list/matrix.spec.js.map +0 -1
- package/lib/site/exportSite.d.ts +0 -2
- package/lib/site/exportSite.js +0 -30
- package/lib/site/exportSite.js.map +0 -1
- package/lib/site/generateHistory.d.ts +0 -3
- package/lib/site/generateHistory.js +0 -31
- package/lib/site/generateHistory.js.map +0 -1
- package/lib/site/generateSiteSearchIndex.d.ts +0 -4
- package/lib/site/generateSiteSearchIndex.js +0 -195
- package/lib/site/generateSiteSearchIndex.js.map +0 -1
- package/lib/site/getLastModifiedFromHistory.d.ts +0 -2
- package/lib/site/getLastModifiedFromHistory.js +0 -18
- package/lib/site/getLastModifiedFromHistory.js.map +0 -1
- package/lib/site/getOwnerAndRepoFromUrl.d.ts +0 -4
- package/lib/site/getOwnerAndRepoFromUrl.js +0 -20
- package/lib/site/getOwnerAndRepoFromUrl.js.map +0 -1
- package/lib/site/getRelativePaths.d.ts +0 -6
- package/lib/site/getRelativePaths.js +0 -15
- package/lib/site/getRelativePaths.js.map +0 -1
- package/lib/site/getRepoDetails.d.ts +0 -8
- package/lib/site/getRepoDetails.js +0 -48
- package/lib/site/getRepoDetails.js.map +0 -1
- package/lib/site/index.d.ts +0 -2
- package/lib/site/index.js +0 -43
- package/lib/site/index.js.map +0 -1
- package/lib/site/serveSite.d.ts +0 -2
- package/lib/site/serveSite.js +0 -54
- package/lib/site/serveSite.js.map +0 -1
- package/lib/tester/helpers.spec.d.ts +0 -1
- package/lib/tester/helpers.spec.js +0 -115
- package/lib/tester/helpers.spec.js.map +0 -1
- package/src/builder/convertToV1.ts +0 -166
- package/src/site/exportSite.ts +0 -42
- package/src/site/generateHistory.ts +0 -40
- package/src/site/generateSiteSearchIndex.ts +0 -258
- package/src/site/getLastModifiedFromHistory.ts +0 -21
- package/src/site/getOwnerAndRepoFromUrl.ts +0 -17
- package/src/site/getRelativePaths.ts +0 -24
- package/src/site/getRepoDetails.ts +0 -62
- package/src/site/index.ts +0 -46
- package/src/site/serveSite.ts +0 -58
|
@@ -9,10 +9,11 @@ import { Dependencies } from "../dependencies";
|
|
|
9
9
|
import { prettyDuration } from "./prettyDuration";
|
|
10
10
|
import { printTestResult } from "./printTestResult";
|
|
11
11
|
|
|
12
|
-
import { buildDatafile,
|
|
13
|
-
import { SCHEMA_VERSION } from "../config";
|
|
12
|
+
import { buildDatafile, buildTargetDatafile } from "../builder";
|
|
14
13
|
import { Plugin } from "../cli";
|
|
15
14
|
import { listEntities } from "../list";
|
|
15
|
+
import { getProjectSetExecutions, printSetHeader } from "../sets";
|
|
16
|
+
import { resolveTargets } from "../targeting";
|
|
16
17
|
|
|
17
18
|
export interface TestProjectOptions {
|
|
18
19
|
keyPattern?: string;
|
|
@@ -20,10 +21,8 @@ export interface TestProjectOptions {
|
|
|
20
21
|
verbose?: boolean;
|
|
21
22
|
showDatafile?: boolean;
|
|
22
23
|
onlyFailures?: boolean;
|
|
23
|
-
schemaVersion?: string;
|
|
24
24
|
inflate?: number;
|
|
25
|
-
|
|
26
|
-
withTags?: boolean;
|
|
25
|
+
target?: string | string[];
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
export interface ExecutionResult {
|
|
@@ -34,9 +33,58 @@ export interface ExecutionResult {
|
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
// the key can be either "<EnvironmentKey>" or "<EnvironmentKey
|
|
36
|
+
// the key can be either "<EnvironmentKey>" or "<EnvironmentKey>-target-<Target>"
|
|
38
37
|
export type DatafileContentByKey = Map<string | false, DatafileContent>;
|
|
39
38
|
|
|
39
|
+
export function filterTestForTargets(test: Test, selectedTargetKeys?: string[]): Test | undefined {
|
|
40
|
+
if (!selectedTargetKeys || !(test as TestFeature).feature) return test;
|
|
41
|
+
|
|
42
|
+
const featureTest = test as TestFeature;
|
|
43
|
+
const assertions = featureTest.assertions.filter(
|
|
44
|
+
(assertion) => !assertion.target || selectedTargetKeys.includes(assertion.target),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return assertions.length > 0 ? { ...featureTest, assertions } : undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function buildTestDatafilesForEnvironment(
|
|
51
|
+
deps: Dependencies,
|
|
52
|
+
datafileContentByKey: DatafileContentByKey,
|
|
53
|
+
environment: string | false,
|
|
54
|
+
selectedTargetKeys?: string[],
|
|
55
|
+
) {
|
|
56
|
+
const { projectConfig, datasource, options } = deps;
|
|
57
|
+
const existingState = await datasource.readState(environment);
|
|
58
|
+
const datafileContent = await buildDatafile(
|
|
59
|
+
projectConfig,
|
|
60
|
+
datasource,
|
|
61
|
+
{
|
|
62
|
+
revision: "include-all-features",
|
|
63
|
+
environment,
|
|
64
|
+
inflate: options.inflate,
|
|
65
|
+
},
|
|
66
|
+
existingState,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
datafileContentByKey.set(environment, datafileContent as DatafileContent);
|
|
70
|
+
|
|
71
|
+
const targetKeys = selectedTargetKeys || (await datasource.listTargets());
|
|
72
|
+
for (const targetKey of targetKeys) {
|
|
73
|
+
const target = await datasource.readTarget(targetKey);
|
|
74
|
+
const targetDatafileContent = await buildTargetDatafile({
|
|
75
|
+
projectConfig,
|
|
76
|
+
datasource,
|
|
77
|
+
target,
|
|
78
|
+
environment,
|
|
79
|
+
existingState,
|
|
80
|
+
revision: "include-target-features",
|
|
81
|
+
inflate: options.inflate,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
datafileContentByKey.set(`${environment}-target-${targetKey}`, targetDatafileContent);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
40
88
|
export async function executeTest(
|
|
41
89
|
test: Test,
|
|
42
90
|
deps: Dependencies,
|
|
@@ -128,139 +176,26 @@ export async function testProject(
|
|
|
128
176
|
let failedAssertionsCount = 0;
|
|
129
177
|
|
|
130
178
|
const datafileContentByKey: DatafileContentByKey = new Map();
|
|
179
|
+
const selectedTargets = testOptions.target
|
|
180
|
+
? await resolveTargets(datasource, testOptions.target, { defaultToAll: false })
|
|
181
|
+
: undefined;
|
|
182
|
+
const selectedTargetKeys = selectedTargets?.map((target) => target.key);
|
|
131
183
|
|
|
132
184
|
// with environments
|
|
133
185
|
if (Array.isArray(projectConfig.environments)) {
|
|
134
186
|
for (const environment of projectConfig.environments) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
schemaVersion: options.schemaVersion || SCHEMA_VERSION,
|
|
141
|
-
revision: "include-all-features",
|
|
142
|
-
environment: environment,
|
|
143
|
-
inflate: options.inflate,
|
|
144
|
-
},
|
|
145
|
-
existingState,
|
|
187
|
+
await buildTestDatafilesForEnvironment(
|
|
188
|
+
deps,
|
|
189
|
+
datafileContentByKey,
|
|
190
|
+
environment,
|
|
191
|
+
selectedTargetKeys,
|
|
146
192
|
);
|
|
147
|
-
|
|
148
|
-
datafileContentByKey.set(environment, datafileContent as DatafileContent);
|
|
149
|
-
|
|
150
|
-
// by scope
|
|
151
|
-
if (projectConfig.scopes && options.withScopes) {
|
|
152
|
-
for (const scope of projectConfig.scopes) {
|
|
153
|
-
const existingState = await datasource.readState(environment);
|
|
154
|
-
const datafileContent = await buildDatafile(
|
|
155
|
-
projectConfig,
|
|
156
|
-
datasource,
|
|
157
|
-
{
|
|
158
|
-
schemaVersion: options.schemaVersion || SCHEMA_VERSION,
|
|
159
|
-
revision: "include-scoped-features",
|
|
160
|
-
environment: environment,
|
|
161
|
-
inflate: options.inflate,
|
|
162
|
-
tag: scope.tag,
|
|
163
|
-
tags: scope.tags,
|
|
164
|
-
},
|
|
165
|
-
existingState,
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
const scopedDatafileContent = buildScopedDatafile(
|
|
169
|
-
datafileContent as DatafileContent,
|
|
170
|
-
scope.context,
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
datafileContentByKey.set(`${environment}-scope-${scope.name}`, scopedDatafileContent);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// by tag
|
|
178
|
-
if (projectConfig.tags && options.withTags) {
|
|
179
|
-
for (const tag of projectConfig.tags) {
|
|
180
|
-
const existingState = await datasource.readState(environment);
|
|
181
|
-
const datafileContent = (await buildDatafile(
|
|
182
|
-
projectConfig,
|
|
183
|
-
datasource,
|
|
184
|
-
{
|
|
185
|
-
schemaVersion: options.schemaVersion || SCHEMA_VERSION,
|
|
186
|
-
revision: "include-tagged-features",
|
|
187
|
-
environment: environment,
|
|
188
|
-
inflate: options.inflate,
|
|
189
|
-
tag: tag,
|
|
190
|
-
},
|
|
191
|
-
existingState,
|
|
192
|
-
)) as DatafileContent;
|
|
193
|
-
|
|
194
|
-
datafileContentByKey.set(`${environment}-tag-${tag}`, datafileContent);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
193
|
}
|
|
198
194
|
}
|
|
199
195
|
|
|
200
196
|
// no environments
|
|
201
|
-
if (projectConfig.environments
|
|
202
|
-
|
|
203
|
-
const datafileContent = await buildDatafile(
|
|
204
|
-
projectConfig,
|
|
205
|
-
datasource,
|
|
206
|
-
{
|
|
207
|
-
schemaVersion: options.schemaVersion || SCHEMA_VERSION,
|
|
208
|
-
revision: "include-all-features",
|
|
209
|
-
environment: false,
|
|
210
|
-
inflate: options.inflate,
|
|
211
|
-
},
|
|
212
|
-
existingState,
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
datafileContentByKey.set(false, datafileContent as DatafileContent);
|
|
216
|
-
|
|
217
|
-
// by scope
|
|
218
|
-
if (projectConfig.scopes && options.withScopes) {
|
|
219
|
-
for (const scope of projectConfig.scopes) {
|
|
220
|
-
const existingState = await datasource.readState(false);
|
|
221
|
-
const datafileContent = await buildDatafile(
|
|
222
|
-
projectConfig,
|
|
223
|
-
datasource,
|
|
224
|
-
{
|
|
225
|
-
schemaVersion: options.schemaVersion || SCHEMA_VERSION,
|
|
226
|
-
revision: "include-scoped-features",
|
|
227
|
-
environment: false,
|
|
228
|
-
inflate: options.inflate,
|
|
229
|
-
tag: scope.tag,
|
|
230
|
-
tags: scope.tags,
|
|
231
|
-
},
|
|
232
|
-
existingState,
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
const scopedDatafileContent = buildScopedDatafile(
|
|
236
|
-
datafileContent as DatafileContent,
|
|
237
|
-
scope.context,
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
datafileContentByKey.set(`scope-${scope.name}`, scopedDatafileContent);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// by tag
|
|
245
|
-
if (projectConfig.tags && options.withTags) {
|
|
246
|
-
for (const tag of projectConfig.tags) {
|
|
247
|
-
const existingState = await datasource.readState(false);
|
|
248
|
-
const datafileContent = (await buildDatafile(
|
|
249
|
-
projectConfig,
|
|
250
|
-
datasource,
|
|
251
|
-
{
|
|
252
|
-
schemaVersion: options.schemaVersion || SCHEMA_VERSION,
|
|
253
|
-
revision: "include-tagged-features",
|
|
254
|
-
environment: false,
|
|
255
|
-
inflate: options.inflate,
|
|
256
|
-
tag: tag,
|
|
257
|
-
},
|
|
258
|
-
existingState,
|
|
259
|
-
)) as DatafileContent;
|
|
260
|
-
|
|
261
|
-
datafileContentByKey.set(`tag-${tag}`, datafileContent);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
197
|
+
if (!Array.isArray(projectConfig.environments)) {
|
|
198
|
+
await buildTestDatafilesForEnvironment(deps, datafileContentByKey, false, selectedTargetKeys);
|
|
264
199
|
}
|
|
265
200
|
|
|
266
201
|
const tests = await listEntities<Test>(
|
|
@@ -276,7 +211,10 @@ export async function testProject(
|
|
|
276
211
|
"test",
|
|
277
212
|
);
|
|
278
213
|
|
|
279
|
-
for (const
|
|
214
|
+
for (const originalTest of tests) {
|
|
215
|
+
const test = filterTestForTargets(originalTest, selectedTargetKeys);
|
|
216
|
+
if (!test) continue;
|
|
217
|
+
|
|
280
218
|
const executionResult = await executeTest(test, deps, options, datafileContentByKey);
|
|
281
219
|
|
|
282
220
|
if (!executionResult) {
|
|
@@ -319,15 +257,26 @@ export async function testProject(
|
|
|
319
257
|
export const testPlugin: Plugin = {
|
|
320
258
|
command: "test",
|
|
321
259
|
handler: async function ({ rootDirectoryPath, projectConfig, datasource, parsed }) {
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
260
|
+
const executions = await getProjectSetExecutions(projectConfig, datasource, parsed.set);
|
|
261
|
+
let hasError = false;
|
|
262
|
+
|
|
263
|
+
for (const execution of executions) {
|
|
264
|
+
printSetHeader(projectConfig, execution.set);
|
|
265
|
+
|
|
266
|
+
const executionHasError = await testProject(
|
|
267
|
+
{
|
|
268
|
+
rootDirectoryPath,
|
|
269
|
+
projectConfig: execution.projectConfig,
|
|
270
|
+
datasource: execution.datasource,
|
|
271
|
+
options: parsed,
|
|
272
|
+
},
|
|
273
|
+
parsed as TestProjectOptions,
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
if (executionHasError) {
|
|
277
|
+
hasError = true;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
331
280
|
|
|
332
281
|
if (hasError) {
|
|
333
282
|
return false;
|
|
@@ -5,15 +5,17 @@ import type {
|
|
|
5
5
|
TestResultAssertion,
|
|
6
6
|
TestResultAssertionError,
|
|
7
7
|
} from "@featurevisor/types";
|
|
8
|
-
import {
|
|
8
|
+
import { allConditionsAreMatched } from "@featurevisor/sdk";
|
|
9
9
|
|
|
10
10
|
import { Datasource } from "../datasource";
|
|
11
11
|
|
|
12
12
|
export async function testSegment(
|
|
13
13
|
datasource: Datasource,
|
|
14
14
|
test: TestSegment,
|
|
15
|
-
|
|
15
|
+
_options: { verbose?: boolean; quiet?: boolean } = {},
|
|
16
16
|
): Promise<TestResult> {
|
|
17
|
+
void _options;
|
|
18
|
+
|
|
17
19
|
const testStartTime = Date.now();
|
|
18
20
|
const segmentKey = test.segment;
|
|
19
21
|
|
|
@@ -37,27 +39,8 @@ export async function testSegment(
|
|
|
37
39
|
return testResult;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
let logLevel: LogLevel = "warn";
|
|
41
|
-
if (options.verbose) {
|
|
42
|
-
logLevel = "debug";
|
|
43
|
-
} else if (options.quiet) {
|
|
44
|
-
logLevel = "fatal";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
const parsedSegment = await datasource.readSegment(segmentKey);
|
|
48
43
|
const conditions = parsedSegment.conditions as Condition | Condition[];
|
|
49
|
-
const logger = createLogger({
|
|
50
|
-
level: logLevel,
|
|
51
|
-
});
|
|
52
|
-
const datafileReader = new DatafileReader({
|
|
53
|
-
datafile: {
|
|
54
|
-
schemaVersion: "2",
|
|
55
|
-
revision: "tester",
|
|
56
|
-
segments: {},
|
|
57
|
-
features: {},
|
|
58
|
-
},
|
|
59
|
-
logger,
|
|
60
|
-
});
|
|
61
44
|
|
|
62
45
|
test.assertions.forEach(function (assertion) {
|
|
63
46
|
const assertionStartTime = Date.now();
|
|
@@ -69,7 +52,7 @@ export async function testSegment(
|
|
|
69
52
|
};
|
|
70
53
|
|
|
71
54
|
const expected = assertion.expectedToMatch;
|
|
72
|
-
const actual =
|
|
55
|
+
const actual = allConditionsAreMatched(conditions, assertion.context);
|
|
73
56
|
const passed = actual === expected;
|
|
74
57
|
|
|
75
58
|
if (!passed) {
|
package/src/utils/git.ts
CHANGED
|
@@ -95,15 +95,12 @@ export function getCommit(
|
|
|
95
95
|
type = "segment";
|
|
96
96
|
} else if (isWithinDirectory(projectConfig.featuresDirectoryPath, relativeDir)) {
|
|
97
97
|
type = "feature";
|
|
98
|
-
} else if (
|
|
99
|
-
projectConfig.splitByEnvironment &&
|
|
100
|
-
isWithinDirectory(projectConfig.environmentsDirectoryPath, relativeDir)
|
|
101
|
-
) {
|
|
102
|
-
type = "feature";
|
|
103
98
|
} else if (isWithinDirectory(projectConfig.groupsDirectoryPath, relativeDir)) {
|
|
104
99
|
type = "group";
|
|
105
100
|
} else if (isWithinDirectory(projectConfig.schemasDirectoryPath, relativeDir)) {
|
|
106
101
|
type = "schema";
|
|
102
|
+
} else if (isWithinDirectory(projectConfig.targetsDirectoryPath, relativeDir)) {
|
|
103
|
+
type = "target";
|
|
107
104
|
} else if (isWithinDirectory(projectConfig.testsDirectoryPath, relativeDir)) {
|
|
108
105
|
type = "test";
|
|
109
106
|
} else {
|
|
@@ -123,24 +120,19 @@ export function getCommit(
|
|
|
123
120
|
let key = fileName.replace(extensionWithDot, "");
|
|
124
121
|
|
|
125
122
|
if (
|
|
126
|
-
type === "feature" &&
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.split(path.sep)
|
|
133
|
-
.slice(1)
|
|
134
|
-
.join(path.sep)
|
|
135
|
-
.replace(extensionWithDot, "");
|
|
136
|
-
|
|
137
|
-
key = featureRelativePath.replace(/\\/g, "/");
|
|
138
|
-
} else if (
|
|
139
|
-
type === "feature" &&
|
|
140
|
-
absolutePath.startsWith(projectConfig.featuresDirectoryPath + path.sep)
|
|
123
|
+
(type === "feature" || type === "target") &&
|
|
124
|
+
absolutePath.startsWith(
|
|
125
|
+
(type === "feature"
|
|
126
|
+
? projectConfig.featuresDirectoryPath
|
|
127
|
+
: projectConfig.targetsDirectoryPath) + path.sep,
|
|
128
|
+
)
|
|
141
129
|
) {
|
|
130
|
+
const entityDirectoryPath =
|
|
131
|
+
type === "feature"
|
|
132
|
+
? projectConfig.featuresDirectoryPath
|
|
133
|
+
: projectConfig.targetsDirectoryPath;
|
|
142
134
|
key = absolutePath
|
|
143
|
-
.replace(
|
|
135
|
+
.replace(entityDirectoryPath + path.sep, "")
|
|
144
136
|
.replace(extensionWithDot, "")
|
|
145
137
|
.replace(/\\/g, "/");
|
|
146
138
|
}
|
package/tsconfig.cjs.json
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
"extends": "../../tsconfig.cjs.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es2020",
|
|
5
|
+
"lib": ["es2020"],
|
|
6
|
+
"types": ["node"],
|
|
5
7
|
"outDir": "./lib",
|
|
8
|
+
"rootDir": "./src",
|
|
6
9
|
"skipLibCheck": true
|
|
7
10
|
},
|
|
8
|
-
"include": ["./src/**/*.ts"]
|
|
11
|
+
"include": ["./src/**/*.ts"],
|
|
12
|
+
"exclude": ["./src/**/*.spec.ts"]
|
|
9
13
|
}
|