Last active
August 29, 2015 14:18
-
-
Save jason0x43/3e3c00265c3fc573b48d to your computer and use it in GitHub Desktop.
Writing CommonJS tests with Intern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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