Skip to content

Commit

Permalink
Update the mocha TDD externs to be explicit about the function type.
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141479190
  • Loading branch information
jmemge authored and blickly committed Dec 9, 2016
1 parent fe20a51 commit 486fcf9
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions contrib/externs/mocha-2.5.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,47 @@
* @see https://mochajs.org/
*/

/**
* @typedef {function(function(*=): *): (*|IThenable<*>)}
*/
var ActionFunction;

// Below are the externs for the TDD API: https://mochajs.org/#tdd

/**
* @param {string} name
* @param {!Function} cb
* @param {string} description
* @param {function(): void} spec
*/
var suite = function(name, cb) {};
var suite = function(description, spec) {};

/**
* @param {!Function} cb
* @param {!ActionFunction} action
*/
var setup = function(cb) {};
var setup = function(action) {};

/**
* @param {!Function} cb
* @param {!ActionFunction} action
*/
var teardown = function(cb) {};
var teardown = function(action) {};

/**
* @param {!Function} cb
* @param {!ActionFunction} action
*/
var suiteSetup = function(cb) {};
var suiteSetup = function(action) {};

/**
* @param {!Function} cb
* @param {!ActionFunction} action
*/
var suiteTeardown = function(cb) {};
var suiteTeardown = function(action) {};

/**
* @param {string} name
* @param {!Function} cb
* @param {string} expectation
* @param {!ActionFunction=} assertion
*/
var test = function(name, cb) {};
var test = function(expectation, assertion) {};

// Below are the externs for the BDD API: https://mochajs.org/#bdd

/**
* @typedef {function(function(*=): *): (*|IThenable<*>)}
*/
var ActionFunction;

/**
* @param {string} description
* @param {function(): void} spec
Expand All @@ -79,32 +79,32 @@ var context = function(description, spec) {};

/**
* @param {string} expectation
* @param {ActionFunction=} assertion
* @param {!ActionFunction=} assertion
*/
var it = function(expectation, assertion) {};

/**
* @param {string} expectation
* @param {ActionFunction=} assertion
* @param {!ActionFunction=} assertion
*/
var specify = function(expectation, assertion) {};

/**
* @param {ActionFunction} action
* @param {!ActionFunction} action
*/
var before = function(action) {};

/**
* @param {ActionFunction} action
* @param {!ActionFunction} action
*/
var after = function(action) {};

/**
* @param {ActionFunction} action
* @param {!ActionFunction} action
*/
var beforeEach = function(action) {};

/**
* @param {ActionFunction} action
* @param {!ActionFunction} action
*/
var afterEach = function(action) {};

0 comments on commit 486fcf9

Please sign in to comment.