diff --git a/types/karma-json-preprocessor/index.d.ts b/types/karma-json-preprocessor/index.d.ts new file mode 100644 index 0000000000..b3545d1106 --- /dev/null +++ b/types/karma-json-preprocessor/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for karma-json-preprocessor 0.3 +// Project: https://github.com/mjeanroy/karma-json-preprocessor#readme +// Definitions by: Piotr Błażejewicz (Peter Blazejewicz) +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.2 + +import 'karma'; + +declare module 'karma' { + interface ConfigOptions { + /** + * see {@link https://github.com/mjeanroy/karma-json-preprocessor#configuration-1} + */ + jsonPreprocessor?: JsonPreprocessorOptions; + } + + /** + * Default global variable name is by default `__json__`, + * but you can override it with your own name in karma configuration: + */ + interface JsonPreprocessorOptions { + /** + * @default '__json__' + */ + varName?: string; + /** + * @default '' + */ + stripPrefix?: string; + } +} diff --git a/types/karma-json-preprocessor/karma-json-preprocessor-tests.ts b/types/karma-json-preprocessor/karma-json-preprocessor-tests.ts new file mode 100644 index 0000000000..f22bae103f --- /dev/null +++ b/types/karma-json-preprocessor/karma-json-preprocessor-tests.ts @@ -0,0 +1,20 @@ +import karma = require('karma'); + +// Mocha reporter options tests +const mochaReporter: karma.JsonPreprocessorOptions = { + varName: '$json', + stripPrefix: 'prefix', +}; + +module.exports = (config: karma.Config) => { + config.set({ + preprocessors: { + '**/*.json': ['json'], + }, + files: ['**/*.js', '**/*.json'], + jsonPreprocessor: { + varName: '$json', + stripPrefix: 'prefix', + }, + }); +}; diff --git a/types/karma-json-preprocessor/tsconfig.json b/types/karma-json-preprocessor/tsconfig.json new file mode 100644 index 0000000000..6982d26ec7 --- /dev/null +++ b/types/karma-json-preprocessor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "karma-json-preprocessor-tests.ts" + ] +} diff --git a/types/karma-json-preprocessor/tslint.json b/types/karma-json-preprocessor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/karma-json-preprocessor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }