@scrymore/scry-sbcov 0.2.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 (47) hide show
  1. package/README.md +410 -0
  2. package/bin/scry-sbcov.js +3 -0
  3. package/dist/analyzers/git-analyzer.d.ts +49 -0
  4. package/dist/analyzers/git-analyzer.d.ts.map +1 -0
  5. package/dist/analyzers/git-analyzer.js +265 -0
  6. package/dist/analyzers/git-analyzer.js.map +1 -0
  7. package/dist/cli/config.d.ts +12 -0
  8. package/dist/cli/config.d.ts.map +1 -0
  9. package/dist/cli/config.js +197 -0
  10. package/dist/cli/config.js.map +1 -0
  11. package/dist/cli/index.d.ts +7 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +164 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/core/analyzer.d.ts +19 -0
  16. package/dist/core/analyzer.d.ts.map +1 -0
  17. package/dist/core/analyzer.js +117 -0
  18. package/dist/core/analyzer.js.map +1 -0
  19. package/dist/core/coverage-calculator.d.ts +38 -0
  20. package/dist/core/coverage-calculator.d.ts.map +1 -0
  21. package/dist/core/coverage-calculator.js +335 -0
  22. package/dist/core/coverage-calculator.js.map +1 -0
  23. package/dist/core/report-generator.d.ts +10 -0
  24. package/dist/core/report-generator.d.ts.map +1 -0
  25. package/dist/core/report-generator.js +477 -0
  26. package/dist/core/report-generator.js.map +1 -0
  27. package/dist/core/story-executor.d.ts +22 -0
  28. package/dist/core/story-executor.d.ts.map +1 -0
  29. package/dist/core/story-executor.js +379 -0
  30. package/dist/core/story-executor.js.map +1 -0
  31. package/dist/detectors/component-detector.d.ts +15 -0
  32. package/dist/detectors/component-detector.d.ts.map +1 -0
  33. package/dist/detectors/component-detector.js +632 -0
  34. package/dist/detectors/component-detector.js.map +1 -0
  35. package/dist/index.d.ts +16 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +18 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/parsers/story-parser.d.ts +18 -0
  40. package/dist/parsers/story-parser.d.ts.map +1 -0
  41. package/dist/parsers/story-parser.js +353 -0
  42. package/dist/parsers/story-parser.js.map +1 -0
  43. package/dist/types/index.d.ts +502 -0
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/index.js +6 -0
  46. package/dist/types/index.js.map +1 -0
  47. package/package.json +79 -0
