crisptrutski / boot-cljs-test

Boot task to run ClojureScript tests.
53 stars 18 forks source link

ReferenceError: window is not defined #44

Closed learningcljs closed 8 years ago

learningcljs commented 8 years ago

For full context of when this error is happening please see magomimmo/modern-cljs#338.

It is my undertanding that node.js does not have a window object.

bensu commented 8 years ago

Hi @learningcljs

If you are trying to use window on node you are going to get the error. Depending on the functionality you need, you might want to mock it inwindow. The error is not related to boot-cljs-test but rather an inherent limitation of the runner. Is this the case?

learningcljs commented 8 years ago

What happend is when I used -e node I got the ReferenceError: window is not defined. I did not specifically try to use the window object in node.js.

I was just thinking that this could potentially be improved so that when node is selected the window object could be avoided preventing the error message.

bensu commented 8 years ago

Did some of your dependencies try to use the window?

Mocking window is not such a good idea since there is so much to mock, that the fact your dependency uses it is an indicator that it is not meant to run on Node.

magomimmo commented 8 years ago

@learningcljs you could eventually use this: https://www.npmjs.com/package/mock-browser but I never tested it.

learningcljs commented 8 years ago

Thanks @bensu @magomimmo

crisptrutski commented 8 years ago

Unless the window reference was in the inject test runner itself, this sounds like a project-level issue.

Thanks to the other vigilant and knowledgable followers for helping out 😄