Add type definitions for karma-webpack (#20140)

This commit is contained in:
Matt Traynham
2017-10-02 12:22:33 -07:00
committed by Ryan Cavanaugh
parent 4603024201
commit d21b17c876
4 changed files with 78 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
// Type definitions for karma-webpack 2.0
// Project: http://github.com/webpack/karma-webpack
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as m from 'karma';
import webpack = require('webpack');
import webpackDevMiddleware = require('webpack-dev-middleware');
declare module 'karma' {
// Note: karma-webpack will set publicPath for us, so it is optional here.
// Unfortuantely, Typescript doesn't let you overload properties, so
// the entire definition is duplicated here.
interface KarmaWebpackMiddlewareOptions /** extends webpackDevMiddleware.Options */ {
noInfo?: boolean;
quiet?: boolean;
lazy?: boolean;
watchOptions?: webpack.Options.WatchOptions;
publicPath?: string;
index?: string;
headers?: {
[name: string]: string;
};
stats?: webpack.Options.Stats;
reporter?: webpackDevMiddleware.Reporter | null;
serverSideRender?: boolean;
log?: webpackDevMiddleware.Logger;
warn?: webpackDevMiddleware.Logger;
error?: webpackDevMiddleware.Logger;
filename?: string;
}
interface ConfigOptions {
webpack: webpack.Configuration;
webpackMiddlewareOptions: KarmaWebpackMiddlewareOptions;
}
}
@@ -0,0 +1,14 @@
import karma = require('karma');
export default function(config: karma.Config): void {
config.set({
files: ['src/index.spec.ts'],
browsers: ['ChromeHeadless'],
singleRun: true,
frameworks: ['jasmine'],
preprocessors: {'src/index.spec.ts': ['webpack', 'sourcemap']},
webpack: {entry: 'test.js'},
webpackMiddlewareOptions: {noInfo: true},
reporters: ['spec']
});
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"karma-webpack-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }