Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Jan 17, 2020
1 parent 3144e43 commit a035573
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 307 deletions.
11 changes: 11 additions & 0 deletions globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as Mocha from './';

declare global {
const after: typeof Mocha.after;
const afterEach: typeof Mocha.afterEach;
const before: typeof Mocha.after;
const beforeEach: typeof Mocha.beforeEach;
const describe: typeof Mocha.describe;
const it: typeof Mocha.after;
const xit: typeof Mocha.xit;
}
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export = import('./types/mocha');
import * as Mocha from './types/mocha';
export = Mocha;
7 changes: 4 additions & 3 deletions lib/runnable.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ utils.inherits(Runnable, EventEmitter);
*
* @private
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
* @param {number|string} ms - Timeout threshold value.
* @param {number|string} [ms] - Timeout threshold value.
* @returns {Runnable} this
* @chainable
*/
Expand Down Expand Up @@ -260,13 +260,14 @@ Runnable.prototype.resetTimeout = function() {
return;
}
this.clearTimeout();
this.timer = setTimeout(function() {
/** @type {number} */
this.timer = /** @type {any} */ (setTimeout(function() {
if (!self._enableTimeouts) {
return;
}
self.callback(self._timeoutError(ms));
self.timedOut = true;
}, ms);
}, ms));
};

/**
Expand Down
5 changes: 4 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ var assign = (exports.assign = require('object.assign').getPolyfill());
* @throws {TypeError} if either constructor is null, or if super constructor
* lacks a prototype.
*/
exports.inherits = util.inherits;
exports.inherits = function(ctor, superCtor) {
// Wrapper prevents type declarations from referring to @types/node
return util.inherits.call(this, ctor, superCtor);
};

/**
* Escape special characters in the given string of html.
Expand Down
Loading

0 comments on commit a035573

Please sign in to comment.