Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run coverage report on actual website #27

Open
SwetlinaSatpathy opened this issue Apr 17, 2019 · 1 comment
Open

Unable to run coverage report on actual website #27

SwetlinaSatpathy opened this issue Apr 17, 2019 · 1 comment

Comments

@SwetlinaSatpathy
Copy link

Hi,

I have recently started using puppeteer for my frontend project.
Want to run coverage report. Tried using the example in https://github.com/bcoe/puppeteer-to-istanbul-example
But this solution works for static js file as in example.
When I replace the URL with some website URL, it doesn't work.

code -

const path = require('path')
const pti = require('puppeteer-to-istanbul')

;(async () => {
  const puppeteer = require('puppeteer')
  const browser = await puppeteer.launch()
  const page = await browser.newPage()

  // Enable both JavaScript and CSS coverage
  await Promise.all([
    page.coverage.startJSCoverage(),
    page.coverage.startCSSCoverage()
  ])

  // Navigate to page
  let url = 'file:///' + path.resolve('./index.html')  
  // await page.goto(url);
  await page.goto('https://www.google.com');

  // Disable JavaScript coverage
  const jsCoverage = await page.coverage.stopJSCoverage()
  pti.write(jsCoverage)
  await browser.close()
})()

I get the below error -

(node:132032) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'D:\Puppeteer\puppeteer-code-coverage-on-google.nyc_output\js\m=sb_wiz,aa,abd,async,dvl,foot,ifl,lu,m,mu,sf,spch,wft,xz7cCd,fEVMic?xjs=s1.js'

image
image

My repo link - https://github.com/SwetlinaSatpathy/puppeteer-code-coverage-on-google

@tinkerology
Copy link

Does anyone have a workaround for this issue on Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants