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

Doesn't exclude node_modules files #28

Open
stevenvachon opened this issue Apr 25, 2019 · 2 comments
Open

Doesn't exclude node_modules files #28

stevenvachon opened this issue Apr 25, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@stevenvachon
Copy link

stevenvachon commented Apr 25, 2019

nyc's --exclude-node-modules option (which defaults to true) seems to be ignored by this plugin.

I have this puppeteer code in my test file:

page.addScriptTag({ path: 'node_modules/chai/chai.js' });

If I specifically exclude the above file with nyc, my test throws:

Error: Evaluation failed: ReferenceError: cov_64pz3sne0 is not defined
    at __puppeteer_evaluation_script__:1:7
      at ExecutionContext.evaluateHandle (node_modules/puppeteer/lib/ExecutionContext.js:121:13)
      at process._tickCallback (internal/process/next_tick.js:68:7)
    -- ASYNC --
      at ExecutionContext.<anonymous> (node_modules/puppeteer/lib/helper.js:110:27)
      at ExecutionContext.evaluate (node_modules/puppeteer/lib/ExecutionContext.js:48:31)
      at ExecutionContext.<anonymous> (node_modules/puppeteer/lib/helper.js:111:23)
      at DOMWorld.evaluate (node_modules/puppeteer/lib/DOMWorld.js:105:20)
      at process._tickCallback (internal/process/next_tick.js:68:7)
    -- ASYNC --
      at Frame.<anonymous> (node_modules/puppeteer/lib/helper.js:110:27)
      at Page.evaluate (node_modules/puppeteer/lib/Page.js:809:43)
      at Page.<anonymous> (node_modules/puppeteer/lib/helper.js:111:23)
      at Context.before (test.js:1:4248)
      at process._tickCallback (internal/process/next_tick.js:68:7)
@stevenvachon
Copy link
Author

I was able to work around this with:

let coverage = await page.coverage.stopJSCoverage();

// Exclude chai.js
coverage = coverage.filter(({url}) => !url.includes('chai'));

puppeteerCoverage.write(coverage);

@bcoe
Copy link
Member

bcoe commented May 1, 2019

@stevenvachon haven't been putting too many cycles into this library recently, and there's a chance that puppeteer-to-istanbul, c8, and nyc have diverged a bit; would love some help addressing some of these issue.

If you want to strike up a conversation with me (a fellow Torontonian I might add) about puppeteer-to-istnabul, there's a slack available here:

http://devtoolscommunity.herokuapp.com/

@bcoe bcoe added the bug Something isn't working label May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants