Skip to content

Instantly share code, notes, and snippets.

@huang47
Created July 26, 2013 20:28
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 huang47/6091969 to your computer and use it in GitHub Desktop.
Save huang47/6091969 to your computer and use it in GitHub Desktop.
========= a.js =============
#!/usr/bin/env node
module.exports = function A() {
init();
}
========= test/test.js =============
var A = require('../a.js');
var assert = require('assert');
describe('A', function() {
it('should not throw error', function() {
global.init = function(){};
assert.doesNotThrow(A);
});
});
mocha --globals init
> 1 test complete (5 ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment