feat(karma-json-preprocessor): new type definition (#42738)

- type definitions
- tests

https://github.com/mjeanroy/karma-json-preprocessor#configuration

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-03-02 19:49:52 +01:00 committed by GitHub
parent 270c15f15c
commit 29f196223f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 0 deletions

View File

@ -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) <https://github.com/peterblazejewicz>
// 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;
}
}

View File

@ -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',
},
});
};

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }