While on vacation, I have spent much of my chain making little tweaks here and there, but the learning went on the back burner. I pick back up with that starting with vows.js, which claims to be BDD for node.js. I am none too sure how well it will work with fab.js, but I am eager to find out!
The vows.js documentation is quite detailed, possibly to a fault, but install is simple enough:
cstrom@whitefall:~/repos/my_fab_game$ npm install vowsRunning the new executable, I get:
The "ini" module will be removed in future versions of Node, please extract it into your own code.
npm configfile /home/cstrom/.npmrc
npm sudo false
npm cli [ 'install', 'vows' ]
npm install pkg vows
npm fetch data vows
npm GET vows
npm install pkg vows
npm install pkg vows@0.4.5
npm readJson /home/cstrom/.node_libraries/.npm/.cache/vows/0.4.5/package.json
npm GET vows/0.4.5
...
npm ok
cstrom@whitefall:~/repos/my_fab_game$ vowsOK. I need to add a test folder and in there, I create a
vows runner couldn't find test folder
vows runner exiting
test/just_playing.js
suite:var suite = vows.describe('just_playing');So there is one
describe
per test file. It describes the suite of tests in the file (hence the name). That is a bit different from describe
blocks in RSpec, of which there can be multiple in a single file.Running
vows
now, however, I get:cstrom@whitefall:~/repos/my_fab_game$ vowsGah! I am terrible about skipping ahead too quickly in the documentation. I need to
/home/cstrom/repos/my_fab_game/test/just_playing.js:1
var suite = vows
^
ReferenceError: vows is not defined
at Object.<anonymous> (/home/cstrom/repos/my_fab_game/test/just_playing.js:1:63)
at Module._compile (module:384:23)
at Module._loadScriptSync (module:393:16)
at Module.loadSync (module:296:10)
at loadModule (module:241:16)
at require (module:364:12)
at /home/cstrom/bin/vows:326:19
at Array.reduce (native)
at importSuites (/home/cstrom/bin/vows:325:18)
at Object.<anonymous> (/home/cstrom/bin/vows:168:15)
require
the vows
module (and the assert
module while I am at it):var vows = require('vows'),Now when I run
assert = require('assert');
var suite = vows.describe('just_playing');
vows
, I get:cstrom@whitefall:~/repos/my_fab_game$ vowsAh, Progress.
undefined » (0.000s)
That is about as far as I am going to make it tonight. Up tomorrow, converting my existing fab.js based tests over to vows.js. I have the feeling that full stack testing of my chained fab.js apps will prove too difficult to test, but that's what mechanized Cucumber is for. Hopefully vows.js can put me in a better position that where I am at right now with respect to BDD...
Day #151
No comments:
Post a Comment