playwright-slack-report-burak 3.0.16 → 3.0.18
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/dist/src/ResultsParser.js +10 -4
- package/dist/src/SlackReporter.js +48 -6
- package/package.json +1 -1
|
@@ -35,10 +35,14 @@ class ResultsParser {
|
|
|
35
35
|
separateFlakyTests;
|
|
36
36
|
// Handle both 0-based and 1-based shard indexing
|
|
37
37
|
// If MATRIX_SHARD is not set, try to infer from workflow (1-based) or default to 0
|
|
38
|
-
totalShardCount = process.env.
|
|
39
|
-
|
|
40
|
-
? parseInt(process.env.
|
|
41
|
-
|
|
38
|
+
totalShardCount = process.env.TOTAL_SHARDS
|
|
39
|
+
? parseInt(process.env.TOTAL_SHARDS, 10)
|
|
40
|
+
: (process.env.MATRIX_COUNT ? parseInt(process.env.MATRIX_COUNT, 10) : 1);
|
|
41
|
+
shardIndex = process.env.SHARD_INDEX !== undefined
|
|
42
|
+
? parseInt(process.env.SHARD_INDEX, 10)
|
|
43
|
+
: (process.env.MATRIX_SHARD !== undefined
|
|
44
|
+
? parseInt(process.env.MATRIX_SHARD, 10)
|
|
45
|
+
: (process.env.MATRIX_INDEX !== undefined ? parseInt(process.env.MATRIX_INDEX, 10) : 0));
|
|
42
46
|
|
|
43
47
|
// Determine if we're using 1-based indexing (workflow-style) or 0-based
|
|
44
48
|
// This is detected by checking if artifacts exist with 1-based naming
|
|
@@ -50,6 +54,8 @@ class ResultsParser {
|
|
|
50
54
|
console.log(`📦 [ResultsParser] playwright-slack-report-burak v${packageVersion}`);
|
|
51
55
|
// Log shard detection in ResultsParser
|
|
52
56
|
console.log('🔍 [ResultsParser] Initialized with shard detection:');
|
|
57
|
+
console.log(`🔍 SHARD_INDEX env: ${process.env.SHARD_INDEX !== undefined ? `"${process.env.SHARD_INDEX}"` : 'undefined'}`);
|
|
58
|
+
console.log(`🔍 TOTAL_SHARDS env: ${process.env.TOTAL_SHARDS !== undefined ? `"${process.env.TOTAL_SHARDS}"` : 'undefined'}`);
|
|
53
59
|
console.log(`🔍 MATRIX_SHARD env: ${process.env.MATRIX_SHARD !== undefined ? `"${process.env.MATRIX_SHARD}"` : 'undefined'}`);
|
|
54
60
|
console.log(`🔍 MATRIX_INDEX env: ${process.env.MATRIX_INDEX !== undefined ? `"${process.env.MATRIX_INDEX}"` : 'undefined'}`);
|
|
55
61
|
console.log(`🔍 MATRIX_COUNT env: ${process.env.MATRIX_COUNT !== undefined ? `"${process.env.MATRIX_COUNT}"` : 'undefined'}`);
|
|
@@ -341,14 +341,50 @@ class SlackReporter {
|
|
|
341
341
|
this.log(`🔍 MATRIX_INDEX: ${process.env.MATRIX_INDEX !== undefined ? `"${process.env.MATRIX_INDEX}"` : 'undefined'}`);
|
|
342
342
|
this.log(`🔍 MATRIX_COUNT: ${process.env.MATRIX_COUNT !== undefined ? `"${process.env.MATRIX_COUNT}"` : 'undefined'}`);
|
|
343
343
|
|
|
344
|
+
// Check for Playwright shard environment variables (Playwright may set these)
|
|
345
|
+
this.log(`🔍 PLAYWRIGHT_SHARD: ${process.env.PLAYWRIGHT_SHARD !== undefined ? `"${process.env.PLAYWRIGHT_SHARD}"` : 'undefined'}`);
|
|
346
|
+
this.log(`🔍 SHARD_INDEX: ${process.env.SHARD_INDEX !== undefined ? `"${process.env.SHARD_INDEX}"` : 'undefined'}`);
|
|
347
|
+
this.log(`🔍 TOTAL_SHARDS: ${process.env.TOTAL_SHARDS !== undefined ? `"${process.env.TOTAL_SHARDS}"` : 'undefined'}`);
|
|
348
|
+
|
|
344
349
|
// Check Playwright's shard config (highest priority for local runs)
|
|
345
350
|
let playwrightShardInfo = null;
|
|
346
|
-
if (this.fullConfig
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
this.
|
|
351
|
+
if (this.fullConfig) {
|
|
352
|
+
// Debug: log config structure
|
|
353
|
+
this.log(`🔍 [Shard Detection] Checking Playwright config for shard info...`);
|
|
354
|
+
this.log(`🔍 fullConfig.shard: ${this.fullConfig.shard ? JSON.stringify(this.fullConfig.shard) : 'undefined'}`);
|
|
355
|
+
|
|
356
|
+
if (this.fullConfig.shard) {
|
|
357
|
+
// Playwright shard can be either { current, total } or undefined
|
|
358
|
+
if (this.fullConfig.shard.current !== undefined && this.fullConfig.shard.total !== undefined) {
|
|
359
|
+
playwrightShardInfo = {
|
|
360
|
+
current: this.fullConfig.shard.current,
|
|
361
|
+
total: this.fullConfig.shard.total
|
|
362
|
+
};
|
|
363
|
+
this.log(`🔍 [Shard Detection] Found Playwright shard config: ${playwrightShardInfo.current}/${playwrightShardInfo.total}`);
|
|
364
|
+
} else {
|
|
365
|
+
this.log(`🔍 [Shard Detection] Playwright shard config exists but missing current/total properties`);
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
this.log(`🔍 [Shard Detection] No Playwright shard config found in fullConfig`);
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
this.log(`🔍 [Shard Detection] fullConfig not available`);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Also check if shard info is in process.argv (command line)
|
|
375
|
+
// This is a fallback if config doesn't have it but --shard was passed
|
|
376
|
+
if (!playwrightShardInfo && process.argv) {
|
|
377
|
+
const shardArg = process.argv.find(arg => arg && arg.includes('--shard'));
|
|
378
|
+
if (shardArg) {
|
|
379
|
+
const shardMatch = shardArg.match(/--shard[=:]?(\d+)\/(\d+)/);
|
|
380
|
+
if (shardMatch) {
|
|
381
|
+
playwrightShardInfo = {
|
|
382
|
+
current: parseInt(shardMatch[1], 10),
|
|
383
|
+
total: parseInt(shardMatch[2], 10)
|
|
384
|
+
};
|
|
385
|
+
this.log(`🔍 [Shard Detection] Found shard in command line args: ${playwrightShardInfo.current}/${playwrightShardInfo.total}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
352
388
|
}
|
|
353
389
|
|
|
354
390
|
// Step 1: Try GitHub Actions API detection (only if actually in GitHub Actions)
|
|
@@ -366,6 +402,9 @@ class SlackReporter {
|
|
|
366
402
|
// Playwright uses 1-based indexing, convert to 0-based
|
|
367
403
|
currentShardIndex = (playwrightShardInfo.current - 1).toString();
|
|
368
404
|
this.log(`🔍 [Shard Detection] Using Playwright shard config (converted to 0-based): "${currentShardIndex}"`);
|
|
405
|
+
} else if (process.env.SHARD_INDEX !== undefined) {
|
|
406
|
+
currentShardIndex = process.env.SHARD_INDEX;
|
|
407
|
+
this.log(`🔍 [Shard Detection] Using SHARD_INDEX env var: "${currentShardIndex}"`);
|
|
369
408
|
} else if (process.env.MATRIX_SHARD !== undefined) {
|
|
370
409
|
currentShardIndex = process.env.MATRIX_SHARD;
|
|
371
410
|
this.log(`🔍 [Shard Detection] Using MATRIX_SHARD env var: "${currentShardIndex}"`);
|
|
@@ -384,6 +423,9 @@ class SlackReporter {
|
|
|
384
423
|
if (playwrightShardInfo) {
|
|
385
424
|
totalShards = playwrightShardInfo.total;
|
|
386
425
|
this.log(`🔍 [Shard Detection] Using Playwright shard config totalShards: ${totalShards}`);
|
|
426
|
+
} else if (process.env.TOTAL_SHARDS !== undefined) {
|
|
427
|
+
totalShards = parseInt(process.env.TOTAL_SHARDS, 10);
|
|
428
|
+
this.log(`🔍 [Shard Detection] Using TOTAL_SHARDS env var: ${totalShards}`);
|
|
387
429
|
} else if (process.env.MATRIX_COUNT !== undefined) {
|
|
388
430
|
totalShards = parseInt(process.env.MATRIX_COUNT, 10);
|
|
389
431
|
this.log(`🔍 [Shard Detection] Using MATRIX_COUNT env var: ${totalShards}`);
|
package/package.json
CHANGED