<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shikha </title>
    <description>The latest articles on DEV Community by Shikha  (@sbharti).</description>
    <link>https://dev.to/sbharti</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3579826%2F018c44ca-3ab4-4bed-a8e2-d281932f7431.png</url>
      <title>DEV Community: Shikha </title>
      <link>https://dev.to/sbharti</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sbharti"/>
    <language>en</language>
    <item>
      <title>Issue Summary: Component Code Coverage Report Not Generated in Jenkins</title>
      <dc:creator>Shikha </dc:creator>
      <pubDate>Thu, 23 Oct 2025 13:47:51 +0000</pubDate>
      <link>https://dev.to/sbharti/issue-summary-component-code-coverage-report-not-generated-in-jenkins-ml3</link>
      <guid>https://dev.to/sbharti/issue-summary-component-code-coverage-report-not-generated-in-jenkins-ml3</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqb6j3iqnsantp0azjo9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqb6j3iqnsantp0azjo9.png" alt=" " width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dw6m9fe60xjx1tp0gwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dw6m9fe60xjx1tp0gwi.png" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am currently working on the task “Implement code coverage feature for Component Tests”. The coverage report is generated successfully in the local environment; however, the same report is not being generated on Jenkins. On Jenkins, I am only able to see the bundled files — the processed coverage reports are missing.&lt;/p&gt;

&lt;p&gt;✅ Local Result&lt;br&gt;
Coverage report is generated successfully.&lt;br&gt;
Coverage files and summary reports are visible.&lt;/p&gt;

&lt;p&gt;❌ Jenkins Result&lt;br&gt;
Only bundle files are generated.&lt;br&gt;
Coverage summary and processed coverage reports are not produced.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration Used:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Coverage Setup in browser-manager.ts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;public static async startJSCoverage() {&lt;br&gt;
  console.log('!!! Starting JS !!!');&lt;br&gt;
  await this.page.coverage.startJSCoverage();&lt;br&gt;
}&lt;br&gt;
public static async stopJSCoverage() {&lt;br&gt;
  console.log('!!! Stopping JS !!!');&lt;br&gt;
  const jsCoverage = await this.page.coverage.stopJSCoverage();&lt;br&gt;
  console.log('!!! JS Coverage Collected:', jsCoverage.length &amp;gt; 0 ? jsCoverage : 'No JS coverage data.');&lt;br&gt;
  return jsCoverage;&lt;br&gt;
}&lt;br&gt;
// Generate coverage files&lt;br&gt;
public static async generateCoverageFiles(): Promise {&lt;br&gt;
  const coverage = await this.stopJSCoverage();&lt;/p&gt;

&lt;p&gt;if (!coverage.length) {&lt;br&gt;
    console.log('No coverage data was collected.');&lt;br&gt;
    return;&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;// Ensure coverage directory exists&lt;br&gt;
  fs.mkdirSync('coverage', { recursive: true });&lt;/p&gt;

&lt;p&gt;// Save coverage data as JavaScript file&lt;br&gt;
  const fullCoverageJSPath = path.resolve('coverage', 'coverage.js');&lt;br&gt;
  const jsContent = &lt;code&gt;const coverageData = ${JSON.stringify(coverage, null, 2)};&lt;/code&gt;;&lt;br&gt;
  fs.writeFileSync(fullCoverageJSPath, jsContent, 'utf-8');&lt;br&gt;
  console.log(&lt;code&gt;Coverage data saved at: ${fullCoverageJSPath}&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;const processCoverageFile = async (fileCoverage: any, fileIdentifier: string) =&amp;gt; {&lt;br&gt;
    if (!fileCoverage) {&lt;br&gt;
      console.log(&lt;code&gt;${fileIdentifier} coverage not found.&lt;/code&gt;);&lt;br&gt;
      return;&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const filePath = path.resolve('coverage', `${fileIdentifier}.json`);

try {
  const converter = v8toIstanbul(filePath, 0, { source: fileCoverage.source });
  await converter.load();
  converter.applyCoverage(fileCoverage.functions);

  const istanbulCoverage = converter.toIstanbul();

  fs.writeFileSync(filePath, JSON.stringify(istanbulCoverage, null, 2), 'utf-8');
  console.log(`Coverage report saved at: ${filePath}`);

  const jsFilePath = filePath.replace('.json', '.js');
  fs.writeFileSync(
    jsFilePath,
    `const ${fileIdentifier.replace(/\W/g, '_')} = ${JSON.stringify(istanbulCoverage, null, 2)};`,
    'utf-8',
  );
  console.log(`Coverage JS file saved at: ${jsFilePath}`);

} catch (error) {
  console.error(`Error processing ${fileIdentifier} coverage:`, error);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;for (const entry of coverage) {&lt;br&gt;
    const fileName = entry.url.split('/').pop();&lt;br&gt;
    if (fileName) {&lt;br&gt;
      await processCoverageFile(entry, fileName);&lt;br&gt;
    }&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;console.log('Test coverage processing completed.');&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;2. Jenkins QA Configuration&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;npm_e2etest: {&lt;br&gt;
  script {&lt;br&gt;
    echo "Starting npm_e2etest..."&lt;br&gt;
    try {&lt;br&gt;
      npm().run("swb:e2e")&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  if (fileExists("coverage/summary")) {
    echo "Directory 'coverage/summary' exists after the tests."
  } else {
    echo "Directory 'coverage/summary' does NOT exist after the tests."
  }

} catch (Exception e) {
  echo "Error occurred during e2e tests: ${e}"
  currentBuild.result = 'FAILURE'
  throw e

} finally {
  echo "Publishing Junit Test Results report..."

  try {
    npm().run("nyc-report")
    npm().run("nyc-report-format-generator")

    echo "Running JUnit Report..."

    echo "Archiving screenshots..."
    archiveArtifacts artifacts: '**/test-results/**/*.png', allowEmptyArchive: true

    echo "Archiving Playwright HTML Report..."

    echo "Archiving NYC coverage reports..."
    archiveArtifacts artifacts: 'coverage/summary/**/*', allowEmptyArchive: true

    if (fileExists("./coverage/summary/coverage.txt")) {
      echo "Reading E2E Tests Coverage Report..."
      def e2eRawReport = readFile("./coverage/summary/coverage.txt")
      def e2eCoverageReport = e2eRawReport.split('\n').take(4).join('\n')
      addCommentsInPullRequest("### E2E Tests Coverage Report\n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
")
        } else {
          echo "Coverage report file not found: ./coverage/summary/coverage.txt"
        }
      }
    }
  }
}

**Tools/Framework Used**

Playwright for Component Tests
V8-to-Istanbul converter for coverage
NYC report generator
Jenkins for CI

📌 Support Needed

I need assistance to identify why the coverage summary and processed coverage reports are not generated on Jenkins, even though the same configuration works locally. Any guidance or recommendations to align the Jenkins execution with the local coverage process would be helpful.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>programming</category>
      <category>playwright</category>
      <category>testing</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
