5

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" ); }
});
Donovant
  • 3,091
  • 8
  • 40
  • 68
  • You'll probably need to put the contents of `test-script.js` as well. – Tanzeel Kazi Mar 09 '14 at 08:09
  • Your test script file located at `./test/test-script.js:12:40` which is mostly causing the error. You will need to post the contents of that file in your question for others to be able to help you find the cause of the problem. – Tanzeel Kazi Mar 09 '14 at 08:20

1 Answers1

4

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;
    }
});
Tanzeel Kazi
  • 3,797
  • 1
  • 17
  • 22
  • 1
    This isn't mentioned in the screencast. The author explicitly doesn't do this, yet it magically works... – Cerin Oct 10 '14 at 20:12