mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat(karma-junit-reporter): type definition for JUnit reporter (#42334)
- new type definition covering v2 of `karma-junit-reporter` - tests based on documented api Thanks!
This commit is contained in:
parent
fe9175e589
commit
bfe90392a0
34
types/karma-junit-reporter/index.d.ts
vendored
Normal file
34
types/karma-junit-reporter/index.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Type definitions for karma-junit-reporter 2.0
|
||||
// Project: https://github.com/karma-runner/karma-junit-reporter#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 {
|
||||
junitReporter?: JUnitReporterConfiguration;
|
||||
}
|
||||
|
||||
interface JUnitReporterConfiguration {
|
||||
/** results will be saved as $outputDir/$browserName.xml */
|
||||
outputDir?: string;
|
||||
/** if included, results will be saved as $outputDir/$browserName/$outputFile */
|
||||
outputFile?: string;
|
||||
/** suite will become the package name attribute in xml testsuite element */
|
||||
suite?: string;
|
||||
/** add browser name to report and classes names */
|
||||
useBrowserName?: boolean;
|
||||
/** function (browser, result) to customize the name attribute in xml testcase element */
|
||||
nameFormatter?: (browser: any, result: any) => string;
|
||||
/** function (browser, result) to customize the classname attribute in xml testcase element */
|
||||
classNameFormatter?: (browser: any, result: any) => string;
|
||||
/** key value pair of properties to add to the <properties> section of the report */
|
||||
properties?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/** use '1' if reporting to be per SonarQube 6.2 XML format */
|
||||
xmlVersion?: number | null;
|
||||
}
|
||||
}
|
||||
36
types/karma-junit-reporter/karma-junit-reporter-tests.ts
Normal file
36
types/karma-junit-reporter/karma-junit-reporter-tests.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import karma = require('karma');
|
||||
|
||||
// See https://github.com/karma-runner/karma-coverage/blob/v1.1.2/README.md#basic
|
||||
module.exports = (config: karma.Config) => {
|
||||
config.set({
|
||||
files: ['src/**/*.js', 'test/**/*.js'],
|
||||
|
||||
// coverage reporter generates the coverage
|
||||
reporters: ['progress', 'coverage', 'junit'],
|
||||
|
||||
preprocessors: {
|
||||
// source files, that you wanna generate coverage for
|
||||
// do not include tests or libraries
|
||||
// (these files will be instrumented by Istanbul)
|
||||
'src/**/*.js': ['coverage'],
|
||||
},
|
||||
|
||||
// the default configuration
|
||||
junitReporter: {
|
||||
outputDir: 'junit',
|
||||
outputFile: 'test-resutls.xml',
|
||||
suite: 'tests',
|
||||
useBrowserName: true,
|
||||
nameFormatter: (browser, result) => {
|
||||
return browser.id + '-browser';
|
||||
},
|
||||
classNameFormatter: (browser, result) => {
|
||||
return browser.name + '-class';
|
||||
},
|
||||
properties: {
|
||||
isValid: true,
|
||||
},
|
||||
xmlVersion: 1,
|
||||
},
|
||||
});
|
||||
};
|
||||
23
types/karma-junit-reporter/tsconfig.json
Normal file
23
types/karma-junit-reporter/tsconfig.json
Normal 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-junit-reporter-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/karma-junit-reporter/tslint.json
Normal file
1
types/karma-junit-reporter/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user