This is an example of how to write tdd style tests for brunch.io projects and the required setup
Last active
December 10, 2015 01:38
-
-
Save smazurov/4361378 to your computer and use it in GitHub Desktop.
Setup needed to get tdd-syntax tests rocking for brunch.io
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
# add this to the end of the exports object in the config file | |
test: | |
ui: 'tdd' |
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
// test/test-helpers.js | |
var chai = require('chai'); | |
module.exports = { | |
assert: chai.assert, | |
customAssertion: function(){ } | |
}; |
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
// test/name-of-module-test.js | |
suite('Array', function(){ | |
setup(function(){ | |
// ... | |
}); | |
suite('#indexOf()', function(){ | |
test('should return -1 when not present', function(){ | |
assert.equal(-1, [1,2,3].indexOf(4)); | |
assert.equal(-1, [1,2,3].indexOf(0)); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment