Pregunta

I am trying to use Karma with Mocha over a NodeJS project, and I get an error:

"Module name "TestStub" has not been loaded yet for context: _. Use require([]) http://requirejs.org/docs/errors.html#notloaded"

Not sure where am I supposed to add the test stub file.

In addition, when I configured Karma using "Karma init" I asked for being able to use requireJS, but don't where are the config files to be added to Karma. There's a config file for the tests and another one for the code and I'll need to include both.

¿Fue útil?

Solución

Karma is for browser testing. If you want to test your server side nodejs code with karma, you will fail... Maybe you can do integration tests which can check the response of your nodejs application by hand-made http requests, but that's all...

Almost everything about how to use karma with requirejs is well documented here.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top