zinserjan / mocha-webpack

mocha test runner with integrated webpack precompiler
http://zinserjan.github.io/mocha-webpack/
MIT License
486 stars 75 forks source link

RUNTIME EXCEPTION Exception occurred while loading your tests undefined #181

Open leighman opened 7 years ago

leighman commented 7 years ago

When trying to run my tests I get

 RUNTIME EXCEPTION  Exception occurred while loading your tests

undefined

Please advise how I can debug this.

It seems to happen when trying to import from on particular Vue file but I can't narrow it down any more at the moment.

sukrosono commented 7 years ago

i got

 RUNTIME EXCEPTION  Exception occurred while loading your tests
document is not defined.

But my target is browser, not node.

zinserjan commented 7 years ago

@leighman Seems that there is no stack for your error. I'm happy to receive a PR for a better error logging for this and this. Probably something like err.stack || err.message || "unknown error"could work.

@brutalcrozt Document does not exist on node. You need to use jsdom or something else to simulate browsers environment.

sukrosono commented 7 years ago

My bundle target is browser. So this module doesn't support browser target? only support node target?

zinserjan commented 7 years ago

There's no browser environment per default in mocha or mocha-webpack. You need to use jsdom or a test runnner that runs against real browser like karma-webpack.

sukrosono commented 6 years ago

@zinserjan Thanks for info and your cooperation. But can you give explicit note on readme, that your module by default only support node script?

SSmale commented 6 years ago

Hi,

I am having the same issue as @leighman, and i believe it is erroring on an ES6 import statement in Vue (import { getters } from "../src/store/modules/tickets/index), commenting this out allows them to run

test module

./node_modules/.bin/mocha-webpack "test/**/*.test.js" --webpack-config build/webpack.test.conf.js returns the same error

Please let me know if there is any other info you need

Thanks Simon

SSmale commented 6 years ago

I was able to fix my issue, I was exporting firebase.auth() and not firebase.auth, not sure why it broke the test though