Adding batches asynchronously to a Vows suite

78 Views Asked by At

I've got some code like this. The idea is that I'm reading fixture data from files and using the data from each file to add a batch:

// test.js
var vows = require('vows')
  , async = require('async')
  , suite;

exports.suite = suite = vows.describe('My tests');

function run_tests() {
  set_up = [
    find_tests(tests_path)  // gets test data
  ];

  async.series(set_up, function(errs, tests) {
    tests = tests.pop();
    tests.forEach(function(test) {
      var batch = make_batch(test);  // makes a batch 
      suite.addBatch(batch);
    })
  });

}

run_tests();

Obviously vows test.js doesn't find any tests because the batches are added asynchronously. I've got no idea how to make this work though. I want to use vows to be able to use reporters.

0

There are 0 best solutions below