I've been banging my head at the wall since yesterday (only interrupted by a great Bruce Springsteen concert last night... ;-)
I am trying to add some JS testing to an existing (Rails) project. Basically the folder structure is this:
.
├── app
│ └── assets
│ └── javascripts
│ └── strftime.js
└── spec
├── buster.js
└── javascripts
└── strftime.test.js
In this very simple example I've taken the buster example from here https://gist.github.com/cjohansen/1904218 to be sure that everything worked before moving files around.
My buster.js looks like this:
var config = exports;
config["Server tests"] = {
// sources: ["../app/assets/javascripts/strftime.js"],
tests: ["javascripts/strftime.test.js"],
env: "node"
};
and I've tried modifying the first 5 lines of strftime.test.js to this:
if (typeof require == "function" && typeof module == "object") {
buster = require("buster");
require("../app/assets/javascripts/strftime.js");
}
Currently when I run buster test, I get this:
$ buster test
Failed requiring ./spec/javascripts/strftime.test.js: Cannot find module '../app/assets/javascripts/lib/strftime.js'
If I try to uncomment the sources line, buster test fails silently - even if I try to run it with high debug level.
I've zipped the entire example (2 KB) and put it here, if anyone would like try give it a try: http://gehling.dk/b2.zip
UPDATE: I've managed to require the js-file successfully by supplying the path relative to my test-js file:
if (typeof require == "function" && typeof module == "object") {
buster = require("buster");
require("../../app/assets/javascripts/strftime.js");
}
But I still have the problem with buster failing silently, if I add the sources parameter.
TIA
/ Carsten