mojotech / pioneer

Integration Testing
MIT License
527 stars 35 forks source link

[RFC] .js config instead of .json #324

Open StevenLangbroek opened 9 years ago

StevenLangbroek commented 9 years ago

By switching to a .js instead of .json configuration, it would be easier to move all configuration into the actual config file (for example the driver builder and output formatting), and to configure at runtime (based on whatever you like). Think grunt or karma. I imagine this would look something like this:

var mocks = require('./mocks');
var cucumber = require('cucumber-junit');
var fs = require('fs');

module.exports = function(pioneer){
  return pioneer.config({
    format: 'json',
    output: './spec/results/integration.xml',
    before: function(){
      return mocks.start();
    },

    after: function(results){
      fs.writeFileSync(this.output, cucumber(results));
      mocks.stop();
    }
  });
}