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

Error when used with global document provided by jsdom #39

Open
amadsen opened this issue Jun 16, 2017 · 2 comments
Open

Error when used with global document provided by jsdom #39

amadsen opened this issue Jun 16, 2017 · 2 comments

Comments

@amadsen
Copy link

amadsen commented Jun 16, 2017

We are setting up a global document, as recommended by enzyme to support some of our tests - using nyc's require configuration to load it before any of the tests start. Unfortunately, this causes tests errors to be reported as

ReferenceError: location is not defined
    at Object.exports.stackTraceFilter ({project root}/node_modules/tap-mocha-reporter/lib/utils.js:651:9)
...

This happens because lib/utils.js tests to see if it is in node or a browser by looking for a defined global document.

is = typeof document === 'undefined'
      ? { node: true }
      : { browser: true }

This is reasonable, but can lead to errors like the one we are experiencing where a global document has been mocked.

@amadsen
Copy link
Author

amadsen commented Jun 16, 2017

I will submit a pull request that modifies the is.node|browser check to be based (additionally) off of process.release, to work around use cases like mine.

@amadsen
Copy link
Author

amadsen commented Jun 19, 2017

Pull request submitted: #40

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

1 participant