Some things about using Testling, Tape & Github
I encountered recent difficulties with the testling hook on github, using the tape module for test files.
First off, testling would choke on reading my package.json files, complaining about bad character references (there's a pun that we'll ignore). I found my editor's default encoding with UTF-8 but should have been UTF-8 without BOM - so that's one thing to double-check.
Once I fixed that, tape tests failed every case because the require() call was returning null instead of the subject module's exports. Turns out, my subject file was using an IIFE like this - an artifact of in-browser-console-development:
;(function (exports) {
exports.subject = subject;
function subject() {
// etc.
};
}(this)); // uh oh - this works from node command line and firebug console, but ...
Changing that last line as follows gets things working again -
}((typeof module != 'undefined' && module.exports) ? module.exports : this));
The first way used to pass but started breaking when the new browserify (v2) went live.
This was confirmed by @substack in an email back to me -
"Great! Yes the new browserify does not set `this` to exports.
Depending on the value of `this` externally in a context is really
fragile because your code might be wrapped by other closures. You can
also set which version of browserify to use explicitly by including a
pegged version semver in your package.json dependencies or
devDependencies fields."
Then I found the testling badge wasn't updating on the repo readme, because github uses akamai to cache images. Fix that by pointing to https rather than http - e.g., https://ci.testling.com/dfkaye/Constructor.png.
Update Dec 2013
Found out something else - you don't need to fill out a files
field or even a scripts
field in your testling
entry - you can just use html
to specify your own test page and do your own browserify bundling. Handy if you're also using testem or karma with custom test pages. More on that here -> https://github.com/substack/testling/blob/master/doc/testling_field.markdown#html
Being There, Now
As Ram Dass once wrote, "Now you have the data I have."