HTML scaffolding in Buster.js

This post is too old to be of any use. It has been archived.

I am a fan of buster.js, the JS testing framework influenced by JSTestDriver but taking things much further. It is however still a bit cutting edge. The resources section of Buster.js documentation, for example, is quite dense and cryptic. Here's how to use a static HTML file as the basis of your tests.

Assume your project sits in wwwroot/, and your tests in tests/ next to it. Inside tests/ there is a folder with the HTML fixtures you want to use, tests/fixtures/index.html. Then in your config file, tests/buster.js, you simply add a resource pointing to it

var config = module.exports;

config["My tests"] = {
    rootPath: "../",
    environment: "browser",
    libs: [
        "wwwroot/libs/**/*.js"
    ],
    sources: [
        "wwwroot/*.js"
    ],
    tests: [
        "tests/*-test.js"
    ],
    "resources": [{
        "path": "/",
        "file": "tests/fixtures/index.html",
        "headers": {
            "Content-Type": "text/html"
        }
    }]
}