Created
March 25, 2014 13:21
-
-
Save lennym/9761653 to your computer and use it in GitHub Desktop.
Programmatic/dynamic Mocha test construction
This file contains hidden or 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
var Mocha = require('mocha'), | |
expect = require('chai').expect; | |
var mocha = new Mocha({ | |
reporter: 'spec' | |
}); | |
var dashboards = Mocha.Suite.create(mocha.suite, 'dashboards'); | |
var subsuite = Mocha.Suite.create(dashboards, 'something'); | |
subsuite.addTest(new Mocha.Test('a thing', function () { | |
expect(1).to.equal(1); | |
})); | |
dashboards.beforeAll(function () { | |
console.log('BEFORE'); | |
}); | |
dashboards.afterAll(function () { | |
console.log('AFTER'); | |
}); | |
mocha.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment