busterjs / buster

Abandoned - A powerful suite of automated test tools for JavaScript.
http://docs.busterjs.org
Other
448 stars 37 forks source link

Support for custom configuration options in config file #226

Open singles opened 12 years ago

singles commented 12 years ago

Now there's no option to add additional unknown key to configuration file, because adding it leads to getting "undefined" in output instead of running tests. Considering:

To avoid wasting your time on typos and misunderstandings, Buster will fiercefully throw errors if you feed it configuration properties it does not recognize

maybe there should be one more key: custom, which will be added to config keys whitelist, when you can put whatever you want.

Why? It could be good place for config like: remote server host or reporter setting, which then could be parsed by build tool in order to run tests by one simple command.

cjohansen commented 12 years ago

Actually, settings like reporter and server etc is consciously not allowed in the configuration file. The configuration file is intended to contain settings specific to the project. Settings that pertain to individual runs or personal preference can be provided on the command-line, in ~/.buster.js or in environment variables.

Still, leaving one slot open for custom settings that buster silently ignores would possibly be useful. Could you also do this without adding those to the exported object? I.e.:

var config = module.exports;
config["Browser tests"] = {
    ...
};

var custom = { ... };
singles commented 12 years ago

When I would like to require that file in Cake, and if I do like you wrote, it isn't accessible. this.custom is.

But hey, It's just a suggestion :)