JavaScript Basics

Just a page describing some basic notes on the JavaScript ecosystem.


Server side javascript interpreter. Best off installing the latest one rather than trying tio rely and whatever is packaged with your system.

On Mint (a derivative of Ubuntu), you go here:

I created the following file:


and with the following contents:

deb raring main
deb-src raring main


This is the package manager. It comes with NodeJS. It lets you install other Javascript packages.

You can install things locally, or globally. Generally speaking the -g switch means global.

To see where stuff in installed:

npm root or npm root -g

To see what stuff you have installed:

npm list

That prints out a tree. To make it into just a list, use:

npm list --depth=0


Several choice but the popular ones seems to be

I've settled on Jasmine. It seems very similar to RSpec from the Ruby world. If you want to run Jasmine for backend tests, then you need jasmine-node. Quick way to run all the tests in a project:

jasmine-node spec --autotest --watch .

The "spec" tells you where you tests live. The watch option will watch the directory you specify, so in this case changes to both source and spec files will re-run all the tests. The autotest actually tells jasmine to watch the file system.

I sometimes like to run it like this:

jasmine-node spec --autotest --watch . --color --verbose

The color option will output passing tests in green and failing tests in red. The verbose option will give results for each test, not just the failing ones.


Karma appears to be a test runner centered on running tests in the browser (or, using PhantomJS, the command line). Useful for DOM tests, etc. Not sure how useful this is for simple node backend tests.


Javascript task runner


Scaffolding tool. Basically involves installing a generator to scaffold the app.

yo angular 

to scaffold an agular app, but note that there is a bug whereby some plugins are not installed. You have to follow it with this:

npm install karma-jasmine --save-dev
npm install karma-chrome-launcher --save-dev


Front end package tool. See this:

For a good discussion of the differences between bower and npm.

JavaScriptBasics (last edited 2014-04-14 23:50:06 by DesmondRivet)