Skip to content

Instantly share code, notes, and snippets.

@jason0x43
Last active August 29, 2015 14:18
Show Gist options
  • Save jason0x43/3e3c00265c3fc573b48d to your computer and use it in GitHub Desktop.
Save jason0x43/3e3c00265c3fc573b48d to your computer and use it in GitHub Desktop.
Writing CommonJS tests with Intern
// tests/cjs.js -- AMD module to load CJS tests
define(function (require) {
var registerSuite = require('intern!object');
var testLoader = require('dojo/node!./cjs/all');
testLoader(registerSuite);
});
// tests/cjs/all.js -- CJS module that loads individual CJS test suites
module.exports = function (registerSuite) {
require('./unit.js')(registerSuite);
// more test modules
};
// tests/cjs/unit.js -- CJS test suite
module.exports = function (registerSuite) {
var assert = require('intern/node_modules/chai').assert;
registerSuite({
name: 'cjs test',
'test 1': function () {
assert.ok(true);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment