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

Running Test Outside Browser Transpiled with Webpack Fails #69

Closed
fabioberger opened this issue Mar 13, 2016 · 1 comment
Closed

Running Test Outside Browser Transpiled with Webpack Fails #69

fabioberger opened this issue Mar 13, 2016 · 1 comment

Comments

@fabioberger
Copy link

Hi,

I'm trying to use fetch-mock in my mocha tess. The tests are put through webpack and then run via the mocha command in terminal. When I do this however, I get the following error related to requiring fetch-mock:

/built/bundle.js:8147
        theGlobal: window,
                   ^

ReferenceError: window is not defined
    at Object.i (/Users/fabioberger/Projects/js/dali-client/tests/built/bundle.js:8147:14)

It seems that window is not defined when running the webpack generated bundle.js outside of the browser. Is there a work around to this?

Thanks!

@fabioberger
Copy link
Author

It turns out I needed to add the flag --target node to my webpack command.

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