Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to test an AngularJS/SocketStream/Node.js app using Karma
    primarykey
    data
    text
    <p>I am working on an AngularJS application that is delivered by a SocketStream/node.js server. I have an AngularJS service that calls api functions on the SocketStream server and progress has been good so far.</p> <p>But now the time has come to start writing the first tests and the first testing framework that came to mind is Karma/Jasmine, since this is the recommend AngularJS set up.</p> <p>So far so good, but since my AngularJS modules are imported using 'require' (SocketStream's version, <em>not</em> require.js) and server api calls are part of the test, I need to configure Karma to load SocketStream (at least its client side).</p> <p>I took a good look at '<a href="https://github.com/yiwang/angular-phonecat-livescript-socketstream" rel="nofollow">https://github.com/yiwang/angular-phonecat-livescript-socketstream</a>' but when I run this example I get run time errors, possibly because I have later versions of variuous dependencies installed.</p> <p>I managed to get 'required' resolved by packing my SocketStream app by adding 'ss.client.packAssets()' to app.js and run 'SS_PACK=1 node app.js', but when I start karma it logs an error message saying:</p> <pre><code>'Chrome 23.0 (Linux) ERROR Uncaught TypeError: undefined is not a function at /the...path/client/static/assets/app/1368026081351.js:25' </code></pre> <p>'1368026081351.js' is the SocketStream packed assets file. If I don't load it the error message is something like 'require is undefined', so my best guess is that the error is happening somewhere inside the SocketStream require code. Also because I run karma in DEBUG mode and can see all the files being served.</p> <p>I have been trying different approaches as to find out what is happening but to now avail. So my questions are:</p> <p>Is anybody else successfully testing AngularJS/SocketStream using Karma? Does anybody have any suggestions as to how I can fix, or at least debug this problem? Are there any alternatives/better solutions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload