You can download NodeJs on the home page, using Homebrew, or MacPorts, relatively simple and straight forward.
Now we can create three files, the core module ( sum.js ), the run harness ( run.js ), and the test( test.js ).
sum.js
run.js
test.js
Now to see it in action.