Created
September 11, 2014 14:21
-
-
Save cybertk/fff8992e12a7655157ed to your computer and use it in GitHub Desktop.
Create mocha test/suite at runtime
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
require('chai').should() | |
Mocha = require 'mocha' | |
Test = Mocha.Test | |
Suite = Mocha.Suite | |
mocha = new Mocha | |
suite = Suite.create mocha.suite, 'I am a dynamic suite' | |
suite.addTest new Test 'I am a dynamic test', -> | |
true.should.equal true | |
mocha.run () -> | |
console.log("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this! Just wanted to add that if you don't want to use process.on events, you can use mocha runner events!