@@ -0,0 +1,379 @@
1
+ /**
2
+ * Story Executor
3
+ * Executes stories in a real browser to detect runtime failures using Playwright
4
+ */
5
+ import { spawn } from 'node:child_process';
6
+ import * as fs from 'node:fs';
7
+ import * as path from 'node:path';
8
+ // Dynamic import for Playwright (optional dependency)
9
+ let playwright = null;
10
+ async function loadPlaywright() {
11
+ if (playwright)
12
+ return playwright;
13
+ try {
14
+ playwright = await import('playwright');
15
+ return playwright;
16
+ }
17
+ catch {
18
+ return null;
19
+ }
20
+ }
21
+ /**
22
+ * Execute stories and capture failures
23
+ */
24
+ export async function executeStories(storyFiles, config, verbose = false) {
25
+ const pw = await loadPlaywright();
26
+ if (!pw) {
27
+ console.warn('Playwright is not installed. Story execution is disabled.');
28
+ console.warn('Install playwright with: npm install playwright');
29
+ return createEmptyExecutionResults();
30
+ }
31
+ const storybookUrl = config.storybookUrl || 'http://localhost:6006';
32
+ const timeout = config.timeout || 15000;
33
+ const screenshotDir = config.screenshotDir || './screenshots';
34
+ // Ensure screenshot directory exists
35
+ if (config.screenshotOnFailure !== false) {
36
+ fs.mkdirSync(screenshotDir, { recursive: true });
37
+ }
38
+ // Start static server if needed
39
+ let serverProcess = null;
40
+ let effectiveUrl = storybookUrl;
41
+ if (config.staticDir) {
42
+ const port = 6006;
43
+ effectiveUrl = `http://localhost:${port}`;
44
+ serverProcess = await startStaticServer(config.staticDir, port, verbose);
45
+ // Wait for server to be ready
46
+ await waitForServer(effectiveUrl, 30000);
47
+ }
48
+ const results = [];
49
+ const startTime = Date.now();
50
+ try {
51
+ // Launch browser
52
+ const browser = await pw.chromium.launch({ headless: true });
53
+ const context = await browser.newContext();
54
+ // Collect all stories
55
+ const allStories = [];
56
+ for (const file of storyFiles) {
57
+ for (const story of file.stories) {
58
+ allStories.push({ story, file });
59
+ }
60
+ }
61
+ if (verbose) {
62
+ console.log(`Executing ${allStories.length} stories...`);
63
+ }
64
+ // Execute each story
65
+ for (const { story, file } of allStories) {
66
+ const result = await executeStory(story, file, context, effectiveUrl, timeout, screenshotDir, config.screenshotOnFailure !== false);
67
+ results.push(result);
68
+ if (verbose) {
69
+ const icon = result.status === 'passed' ? '✓' : '✗';
70
+ console.log(` ${icon} ${result.componentName}/${result.storyName} (${result.duration}ms)`);
71
+ }
72
+ }
73
+ await browser.close();
74
+ }
75
+ finally {
76
+ // Stop static server
77
+ if (serverProcess) {
78
+ serverProcess.kill();
79
+ }
80
+ }
81
+ const endTime = Date.now();
82
+ const duration = endTime - startTime;
83
+ // Compile results
84
+ const failures = results
85
+ .filter(r => r.status === 'failed' && r.failure)
86
+ .map(r => r.failure);
87
+ const passed = results.filter(r => r.status === 'passed').length;
88
+ const failed = results.filter(r => r.status === 'failed').length;
89
+ const skipped = results.filter(r => r.status === 'skipped').length;
90
+ return {
91
+ executed: true,
92
+ executedAt: new Date().toISOString(),
93
+ summary: {
94
+ total: results.length,
95
+ passed,
96
+ failed,
97
+ skipped,
98
+ duration,
99
+ },
100
+ stories: results,
101
+ failures,
102
+ regression: createEmptyRegressionAnalysis(),
103
+ };
104
+ }
105
+ /**
106
+ * Execute a single story
107
+ */
108
+ async function executeStory(story, file, context, storybookUrl, timeout, screenshotDir, captureScreenshot) {
109
+ const startTime = Date.now();
110
+ const consoleErrors = [];
111
+ const warnings = [];
112
+ const page = await context.newPage();
113
+ // Capture console messages
114
+ page.on('console', msg => {
115
+ if (msg.type() === 'error') {
116
+ consoleErrors.push(msg.text());
117
+ }
118
+ else if (msg.type() === 'warning') {
119
+ warnings.push(msg.text());
120
+ }
121
+ });
122
+ // Capture page errors
123
+ let pageError = null;
124
+ page.on('pageerror', err => {
125
+ pageError = err;
126
+ consoleErrors.push(err.message);
127
+ });
128
+ const storyUrl = `${storybookUrl}/iframe.html?id=${story.storyId}&viewMode=story`;
129
+ const componentName = file.meta.componentName || 'Unknown';
130
+ try {
131
+ // Navigate to story
132
+ await page.goto(storyUrl, { timeout });
133
+ // Wait for the story to render
134
+ await page.waitForSelector('#storybook-root', { timeout });
135
+ // Small delay for React hydration
136
+ await page.waitForTimeout(100);
137
+ // Check for render errors in the page
138
+ const errorBoundary = await page.$('[data-story-error]');
139
+ if (errorBoundary) {
140
+ const errorText = await errorBoundary.textContent();
141
+ throw new Error(`Story render error: ${errorText}`);
142
+ }
143
+ // Check for Storybook error display
144
+ const storybookError = await page.$('.sb-errordisplay');
145
+ if (storybookError) {
146
+ const errorText = await storybookError.textContent();
147
+ throw new Error(`Storybook error: ${errorText}`);
148
+ }
149
+ // If there was a page error, treat as failure
150
+ if (pageError) {
151
+ throw pageError;
152
+ }
153
+ // Check for console errors that indicate component failure
154
+ const criticalErrors = consoleErrors.filter(e => e.includes('TypeError') ||
155
+ e.includes('ReferenceError') ||
156
+ e.includes('Error:') ||
157
+ e.includes('Uncaught'));
158
+ if (criticalErrors.length > 0) {
159
+ throw new Error(criticalErrors[0]);
160
+ }
161
+ // If story has a play function, wait for it to complete
162
+ let playFunctionStatus = story.hasPlayFunction ? 'passed' : 'none';
163
+ if (story.hasPlayFunction) {
164
+ try {
165
+ // Wait for play function to complete
166
+ // Storybook adds data-test-story-is-running and removes it when done
167
+ await page.waitForFunction(() => !document.body.hasAttribute('data-test-story-is-running'), { timeout });
168
+ // Check for play function errors
169
+ const playError = await page.$('[data-play-function-error]');
170
+ if (playError) {
171
+ const errorText = await playError.textContent();
172
+ playFunctionStatus = 'failed';
173
+ throw new Error(`Play function failed: ${errorText}`);
174
+ }
175
+ }
176
+ catch (playErr) {
177
+ playFunctionStatus = 'failed';
178
+ throw playErr;
179
+ }
180
+ }
181
+ const duration = Date.now() - startTime;
182
+ await page.close();
183
+ return {
184
+ storyId: story.storyId,
185
+ componentName,
186
+ storyName: story.storyName,
187
+ status: 'passed',
188
+ duration,
189
+ failure: null,
190
+ warnings,
191
+ hasPlayFunction: story.hasPlayFunction,
192
+ playFunctionStatus,
193
+ };
194
+ }
195
+ catch (error) {
196
+ const duration = Date.now() - startTime;
197
+ const errorMessage = error instanceof Error ? error.message : String(error);
198
+ const errorStack = error instanceof Error ? error.stack || null : null;
199
+ // Determine failure type
200
+ let failureType = 'render_error';
201
+ if (errorMessage.includes('timeout') || errorMessage.includes('Timeout')) {
202
+ failureType = 'timeout';
203
+ }
204
+ else if (errorMessage.includes('Play function')) {
205
+ failureType = 'play_function';
206
+ }
207
+ else if (consoleErrors.length > 0) {
208
+ failureType = 'console_error';
209
+ }
210
+ // Capture screenshot on failure
211
+ let screenshotPath = null;
212
+ if (captureScreenshot) {
213
+ try {
214
+ screenshotPath = path.join(screenshotDir, `${story.storyId}-failure.png`);
215
+ await page.screenshot({ path: screenshotPath });
216
+ }
217
+ catch {
218
+ // Ignore screenshot errors
219
+ }
220
+ }
221
+ await page.close();
222
+ const failure = {
223
+ storyId: story.storyId,
224
+ componentName,
225
+ storyName: story.storyName,
226
+ failureType,
227
+ message: errorMessage,
228
+ stack: errorStack,
229
+ screenshotPath,
230
+ consoleErrors,
231
+ isNewFailure: true, // Will be updated in regression analysis
232
+ storyFilePath: file.relativePath,
233
+ storybookUrl: storyUrl,
234
+ };
235
+ return {
236
+ storyId: story.storyId,
237
+ componentName,
238
+ storyName: story.storyName,
239
+ status: 'failed',
240
+ duration,
241
+ failure,
242
+ warnings,
243
+ hasPlayFunction: story.hasPlayFunction,
244
+ playFunctionStatus: story.hasPlayFunction ? 'failed' : 'none',
245
+ };
246
+ }
247
+ }
248
+ /**
249
+ * Start a static server for Storybook
250
+ */
251
+ async function startStaticServer(staticDir, port, verbose) {
252
+ return new Promise((resolve, reject) => {
253
+ const args = ['-y', 'http-server', staticDir, '-p', String(port), '--silent'];
254
+ if (verbose) {
255
+ console.log(`Starting static server: npx ${args.join(' ')}`);
256
+ }
257
+ const server = spawn('npx', args, {
258
+ stdio: verbose ? 'inherit' : 'pipe',
259
+ shell: true,
260
+ });
261
+ server.on('error', reject);
262
+ // Give server a moment to start
263
+ setTimeout(() => resolve(server), 1000);
264
+ });
265
+ }
266
+ /**
267
+ * Wait for server to be ready
268
+ */
269
+ async function waitForServer(url, timeout) {
270
+ const startTime = Date.now();
271
+ while (Date.now() - startTime < timeout) {
272
+ try {
273
+ const response = await fetch(url);
274
+ if (response.ok) {
275
+ return;
276
+ }
277
+ }
278
+ catch {
279
+ // Server not ready yet
280
+ }
281
+ await new Promise(resolve => setTimeout(resolve, 500));
282
+ }
283
+ throw new Error(`Server at ${url} did not become ready within ${timeout}ms`);
284
+ }
285
+ /**
286
+ * Create empty execution results
287
+ */
288
+ function createEmptyExecutionResults() {
289
+ return {
290
+ executed: false,
291
+ executedAt: new Date().toISOString(),
292
+ summary: {
293
+ total: 0,
294
+ passed: 0,
295
+ failed: 0,
296
+ skipped: 0,
297
+ duration: 0,
298
+ },
299
+ stories: [],
300
+ failures: [],
301
+ regression: createEmptyRegressionAnalysis(),
302
+ };
303
+ }
304
+ /**
305
+ * Create empty regression analysis
306
+ */
307
+ function createEmptyRegressionAnalysis() {
308
+ return {
309
+ enabled: false,
310
+ baselineRef: null,
311
+ newFailures: [],
312
+ fixedFailures: [],
313
+ persistingFailures: [],
314
+ failureDelta: 0,
315
+ };
316
+ }
317
+ /**
318
+ * Compare execution results with a baseline for regression analysis
319
+ */
320
+ export function analyzeRegression(currentResults, baselineResults, baselineRef) {
321
+ if (!baselineResults || !baselineResults.executed) {
322
+ return {
323
+ enabled: false,
324
+ baselineRef: null,
325
+ newFailures: currentResults.failures.map(f => ({ ...f, isNewFailure: true })),
326
+ fixedFailures: [],
327
+ persistingFailures: [],
328
+ failureDelta: currentResults.failures.length,
329
+ };
330
+ }
331
+ const baselineFailureIds = new Set(baselineResults.failures.map(f => f.storyId));
332
+ const currentFailureIds = new Set(currentResults.failures.map(f => f.storyId));
333
+ // New failures: in current but not in baseline
334
+ const newFailures = currentResults.failures.filter(f => !baselineFailureIds.has(f.storyId));
335
+ // Fixed failures: in baseline but not in current
336
+ const fixedFailures = baselineResults.failures
337
+ .filter(f => !currentFailureIds.has(f.storyId))
338
+ .map(f => f.storyId);
339
+ // Persisting failures: in both
340
+ const persistingFailures = currentResults.failures
341
+ .filter(f => baselineFailureIds.has(f.storyId))
342
+ .map(f => f.storyId);
343
+ // Update isNewFailure flag
344
+ for (const failure of currentResults.failures) {
345
+ failure.isNewFailure = !baselineFailureIds.has(failure.storyId);
346
+ }
347
+ return {
348
+ enabled: true,
349
+ baselineRef,
350
+ newFailures: newFailures.map(f => ({ ...f, isNewFailure: true })),
351
+ fixedFailures,
352
+ persistingFailures,
353
+ failureDelta: newFailures.length - fixedFailures.length,
354
+ };
355
+ }
356
+ /**
357
+ * Load baseline results from a file
358
+ */
359
+ export function loadBaseline(baselinePath) {
360
+ try {
361
+ if (!fs.existsSync(baselinePath)) {
362
+ return null;
363
+ }
364
+ const content = fs.readFileSync(baselinePath, 'utf-8');
365
+ const report = JSON.parse(content);
366
+ return report.execution || null;
367
+ }
368
+ catch {
369
+ return null;
370
+ }
371
+ }
372
+ /**
373
+ * Check if Playwright is available
374
+ */
375
+ export async function isPlaywrightAvailable() {
376
+ const pw = await loadPlaywright();
377
+ return pw !== null;
378
+ }
379
+ //# sourceMappingURL=story-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-executor.js","sourceRoot":"","sources":["../../src/core/story-executor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAgB,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAYlC,sDAAsD;AACtD,IAAI,UAAU,GAAuC,IAAI,CAAC;AAE1D,KAAK,UAAU,c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AI,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,CAAC,YAAY,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,WAAW;QACX,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,aAAa;QACb,kBAAkB;QAClB,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM;KACxD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,YAAoB;IAC/C,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,EAAE,GAAG,MAAM,cAAc,EAAE,CAAC;IAClC,OAAO,EAAE,KAAK,IAAI,CAAC;AACrB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Component Detector
3
+ * Finds React components and extracts their prop interfaces using TypeScript AST analysis
4
+ */
5
+ import type { DetectedComponent, ScryConfig } from '../types/index.js';
6
+ declare const SCENARIO_PATTERNS: Record<string, {
7
+ name: string;
8
+ priority: 'critical' | 'high' | 'medium' | 'low';
9
+ }>;
10
+ /**
11
+ * Detect React components in the project
12
+ */
13
+ export declare function detectComponents(projectPath: string, config: ScryConfig, verbose?: boolean): Promise<DetectedComponent[]>;
14
+ export { SCENARIO_PATTERNS };
15
+ //# sourceMappingURL=component-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-detector.d.ts","sourceRoot":"","sources":["../../src/detectors/component-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,iBAAiB,EAIjB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAG3B,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;CAAE,CA+BzG,CAAC;AAEF;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,UAAU,EAClB,OAAO,UAAQ,GACd,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmC9B;AAypBD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}