busterjs / buster

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

Possibility to resolve buster config from external(none node) tool #388

Closed rundis closed 9 years ago

rundis commented 10 years ago

Ref discussion on mailinglist

dwittner commented 9 years ago

@rundis, do you still need this feature?

buster-configuration exports a method loadConfigurationFile which loads a given config file and returns a config object. JSON.stringifying that object produces for this config file:

var config = module.exports;

config.Tests = {
    environment: "node",
    tests: ["test/*-test.js"]
};

that JSON:

{"groups":[{"config":{"environment":"node","tests":["test/*-test.js"]},"rootPath":"D:\\busterDev\\buster-configuration","environment":"node","options":{},"extensions":[],"resources":[],"libs":[],"sourc
es":[],"testHelpers":[],"tests":["test/*-test.js"],"name":"Tests","source":"D:/busterDev/buster-configuration/buster.js"}],"listeners":{},"sources":["D:/busterDev/buster-configuration/buster.js"]}

Is these the information you are looking for and would you be satisfied if buster-configuration just provides an executable to output that JSON?

rundis commented 9 years ago

That should work ! How would it handle things like extends, will that be resolved or would that be up to the client to figure out ?

Yes please :)

dwittner commented 9 years ago

For that configuration fle with extending groups:

var config = module.exports

config['base'] = {
    environment: 'node',
    tests: ['test/*-test.js']
};

config['tests'] = {
    extends: 'base',
    src: ['src/**/*.js']
};

The output is:

{
    "groups":[
        {
            "config": {
                "environment":"node",
                "tests":["test/*-test.js"],
                "resources":[],
                "rootPath":"D:\\busterDev\\buster-configuration\\.fixtures",
                "extends":"base",
                "src":["src/**/*.js"],
                "deps":[],
                "libs": [],
                "sources":[],
                "specHelpers":[],
                "specs":["test/*-test.js"],
                "testHelpers":[]
            },
            "rootPath":"D:\\busterDev\\buster-configuration\\.fixtures",
            "environment":"node",
            "options":{},
            "extensions":[],
            "resources":[],
            "libs":[],
            "sources":[],
            "testHelpers":[],
            "tests":["test/*-test.js"],
            "name":"base",
            "source":"D:\\busterDev\\buster-configuration\\.fixtures/buster.js"
        },
        {
            "config":{
                "environment":"node",
                "tests":["test/*-test.js"],
                "resources":[],
                "rootPath":"D:\\busterDev\\buster-configuration\\.fixtures",
                "extends":"base",
                "src":["src/**/*.js"],
                "deps":[],
                "libs":[],
                "sources":[],
                "specHelpers":[],
                "specs":["test/*-test.js"],
                "testHelpers":[]
            },
            "rootPath":"D:\\busterDev\\buster-configuration\\.fixtures",
            "environment":"node",
            "options":{},
            "extensions":[],
            "resources":[],
            "libs":[],
            "sources":["src/**/*.js"],
            "testHelpers":[],
            "tests":["test/*-test.js"],
            "name":"tests",
            "source":"D:\\busterDev\\buster-configuration\\.fixtures/buster.js"
        }
    ],
    "listeners":{},
    "sources":["D:\\busterDev\\buster-configuration\\.fixtures/buster.js"]
}

Thus the client doesn't need to handle the extends. It is already handled by buster-configuration.

dwittner commented 9 years ago

You should be aware, that the config file is required by buster-configuration and not read in as a text file. That means, extension modules have to be resolvable

dwittner commented 9 years ago

I just released version 0.7.5 of buster-configuration. Please verify that the feature works as you expected.

dwittner commented 9 years ago

@rundis, have you already thrown a glance on it?

rundis commented 9 years ago

Sorry for the tardy response !

Got an exception:

SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Once I removed the comment from the binary it worked a charm (on my mac)!

cheers Magnus

dwittner commented 9 years ago

@rundis, i don't know why it worked perfectly on windows, but i changed the type of comment from # to // in version 0.7.6 of buster-configuration. Therefore, it should now work on all platforms.

Can the issue be closed?

rundis commented 9 years ago

Good to go !