Using Jasmine in a BDD style.
To run it and get feedback you have some options whose I take two: seeing the html file on browser and seeing the terminal result as rspec way. We will do the second way. For that we will use: node.js, npm and jessie.
git clone --depth 1 git://github.com/joyent/node.git cd node git checkout v0.4.11 #opt, note that master is unstable. export JOBS=2 #opt, sets number of parallel commands. mkdir ~/local ./configure --prefix=$HOME/local/node make make install echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.profile echo 'export NODE_PATH=$HOME/local/node:$HOME/local/node/lib/node_modules' >> ~/.profile source ~/.profile
npm – node package manager, as its own name suggest. You can use it to install and publish your node programs. It manages dependencies and does other cool stuff.
curl http://npmjs.org/install.sh | sh
jessie – Jessie is a Node runner for Jasmine. It was created to provide better reporting on failures, more modular design, easier creation of formatters and optional syntactic sugar.
npm install jessie
With all these binaries on your path you can just run your tests from terminal typing:
jessie folder_with_specs/ -f nested
Se tivermos uma classe Calculadora.js e Calculadora.spec.js, como importo a primeira na segunda executando no console?