playwright-slack-report-burak 3.0.19 → 3.0.20
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 +1 -42
- package/package.json +1 -1
|
@@ -44,23 +44,11 @@ class ResultsParser {
|
|
|
44
44
|
? parseInt(process.env.MATRIX_SHARD, 10)
|
|
45
45
|
: (process.env.MATRIX_INDEX !== undefined ? parseInt(process.env.MATRIX_INDEX, 10) : 0));
|
|
46
46
|
|
|
47
|
-
// Determine if we're using 1-based indexing (workflow-style) or 0-based
|
|
48
|
-
// This is detected by checking if artifacts exist with 1-based naming
|
|
49
|
-
isOneBasedIndexing = false;
|
|
50
47
|
constructor(options = { separateFlakyTests: false }) {
|
|
51
48
|
this.result = [];
|
|
52
49
|
this.separateFlakyTests = options.separateFlakyTests;
|
|
53
50
|
// Log package version
|
|
54
51
|
console.log(`📦 [ResultsParser] playwright-slack-report-burak v${packageVersion}`);
|
|
55
|
-
// Log shard detection in ResultsParser
|
|
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'}`);
|
|
59
|
-
console.log(`🔍 MATRIX_SHARD env: ${process.env.MATRIX_SHARD !== undefined ? `"${process.env.MATRIX_SHARD}"` : 'undefined'}`);
|
|
60
|
-
console.log(`🔍 MATRIX_INDEX env: ${process.env.MATRIX_INDEX !== undefined ? `"${process.env.MATRIX_INDEX}"` : 'undefined'}`);
|
|
61
|
-
console.log(`🔍 MATRIX_COUNT env: ${process.env.MATRIX_COUNT !== undefined ? `"${process.env.MATRIX_COUNT}"` : 'undefined'}`);
|
|
62
|
-
console.log(`🔍 Calculated shardIndex: ${this.shardIndex}`);
|
|
63
|
-
console.log(`🔍 Calculated totalShardCount: ${this.totalShardCount}`);
|
|
64
52
|
}
|
|
65
53
|
/**
|
|
66
54
|
* Update shard information after detection (e.g., from GitHub API)
|
|
@@ -70,7 +58,6 @@ class ResultsParser {
|
|
|
70
58
|
updateShardInfo(shardIndex, totalShardCount) {
|
|
71
59
|
this.shardIndex = shardIndex;
|
|
72
60
|
this.totalShardCount = totalShardCount;
|
|
73
|
-
console.log(`🔍 [ResultsParser] Updated shard info: shardIndex=${this.shardIndex}, totalShardCount=${this.totalShardCount}`);
|
|
74
61
|
}
|
|
75
62
|
async getParsedResults() {
|
|
76
63
|
const summary = {
|
|
@@ -127,27 +114,17 @@ class ResultsParser {
|
|
|
127
114
|
// Create the file
|
|
128
115
|
fs.writeFileSync(nodeSummaryFile, JSON.stringify(nodeSummary, null, 2));
|
|
129
116
|
|
|
130
|
-
console.log(`🔍 [ResultsParser] Current shard: ${this.shardIndex}, Total shards: ${this.totalShardCount}`);
|
|
131
|
-
console.log(`🔍 [ResultsParser] Created node summary file: ${nodeSummaryFile}`);
|
|
132
|
-
|
|
133
117
|
if (this.shardIndex === 1 && this.totalShardCount > 1) {
|
|
134
|
-
console.log(`🔍 [ResultsParser] Shard 1 detected with ${this.totalShardCount} total shards - will fetch artifacts from other shards`);
|
|
135
118
|
if (process.env.CI) {
|
|
136
|
-
console.log('🔍 [ResultsParser] CI environment detected - fetching all artifacts from GitHub Actions...');
|
|
137
119
|
await this.fetchAllArtifacts();
|
|
138
120
|
} else {
|
|
139
|
-
console.log('🔍 [ResultsParser] Local environment - waiting for artifacts to appear...');
|
|
140
121
|
while (!this.allNodeSummaryFilesExist() || !this.allBlobZipsExist()) {
|
|
141
|
-
console.log('🔍 [ResultsParser] Waiting for all artifacts to exist...');
|
|
142
122
|
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second
|
|
143
123
|
}
|
|
144
124
|
}
|
|
145
|
-
} else {
|
|
146
|
-
console.log(`🔍 [ResultsParser] Not shard 1 (current: ${this.shardIndex}) or single shard (total: ${this.totalShardCount}) - skipping artifact fetch`);
|
|
147
125
|
}
|
|
148
126
|
|
|
149
127
|
if (this.shardIndex === 1 && this.allNodeSummaryFilesExist() && this.allBlobZipsExist()) {
|
|
150
|
-
console.log(`🔍 [ResultsParser] Shard 1: All artifacts available, merging results from all shards...`);
|
|
151
128
|
// Merge all node summaries into the final summary
|
|
152
129
|
// Loop from 1 to totalShardCount (1-based indexing)
|
|
153
130
|
for (let i = 1; i <= this.totalShardCount; i++) {
|
|
@@ -448,21 +425,6 @@ class ResultsParser {
|
|
|
448
425
|
await this.fetchArtifactFromGitHubActions(i, file, filePath);
|
|
449
426
|
}
|
|
450
427
|
|
|
451
|
-
// Helper to extract shard index from artifact name
|
|
452
|
-
extractShardIndexFromArtifactName(artifactName, i) {
|
|
453
|
-
// Try to extract number from artifact name (e.g., html-report-1 -> 1)
|
|
454
|
-
const match = artifactName.match(/-(\d+)$/);
|
|
455
|
-
if (match) {
|
|
456
|
-
const artifactShard = parseInt(match[1], 10);
|
|
457
|
-
// Artifacts use 1-based indexing, and we now use 1-based internally
|
|
458
|
-
// html-report-1 (workflow) -> shard 1 (internal)
|
|
459
|
-
// html-report-2 (workflow) -> shard 2 (internal)
|
|
460
|
-
return artifactShard;
|
|
461
|
-
}
|
|
462
|
-
// Fallback to the provided index
|
|
463
|
-
return i;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
428
|
async fetchArtifactFromGitHubActions(i, file, filePath) {
|
|
467
429
|
const githubToken = process.env.SAFETYWINGTEST_GITHUB_TOKEN;
|
|
468
430
|
const repo = process.env.GITHUB_REPOSITORY;
|
|
@@ -563,10 +525,7 @@ class ResultsParser {
|
|
|
563
525
|
const extractPath = path.join(path.dirname(filePath), `temp-artifact-${i}`);
|
|
564
526
|
zip.extractAllTo(extractPath, true);
|
|
565
527
|
|
|
566
|
-
//
|
|
567
|
-
const artifactShardIndex = this.extractShardIndexFromArtifactName(artifact.name, i);
|
|
568
|
-
|
|
569
|
-
// Look for the file recursively, also try with shard index from artifact name
|
|
528
|
+
// Look for the file recursively
|
|
570
529
|
const searchInDir = (dir, targetFile, alternateTargetFile = null) => {
|
|
571
530
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
572
531
|
for (const entry of entries) {
|
package/package.json
CHANGED