Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buster.js - ReferenceError : assert is not defined, where I did wrong?

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" ); }
});
like image 713
Donovant Avatar asked Oct 02 '22 08:10

Donovant


1 Answers

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;
    }
});
like image 68
Tanzeel Kazi Avatar answered Oct 05 '22 11:10

Tanzeel Kazi