Pivatol recently added better node.js support to Jasmine in 2.0 and plans to release an official NPM package. For now you can use it from node by following the implementation used in their own node test suite.
Here is a brief explanation into what is happening under the covers in the code you wrote:
jasmine = jasmine.core(jasmine);
When you initially require('jasmine') you are getting back a single function, getJasmineRequiredObj(); By calling jasmine.core(jasmine), you are tell jasmine to return it's behavioral methods using node exports
statements instead of adding them onto the window.jasmineRequire object.
https://github.com/pivotal/jasmine/blob/master/src/core/requireCore.js
function getJasmineRequireObj() {
if (typeof module !== 'undefined' && module.exports) {
return exports;
} else {
window.jasmineRequire = window.jasmineRequire || {};
return window.jasmineRequire;
}
}
// jRequire is window.jasmineRequire in a browser or exports in node.
getJasmineRequireObj().core = function(jRequire) {
var j$ = {};
jRequire.base(j$);
j$.util = jRequire.util();
j$.Any = jRequire.Any();
...
return j$; // here is our jasmine object with all the functions we want.
};
jasmineConsole.console(jasmineConsole, jasmine)
Jasmine initializes it's core functions separately from it's reporters. This statement is essentially the same thing as jasmine.core(jasmine) only for the console reporter.
https://github.com/pivotal/jasmine/blob/master/src/console/requireConsole.js