jasmine-extract

extract info about jasmine specs

jasmine-extract

extract jasmine specs so you can add them to your docs

npm install jasmine-extract

Requires esprima.

Takes an AST, returns an object corresponding to the test structure:

var esprima = require('esprima');
var fs      = require('fs');
var extract = require('../extract');
 
 
var contents = fs.readFileSync(__dirname + '/input.spec.js', 'utf8');
var ast = esprima.parse(contents, {range: false});
console.log(extract(ast));
 
// logs this: 
// 
// { before: [], 
//   beforeEach: [], 
//   its: {}, 
//   describes: 
//    { foo: 
//       { before: [Object], 
//         beforeEach: [Object], 
//         its: [Object], 
//         describes: {} } } } 

MIT