[mocha] Remove type overriding by NodeJS (#22528)

* Fix type pollution

* Fix uncaught bugs of #22267
This commit is contained in:
falsandtru
2018-01-03 13:17:50 -08:00
committed by Mohamed Hegazy
parent d0db614137
commit f2dceb3528
4 changed files with 11 additions and 18 deletions
+7 -7
View File
@@ -4,9 +4,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as m from 'karma';
import webpack = require('webpack');
import webpackDevMiddleware = require('webpack-dev-middleware');
import 'karma';
import * as Webpack from 'webpack';
import { Reporter, Logger } from 'webpack-dev-middleware';
declare module 'karma' {
type Logger = (message?: any, ...optionalParams: any[]) => void;
@@ -18,14 +18,14 @@ declare module 'karma' {
noInfo?: boolean;
quiet?: boolean;
lazy?: boolean;
watchOptions?: webpack.Options.WatchOptions;
watchOptions?: Webpack.Options.WatchOptions;
publicPath?: string;
index?: string;
headers?: {
[name: string]: string;
};
stats?: webpack.Options.Stats;
reporter?: webpackDevMiddleware.Reporter | null;
stats?: Webpack.Options.Stats;
reporter?: Reporter | null;
serverSideRender?: boolean;
log?: Logger;
@@ -35,7 +35,7 @@ declare module 'karma' {
}
interface ConfigOptions {
webpack: webpack.Configuration;
webpack: Webpack.Configuration;
webpackMiddlewareOptions: KarmaWebpackMiddlewareOptions;
}
}
+1 -3
View File
@@ -3,8 +3,6 @@
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
interface MochaSetupOptions {
//milliseconds to wait before considering a test slow
slow?: number;
@@ -174,7 +172,7 @@ declare namespace Mocha {
/** Partial interface for Mocha's `Runner` class. */
interface IRunner extends NodeJS.EventEmitter { }
interface IRunner { }
interface IContextDefinition {
(description: string, callback: (this: ISuiteCallbackContext) => void): ISuite;
-6
View File
@@ -455,9 +455,3 @@ function test_run_withOnComplete() {
function test_throwError() {
mocha.throwError(new Error("I'm an error!"));
}
function test_runner_fluentParams() {
new MochaDef().run(); // $ExpectType IRunner
new MochaDef().run().on("event-string", function() {}); // $ExpectType IRunner
new MochaDef().run().on(Symbol("event-symbol"), function() {}); // $ExpectType IRunner
}
+3 -2
View File
@@ -5,9 +5,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { NextHandleFunction } from 'connect';
import { Logger } from 'loglevel';
import * as webpack from 'webpack';
import * as loglevel from 'loglevel';
import { NextHandleFunction } from 'connect';
import MemoryFileSystem = require('memory-fs');
export = WebpackDevMiddleware;
@@ -40,6 +40,7 @@ declare namespace WebpackDevMiddleware {
log: Logger;
}
type Logger = loglevel.Logger;
type Reporter = (middlewareOptions: Options, reporterOptions: ReporterOptions) => void;
interface WebpackDevMiddleware {