Skip to content

Instantly share code, notes, and snippets.

@bryanforbes
Created June 27, 2014 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanforbes/feb149049d9679cfcf88 to your computer and use it in GitHub Desktop.
Save bryanforbes/feb149049d9679cfcf88 to your computer and use it in GitHub Desktop.
define([
'intern!object',
'intern/chai!assert'
], function (registerSuite, assert) {
var one = 0;
registerSuite({
// If this test were to run more than once (which functional
// tests do), it would fail because it is keeping its state
// in the module's closure
one: function () {
one++;
assert.strictEqual(one, 1);
}
});
});
define([
'intern!object',
'intern/chai!assert'
], function (registerSuite, assert) {
registerSuite(function () {
// Every time the runner runs this suite, it will run this function
// to obtain the object. This means each run, no matter how many
// times it is run, will have its own scope
var one = 0;
return {
// Running the suite more than once will no longer fail
one: function () {
one++;
assert.strictEqual(one, 1);
}
};
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment