@facet-coverage/core 0.1.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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +422 -0
  3. package/bin/facet-coverage.js +3 -0
  4. package/dist/cli/commands/analyze.d.ts +13 -0
  5. package/dist/cli/commands/analyze.d.ts.map +1 -0
  6. package/dist/cli/commands/analyze.js +161 -0
  7. package/dist/cli/commands/analyze.js.map +1 -0
  8. package/dist/cli/commands/generate.d.ts +10 -0
  9. package/dist/cli/commands/generate.d.ts.map +1 -0
  10. package/dist/cli/commands/generate.js +67 -0
  11. package/dist/cli/commands/generate.js.map +1 -0
  12. package/dist/cli/commands/validate.d.ts +11 -0
  13. package/dist/cli/commands/validate.d.ts.map +1 -0
  14. package/dist/cli/commands/validate.js +120 -0
  15. package/dist/cli/commands/validate.js.map +1 -0
  16. package/dist/cli/commands/watch.d.ts +10 -0
  17. package/dist/cli/commands/watch.d.ts.map +1 -0
  18. package/dist/cli/commands/watch.js +151 -0
  19. package/dist/cli/commands/watch.js.map +1 -0
  20. package/dist/cli/index.d.ts +2 -0
  21. package/dist/cli/index.d.ts.map +1 -0
  22. package/dist/cli/index.js +47 -0
  23. package/dist/cli/index.js.map +1 -0
  24. package/dist/core/CoverageCalculator.d.ts +34 -0
  25. package/dist/core/CoverageCalculator.d.ts.map +1 -0
  26. package/dist/core/CoverageCalculator.js +167 -0
  27. package/dist/core/CoverageCalculator.js.map +1 -0
  28. package/dist/core/FacetParser.d.ts +39 -0
  29. package/dist/core/FacetParser.d.ts.map +1 -0
  30. package/dist/core/FacetParser.js +114 -0
  31. package/dist/core/FacetParser.js.map +1 -0
  32. package/dist/core/StructureReader.d.ts +37 -0
  33. package/dist/core/StructureReader.d.ts.map +1 -0
  34. package/dist/core/StructureReader.js +126 -0
  35. package/dist/core/StructureReader.js.map +1 -0
  36. package/dist/core/TestScanner.d.ts +36 -0
  37. package/dist/core/TestScanner.d.ts.map +1 -0
  38. package/dist/core/TestScanner.js +192 -0
  39. package/dist/core/TestScanner.js.map +1 -0
  40. package/dist/core/Validator.d.ts +33 -0
  41. package/dist/core/Validator.d.ts.map +1 -0
  42. package/dist/core/Validator.js +183 -0
  43. package/dist/core/Validator.js.map +1 -0
  44. package/dist/core/index.d.ts +6 -0
  45. package/dist/core/index.d.ts.map +1 -0
  46. package/dist/core/index.js +14 -0
  47. package/dist/core/index.js.map +1 -0
  48. package/dist/index.d.ts +6 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +23 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/integrations/playwright.d.ts +95 -0
  53. package/dist/integrations/playwright.d.ts.map +1 -0
  54. package/dist/integrations/playwright.js +168 -0
  55. package/dist/integrations/playwright.js.map +1 -0
  56. package/dist/reporters/HtmlReporter.d.ts +53 -0
  57. package/dist/reporters/HtmlReporter.d.ts.map +1 -0
  58. package/dist/reporters/HtmlReporter.js +484 -0
  59. package/dist/reporters/HtmlReporter.js.map +1 -0
  60. package/dist/reporters/JsonReporter.d.ts +21 -0
  61. package/dist/reporters/JsonReporter.d.ts.map +1 -0
  62. package/dist/reporters/JsonReporter.js +58 -0
  63. package/dist/reporters/JsonReporter.js.map +1 -0
  64. package/dist/reporters/MarkdownReporter.d.ts +25 -0
  65. package/dist/reporters/MarkdownReporter.d.ts.map +1 -0
  66. package/dist/reporters/MarkdownReporter.js +141 -0
  67. package/dist/reporters/MarkdownReporter.js.map +1 -0
  68. package/dist/reporters/index.d.ts +4 -0
  69. package/dist/reporters/index.d.ts.map +1 -0
  70. package/dist/reporters/index.js +10 -0
  71. package/dist/reporters/index.js.map +1 -0
  72. package/dist/types.d.ts +205 -0
  73. package/dist/types.d.ts.map +1 -0
  74. package/dist/types.js +28 -0
  75. package/dist/types.js.map +1 -0
  76. package/package.json +88 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkdownReporter = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const types_js_1 = require("../types.js");
