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

Errors when using persistent views with Jest's --collectCoverage #8129

Closed
tom-sherman opened this issue Jul 5, 2020 · 3 comments
Closed
Labels

Comments

@tom-sherman
Copy link

tom-sherman commented Jul 5, 2020

Reproduction repo here: https://github.com/tom-sherman/jest-pouch-coverage-bug

    evalmachine.<anonymous>:36
              cov_29pxonmpdk().f[2]++;
              ^
    
    ReferenceError: cov_29pxonmpdk is not defined
        at evalmachine.<anonymous>:36:11
        at evalmachine.<anonymous>:39:11
        at evalmachine.<anonymous>:39:156
        at Script.runInContext (vm.js:131:20)
        at Script.runInNewContext (vm.js:137:17)
        at Object.runInNewContext (vm.js:304:38)
        at C:\Users\Tom\code\jest-pouch-coverage-bug\node_modules\pouchdb\lib\index.js:7769:21
        at tryMap (C:\Users\Tom\code\jest-pouch-coverage-bug\node_modules\pouchdb\lib\index.js:7973:7)    
        at createDocIdsToChangesAndEmits (C:\Users\Tom\code\jest-pouch-coverage-bug\node_modules\pouchdb\lib\index.js:8427:13)
        at processBatch (C:\Users\Tom\code\jest-pouch-coverage-bug\node_modules\pouchdb\lib\index.js:8410:37)

I believe this is the same issue as described in the Jest repo here: jestjs/jest#7962

I don't think there is anything that can be done on the pouchdb side, it's a side effect of evaling the code in a scope that doesn't include the jest coverage collectors.

Maybe a section in the docs could help to prevent others being tripped up by this in the future?

@tom-sherman
Copy link
Author

One thing I've thought about is having the views seperated out into their own files, we can then ignore the whole directory from coverage collection with Jest's config without ignoring excess code that doesn't need to be ignored.

@github-actions
Copy link

github-actions bot commented Aug 5, 2020

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the stale label Aug 5, 2020
@tom-sherman
Copy link
Author

Bumb

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

No branches or pull requests

1 participant