mocha-webpack icon indicating copy to clipboard operation
mocha-webpack copied to clipboard

RUNTIME EXCEPTION Exception occurred while loading your tests undefined

Open leighman opened this issue 6 years ago • 7 comments

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.

leighman avatar Oct 16 '17 16:10 leighman

i got

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

But my target is browser, not node.

sukrosono avatar Oct 20 '17 14:10 sukrosono

@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.

zinserjan avatar Oct 25 '17 15:10 zinserjan

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

sukrosono avatar Oct 26 '17 12:10 sukrosono

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.

zinserjan avatar Oct 27 '17 18:10 zinserjan

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

sukrosono avatar Nov 16 '17 04:11 sukrosono

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 avatar May 11 '18 15:05 SSmale

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

SSmale avatar May 12 '18 13:05 SSmale