Question

This is the error message:

 ReferenceError: assert is not defined
    at Object.buster.testCase.says hello to name var (./test/test-script.js:12:40)

file config buster.js:

var config = module.exports;

config["myTests"] = {
    rootPath: "../",
    environment: "browser",
    libs: ["*.js"],
    sources: ["start/script.js" ],
    tests: ["test/test-script.js"]
}; 

tree files:

main_dir/start : index.html; script.js
main_dir/test : buster.js; buster_063.js; test-script;
main_dir : jQuery.js; Mootools.js;

test-script.js:

buster.testCase("Hello", {
    "says hello to name var": function(){ assert.equals( hello("Fulvio"), "Hello Fulvio" ); }
});
Was it helpful?

Solution

As per the buster documentation you should do something as follows:

var assert = buster.referee.assert;
var refute = buster.referee.refute;

assert.equals(42, 42);
refute.equals(42, 43);

In line with that your test-script.js should look something as follows:

buster.testCase("Hello", {
    "says hello to name var": function () {
        var assert = buster.referee.assert;

        assert.equals(hello("Fulvio"), "Hello Fulvio");
        return;
    }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top