7
+ /**
8
+ * Generates Markdown coverage reports
9
+ */
10
+ class MarkdownReporter {
11
+ config;
12
+ constructor(config = {}) {
13
+ this.config = { ...types_js_1.defaultConfig, ...config };
14
+ }
15
+ /**
16
+ * Generate Markdown report
17
+ */
18
+ generate(report) {
19
+ const lines = [];
20
+ // Header
21
+ lines.push('# Facet Coverage Report');
22
+ lines.push('');
23
+ lines.push(`Generated: ${new Date(report.timestamp).toLocaleString()}`);
24
+ lines.push('');
25
+ // Overall Summary
26
+ lines.push('## Overall Summary');
27
+ lines.push('');
28
+ lines.push(`| Metric | Value |`);
29
+ lines.push(`| ------ | ----- |`);
30
+ lines.push(`| **Coverage** | **${report.summary.percentage}%** |`);
31
+ lines.push(`| Total Facets | ${report.summary.totalFacets} |`);
32
+ lines.push(`| Covered | ${report.summary.coveredFacets} |`);
33
+ lines.push(`| Uncovered | ${report.summary.uncoveredFacets} |`);
34
+ lines.push('');
35
+ // Coverage by Type
36
+ if (report.byType.length > 0) {
37
+ lines.push('## Coverage by Type');
38
+ lines.push('');
39
+ lines.push('| Type | Coverage | Covered | Total |');
40
+ lines.push('| ---- | -------- | ------- | ----- |');
41
+ for (const typeCov of report.byType) {
42
+ const icon = typeCov.percentage === 100 ? '✅' : typeCov.percentage >= 75 ? '🟡' : '❌';
43
+ lines.push(`| ${typeCov.type} | ${icon} ${typeCov.percentage}% | ${typeCov.covered} | ${typeCov.total} |`);
44
+ }
45
+ lines.push('');
46
+ }
47
+ // Per-Feature Coverage
48
+ lines.push('## Features');
49
+ lines.push('');
50
+ for (const feature of report.features) {
51
+ lines.push(...this.generateFeatureSection(feature));
52
+ lines.push('');
53
+ }
54
+ // Uncovered Facets
55
+ if (report.uncovered.length > 0) {
56
+ lines.push('## Uncovered Facets');
57
+ lines.push('');
58
+ lines.push('The following facets are not covered by any tests:');
59
+ lines.push('');
60
+ for (const facet of report.uncovered) {
61
+ lines.push(`- **${facet.id}** (${facet.type})`);
62
+ lines.push(` - Source: \`${facet.source.file}#${facet.source.section}\``);
63
+ }
64
+ lines.push('');
65
+ }
66
+ return lines.join('\n');
67
+ }
68
+ /**
69
+ * Generate section for a single feature
70
+ */
71
+ generateFeatureSection(feature) {
72
+ const lines = [];
73
+ const icon = feature.percentage === 100 ? '✅' : feature.percentage >= 75 ? '🟡' : '❌';
74
+ lines.push(`### ${feature.feature} ${icon}`);
75
+ lines.push('');
76
+ lines.push(`**Coverage:** ${feature.percentage}% (${feature.coveredFacets}/${feature.totalFacets} facets)`);
77
+ lines.push('');
78
+ // Type breakdown for this feature
79
+ if (feature.byType.length > 1) {
80
+ lines.push('| Type | Coverage |');
81
+ lines.push('| ---- | -------- |');
82
+ for (const typeCov of feature.byType) {
83
+ lines.push(`| ${typeCov.type} | ${typeCov.percentage}% (${typeCov.covered}/${typeCov.total}) |`);
84
+ }
85
+ lines.push('');
86
+ }
87
+ // Covered facets
88
+ const covered = feature.facets.filter(f => f.covered);
89
+ if (covered.length > 0) {
90
+ lines.push('#### Covered Facets');
91
+ lines.push('');
92
+ for (const fc of covered) {
93
+ lines.push(...this.generateFacetDetails(fc, true));
94
+ }
95
+ lines.push('');
96
+ }
97
+ // Uncovered facets
98
+ const uncovered = feature.facets.filter(f => !f.covered);
99
+ if (uncovered.length > 0) {
100
+ lines.push('#### Uncovered Facets');
101
+ lines.push('');
102
+ for (const fc of uncovered) {
103
+ lines.push(...this.generateFacetDetails(fc, false));
104
+ }
105
+ }
106
+ return lines;
107
+ }
108
+ /**
109
+ * Generate details for a single facet
110
+ */
111
+ generateFacetDetails(fc, showTests) {
112
+ const lines = [];
113
+ const icon = fc.covered ? '✅' : '❌';
114
+ lines.push(`##### ${icon} ${fc.facet.id}`);
115
+ lines.push('');
116
+ lines.push(`- **Type:** ${fc.facet.type}`);
117
+ lines.push(`- **Source:** \`${fc.facet.source.file}#${fc.facet.source.section}\``);
118
+ if (showTests && fc.coveredBy.length > 0) {
119
+ lines.push(`- **Covered by:**`);
120
+ for (const test of fc.coveredBy) {
121
+ lines.push(` - \`${test.file}\`: ${test.title}`);
122
+ }
123
+ }
124
+ lines.push('');
125
+ return lines;
126
+ }
127
+ /**
128
+ * Write Markdown report to file
129
+ */
130
+ write(report, cwd = process.cwd()) {
131
+ const outputDir = (0, path_1.join)(cwd, this.config.output.dir);
132
+ const outputPath = (0, path_1.join)(outputDir, 'coverage.md');
133
+ // Ensure output directory exists
134
+ (0, fs_1.mkdirSync)(outputDir, { recursive: true });
135
+ const content = this.generate(report);
136
+ (0, fs_1.writeFileSync)(outputPath, content, 'utf-8');
137
+ return outputPath;
138
+ }
139
+ }
140
+ exports.MarkdownReporter = MarkdownReporter;
141
+ //# sourceMappingURL=MarkdownReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownReporter.js","sourceRoot":"","sources":["../../src/reporters/MarkdownReporter.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,+BAA4B;AAE5B,0CAA4C;AAE5C;;GAEG;AACH,MAAa,gBAAgB;IACnB,MAAM,CAAc;IAE5B,YAAY,SAA+B,EAAE;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,wBAAa,EAAE,GAAG,MAAM,EAAE,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,MAAsB;QAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,SAAS;QACT,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QACxE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,kBAAkB;QAClB,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;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AC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAChC,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;gBAChC,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAsB,EAAE,MAAc,OAAO,CAAC,GAAG,EAAE;QACvD,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAElD,iCAAiC;QACjC,IAAA,cAAS,EAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE1C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtC,IAAA,kBAAa,EAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAE5C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA7JD,4CA6JC"}
@@ -0,0 +1,4 @@
1
+ export { JsonReporter } from './JsonReporter.js';
2
+ export { HtmlReporter } from './HtmlReporter.js';
3
+ export { MarkdownReporter } from './MarkdownReporter.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkdownReporter = exports.HtmlReporter = exports.JsonReporter = void 0;
4
+ var JsonReporter_js_1 = require("./JsonReporter.js");
5
+ Object.defineProperty(exports, "JsonReporter", { enumerable: true, get: function () { return JsonReporter_js_1.JsonReporter; } });
6
+ var HtmlReporter_js_1 = require("./HtmlReporter.js");
7
+ Object.defineProperty(exports, "HtmlReporter", { enumerable: true, get: function () { return HtmlReporter_js_1.HtmlReporter; } });
8
+ var MarkdownReporter_js_1 = require("./MarkdownReporter.js");
9
+ Object.defineProperty(exports, "MarkdownReporter", { enumerable: true, get: function () { return MarkdownReporter_js_1.MarkdownReporter; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Core types for Facet Coverage
3
+ */
4
+ /**
5
+ * Represents a single facet in the structure
6
+ */
7
+ export interface Facet {
8
+ /** Unique identifier for this facet */
9
+ id: string;
10
+ /** Source file and section information */
11
+ source: {
12
+ /** Relative path to the facet file */
13
+ file: string;
14
+ /** Section identifier within the file (slug) */
15
+ section: string;
16
+ };
17
+ /** Type of facet (business, compliance, ux, etc.) */
18
+ type: string;
19
+ /** Optional human-readable title */
20
+ title?: string;
21
+ /** Optional description */
22
+ description?: string;
23
+ }
24
+ /**
25
+ * Structure definition for a feature
26
+ */
27
+ export interface FacetStructure {
28
+ /** Feature name */
29
+ feature: string;
30
+ /** List of facets in this feature */
31
+ facets: Facet[];
32
+ /** Optional metadata */
33
+ metadata?: Record<string, unknown>;
34
+ }
35
+ /**
36
+ * Represents a test that links to facets
37
+ */
38
+ export interface TestLink {
39
+ /** Test file path */
40
+ file: string;
41
+ /** Test title/name */
42
+ title: string;
43
+ /** Full test name including describe blocks */
44
+ fullTitle: string;
45
+ /** Facet IDs this test covers */
46
+ facetIds: string[];
47
+ /** Line number in the test file */
48
+ line?: number;
49
+ }
50
+ /**
51
+ * Coverage information for a single facet
52
+ */
53
+ export interface FacetCoverage {
54
+ /** The facet being tracked */
55
+ facet: Facet;
56
+ /** Whether this facet is covered by at least one test */
57
+ covered: boolean;
58
+ /** Tests that cover this facet */
59
+ coveredBy: TestLink[];
60
+ }
61
+ /**
62
+ * Coverage summary by facet type
63
+ */
64
+ export interface TypeCoverage {
65
+ /** Facet type */
66
+ type: string;
67
+ /** Total number of facets of this type */
68
+ total: number;
69
+ /** Number of covered facets */
70
+ covered: number;
71
+ /** Coverage percentage */
72
+ percentage: number;
73
+ }
74
+ /**
75
+ * Feature-level coverage summary
76
+ */
77
+ export interface FeatureCoverage {
78
+ /** Feature name */
79
+ feature: string;
80
+ /** Path to the feature directory */
81
+ path: string;
82
+ /** Total number of facets */
83
+ totalFacets: number;
84
+ /** Number of covered facets */
85
+ coveredFacets: number;
86
+ /** Coverage percentage */
87
+ percentage: number;
88
+ /** Coverage breakdown by type */
89
+ byType: TypeCoverage[];
90
+ /** Detailed facet coverage */
91
+ facets: FacetCoverage[];
92
+ }
93
+ /**
94
+ * Complete coverage report
95
+ */
96
+ export interface CoverageReport {
97
+ /** Timestamp when report was generated */
98
+ timestamp: string;
99
+ /** Overall coverage statistics */
100
+ summary: {
101
+ totalFacets: number;
102
+ coveredFacets: number;
103
+ uncoveredFacets: number;
104
+ percentage: number;
105
+ };
106
+ /** Coverage breakdown by type across all features */
107
+ byType: TypeCoverage[];
108
+ /** Per-feature coverage details */
109
+ features: FeatureCoverage[];
110
+ /** All test links found */
111
+ tests: TestLink[];
112
+ /** Uncovered facets for easy access */
113
+ uncovered: Facet[];
114
+ }
115
+ /**
116
+ * Validation error
117
+ */
118
+ export interface ValidationError {
119
+ /** Error type */
120
+ type: 'missing-source' | 'missing-section' | 'invalid-facet-id' | 'orphan-test' | 'duplicate-id';
121
+ /** Error message */
122
+ message: string;
123
+ /** File where the error occurred */
124
+ file?: string;
125
+ /** Line number if applicable */
126
+ line?: number;
127
+ /** Related facet ID */
128
+ facetId?: string;
129
+ }
130
+ /**
131
+ * Validation result
132
+ */
133
+ export interface ValidationResult {
134
+ /** Whether validation passed */
135
+ valid: boolean;
136
+ /** List of errors found */
137
+ errors: ValidationError[];
138
+ /** List of warnings */
139
+ warnings: ValidationError[];
140
+ }
141
+ /**
142
+ * Configuration options
143
+ */
144
+ export interface FacetConfig {
145
+ /** Glob patterns for structure files */
146
+ structureFiles: string[];
147
+ /** Test directory pattern */
148
+ testDir: string;
149
+ /** Test file patterns */
150
+ testPatterns?: string[];
151
+ /** Validation options */
152
+ validation: {
153
+ /** Verify facet source files exist */
154
+ requireSourceExists: boolean;
155
+ /** Verify sections exist in source files */
156
+ requireSectionExists: boolean;
157
+ /** Require all tests to be linked to facets */
158
+ requireAllTestsLinked: boolean;
159
+ };
160
+ /** Output options */
161
+ output: {
162
+ /** Output directory for reports */
163
+ dir: string;
164
+ /** Output formats to generate */
165
+ formats: ('json' | 'html' | 'markdown')[];
166
+ };
167
+ /** Coverage thresholds */
168
+ thresholds: {
169
+ /** Global coverage threshold */
170
+ global: number;
171
+ /** Per-type thresholds */
172
+ byType: Record<string, number>;
173
+ };
174
+ }
175
+ /**
176
+ * Default configuration
177
+ */
178
+ export declare const defaultConfig: FacetConfig;
179
+ /**
180
+ * Parsed section from a markdown file
181
+ */
182
+ export interface MarkdownSection {
183
+ /** Section title */
184
+ title: string;
185
+ /** Slug (URL-friendly version of title) */
186
+ slug: string;
187
+ /** Heading level (1-6) */
188
+ level: number;
189
+ /** Line number where section starts */
190
+ startLine: number;
191
+ /** Line number where section ends */
192
+ endLine: number;
193
+ /** Section content */
194
+ content: string;
195
+ }
196
+ /**
197
+ * Parsed markdown file
198
+ */
199
+ export interface ParsedMarkdown {
200
+ /** File path */
201
+ file: string;
202
+ /** All sections in the file */
203
+ sections: MarkdownSection[];
204
+ }
205
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,MAAM,EAAE;QACN,sCAAsC;QACtC,IAAI,EAAE,MAAM,CAAC;QACb,gDAAgD;QAChD,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,yDAAyD;IACzD,OAAO,EAAE,OAA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AAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B"}
package/dist/types.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Core types for Facet Coverage
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.defaultConfig = void 0;
7
+ /**
8
+ * Default configuration
9
+ */
10
+ exports.defaultConfig = {
11
+ structureFiles: ['features/**/.facet/structure.json'],
12
+ testDir: './features/**/tests',
13
+ testPatterns: ['**/*.spec.ts', '**/*.test.ts'],
14
+ validation: {
15
+ requireSourceExists: true,
16
+ requireSectionExists: true,
17
+ requireAllTestsLinked: false,
18
+ },
19
+ output: {
20
+ dir: '.facet-coverage',
21
+ formats: ['json', 'html', 'markdown'],
22
+ },
23
+ thresholds: {
24
+ global: 75,
25
+ byType: {},
26
+ },
27
+ };
28
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAuLH;;GAEG;AACU,QAAA,aAAa,GAAgB;IACxC,cAAc,EAAE,CAAC,mCAAmC,CAAC;IACrD,OAAO,EAAE,qBAAqB;IAC9B,YAAY,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC;IAC9C,UAAU,EAAE;QACV,mBAAmB,EAAE,IAAI;QACzB,oBAAoB,EAAE,IAAI;QAC1B,qBAAqB,EAAE,KAAK;KAC7B;IACD,MAAM,EAAE;QACN,GAAG,EAAE,iBAAiB;QACtB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;KACtC;IACD,UAAU,EAAE;QACV,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;KACX;CACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@facet-coverage/core",
3
+ "version": "0.1.0",
4
+ "description": "Test every facet of your features - natural specifications with rigorous coverage tracking",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "facet-coverage": "bin/facet-coverage.js",
9
+ "facet": "bin/facet-coverage.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ },
17
+ "./playwright": {
18
+ "import": "./dist/integrations/playwright.js",
19
+ "require": "./dist/integrations/playwright.js",
20
+ "types": "./dist/integrations/playwright.d.ts"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "bin",
26
+ "templates",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "scripts": {
31
+ "build": "bun run tsc",
32
+ "dev": "bun run tsc --watch",
33
+ "test": "bun test features/core features/cli features/reporters features/integrations",
34
+ "test:all": "bun test",
35
+ "lint": "eslint src",
36
+ "prepublishOnly": "bun run build",
37
+ "version:patch": "npm version patch && git push && git push --tags",
38
+ "version:minor": "npm version minor && git push && git push --tags",
39
+ "version:major": "npm version major && git push && git push --tags"
40
+ },
41
+ "keywords": [
42
+ "testing",
43
+ "coverage",
44
+ "playwright",
45
+ "requirements",
46
+ "traceability",
47
+ "documentation",
48
+ "facet",
49
+ "bdd",
50
+ "specifications"
51
+ ],
52
+ "peerDependencies": {
53
+ "@playwright/test": ">=1.40.0"
54
+ },
55
+ "peerDependenciesMeta": {
56
+ "@playwright/test": {
57
+ "optional": true
58
+ }
59
+ },
60
+ "dependencies": {
61
+ "chalk": "^5.3.0",
62
+ "commander": "^12.0.0",
63
+ "glob": "^10.3.10",
64
+ "chokidar": "^3.5.3"
65
+ },
66
+ "devDependencies": {
67
+ "@playwright/test": "^1.40.0",
68
+ "@types/node": "^20.10.0",
69
+ "typescript": "^5.3.0",
70
+ "@types/bun": "latest"
71
+ },
72
+ "author": "",
73
+ "license": "MIT",
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "git+https://github.com/iraycd/facet-coverage.git"
77
+ },
78
+ "bugs": {
79
+ "url": "https://github.com/iraycd/facet-coverage/issues"
80
+ },
81
+ "homepage": "https://github.com/iraycd/facet-coverage#readme",
82
+ "publishConfig": {
83
+ "access": "public"
84
+ },
85
+ "engines": {
86
+ "node": ">=18.0.0"
87
+ }
88
+ }