/*
 * Copyright 2016 The Closure Compiler Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @fileoverview Externs definitions for Mocha, 2.5 branch.
 *
 * This file currently only defines the TDD API, and that part should be
 * complete.
 *
 * @externs
 * @see https://mochajs.org/
 */

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

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

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

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

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

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

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

// 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
 */
var describe = function(description, spec) {};

/**
 * @param {string} description
 * @param {function(): void} spec
 */
var context = function(description, spec) {};

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

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

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

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

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

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

@@ -809,16 +809,103 @@
 g/%0A */%0A%0A
+/**%0A * @typedef %7Bfunction(function(*=): *): (*%7CIThenable%3C*%3E)%7D%0A */%0Avar ActionFunction;%0A%0A
 // Below
@@ -979,36 +979,43 @@
 @param %7Bstring%7D 
-name
+description
 %0A * @param %7B!Fun
@@ -1006,37 +1006,46 @@
 %0A * @param %7B
-!F
+f
 unction
-%7D cb
+(): void%7D spec
 %0A */%0Avar sui
@@ -1054,32 +1054,41 @@
  = function(
-name, cb
+description, spec
 ) %7B%7D;%0A%0A/**%0A 
@@ -1090,32 +1090,38 @@
 /**%0A * @param %7B!
+Action
 Function%7D cb%0A */
@@ -1106,34 +1106,38 @@
 ActionFunction%7D 
-cb
+action
 %0A */%0Avar setup =
@@ -1138,34 +1138,38 @@
 etup = function(
-cb
+action
 ) %7B%7D;%0A%0A/**%0A * @p
@@ -1167,32 +1167,38 @@
 /**%0A * @param %7B!
+Action
 Function%7D cb%0A */
@@ -1183,34 +1183,38 @@
 ActionFunction%7D 
-cb
+action
 %0A */%0Avar teardow
@@ -1218,34 +1218,38 @@
 down = function(
-cb
+action
 ) %7B%7D;%0A%0A/**%0A * @p
@@ -1247,32 +1247,38 @@
 /**%0A * @param %7B!
+Action
 Function%7D cb%0A */
@@ -1263,34 +1263,38 @@
 ActionFunction%7D 
-cb
+action
 %0A */%0Avar suiteSe
@@ -1300,34 +1300,38 @@
 etup = function(
-cb
+action
 ) %7B%7D;%0A%0A/**%0A * @p
@@ -1329,32 +1329,38 @@
 /**%0A * @param %7B!
+Action
 Function%7D cb%0A */
@@ -1345,34 +1345,38 @@
 ActionFunction%7D 
-cb
+action
 %0A */%0Avar suiteTe
@@ -1393,18 +1393,22 @@
 unction(
-cb
+action
 ) %7B%7D;%0A%0A/
@@ -1429,20 +1429,27 @@
 string%7D 
-name
+expectation
 %0A * @par
@@ -1453,24 +1453,30 @@
 param %7B!
+Action
 Function
 %7D cb%0A */
@@ -1471,12 +1471,20 @@
 tion
+=
 %7D 
-cb
+assertion
 %0A */
@@ -1508,16 +1508,30 @@
 ion(
-name, cb
+expectation, assertion
 ) %7B%7D
@@ -1605,95 +1605,8 @@
 dd%0A%0A
-/**%0A * @typedef %7Bfunction(function(*=): *): (*%7CIThenable%3C*%3E)%7D%0A */%0Avar ActionFunction;%0A%0A
 /**%0A
@@ -1880,32 +1880,33 @@
 tion%0A * @param %7B
+!
 ActionFunction=%7D
@@ -2005,32 +2005,33 @@
 tion%0A * @param %7B
+!
 ActionFunction=%7D
@@ -2104,32 +2104,33 @@
 %0A/**%0A * @param %7B
+!
 ActionFunction%7D 
@@ -2182,32 +2182,33 @@
 %0A/**%0A * @param %7B
+!
 ActionFunction%7D 
@@ -2259,32 +2259,33 @@
 %0A/**%0A * @param %7B
+!
 ActionFunction%7D 
@@ -2349,16 +2349,17 @@
 @param %7B
+!
 ActionFu

Update the mocha TDD externs to be explicit about the function type.