rarebreed / quartermaster

0 stars 0 forks source link

Figure out how to get jasmine working with quartermaster #2

Closed rarebreed closed 7 years ago

rarebreed commented 7 years ago

Because cockpit.js is not available as a node module, that means anything using cockpit.js needs to be able to run inside the browser itself.

This is somewhat complicated, as it means that you have to effectively make any program or even unit tests requiring this dependency to run inside the browser where it runs from the cockpit server. In other words, we have to make a plugin such that the plugin hosts the jasmine dependencies as well as all the unit/integration tests.

rarebreed commented 7 years ago

I wonder if it is worth the effort to ask the cockpit devs to separate out the cockpit.js as a node module.

Another reason is that the cockpit.js is only available in it's minified form and without a source map. This makes debugging very difficult

rarebreed commented 7 years ago

This is working, although there's a bit of strangeness. When you test async functions (eg anything in a promise or a stream) you have to pass a 'done' variable into the it() function handler. This done variable is in fact a method. After your expect call, you have to make a call to done().