playwright-slack-report-burak 3.0.29 → 3.0.30

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.
@@ -686,14 +686,27 @@ class ResultsParser {
686
686
  // Merge blob reports instead of HTML reports to preserve traces
687
687
  if (hasBlobReports && fs.existsSync(blobReportsDir) && fs.readdirSync(blobReportsDir).length > 0) {
688
688
  console.log('\nšŸ”„ Merging blob reports (preserves traces)...');
689
+ let tempConfigPath = null;
689
690
  try {
690
- // Merge blob reports - use absolute path for output-dir to ensure it works correctly
691
+ // Merge blob reports - use config file to specify output directory
691
692
  // This prevents wiping the playwright-report directory
692
693
  const blobReportsRelativePath = path.relative(summariesDir, blobReportsDir);
693
694
  const mergedBlobsAbsolutePath = path.resolve(mergedBlobsDir);
694
695
  console.log(`Merging blob reports from: ${blobReportsRelativePath}`);
695
696
  console.log(`Output directory: ${mergedBlobsAbsolutePath}`);
696
- const mergeCommand = `npx playwright merge-reports --reporter html --output-dir "${mergedBlobsAbsolutePath}" "${blobReportsRelativePath}"`;
697
+
698
+ // Create temporary config file to specify output folder
699
+ tempConfigPath = path.join(summariesDir, 'merge-config.js');
700
+ // Escape backslashes and single quotes in path for JavaScript string
701
+ const escapedPath = mergedBlobsAbsolutePath.replace(/\\/g, '/').replace(/'/g, "\\'");
702
+ const configContent = `module.exports = {
703
+ reporter: [['html', { outputFolder: '${escapedPath}' }]]
704
+ };`;
705
+ fs.writeFileSync(tempConfigPath, configContent);
706
+ console.log(`Created temporary config file: ${tempConfigPath}`);
707
+ console.log(`Config content: ${configContent}`);
708
+
709
+ const mergeCommand = `npx playwright merge-reports --reporter html --config "${tempConfigPath}" "${blobReportsRelativePath}"`;
697
710
  console.log(`Executing: ${mergeCommand}`);
698
711
  const mergeResult = await execAsync(mergeCommand, { cwd: summariesDir });
699
712
  console.log('Merge command output:', mergeResult.stdout);
@@ -718,6 +731,16 @@ class ResultsParser {
718
731
 
719
732
  // Fallback to HTML merge
720
733
  execSync(`npx playwright merge-reports --reporter html -c ./playwright-report playwright-report`, { stdio: 'inherit' });
734
+ } finally {
735
+ // Clean up temporary config file
736
+ if (tempConfigPath && fs.existsSync(tempConfigPath)) {
737
+ try {
738
+ fs.unlinkSync(tempConfigPath);
739
+ console.log(`Cleaned up temporary config file: ${tempConfigPath}`);
740
+ } catch (cleanupError) {
741
+ console.warn(`Warning: Failed to clean up temp config file: ${cleanupError.message}`);
742
+ }
743
+ }
721
744
  }
722
745
  } else {
723
746
  // Fallback to HTML merge if no blob reports found
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "lint-fix": "npx eslint . --ext .ts --fix"
33
33
  },
34
34
  "name": "playwright-slack-report-burak",
35
- "version": "3.0.29",
35
+ "version": "3.0.30",
36
36
  "main": "index.js",
37
37
  "types": "dist/index.d.ts",
38
38
  "author": "Burak B. <burak.boluk@hotmail.com>",