feat(karma-html-detailed-reporter): new type definition files (#43032)

* feat(karma-html-detailed-reporter): new type definition files

- definition file
- tests

https://github.com/a11smiles/karma-html-detailed-reporter#options

Thanks!

* Add module exports fixing PR comments

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-04-01 00:21:50 +02:00 committed by GitHub
parent 3c038853a5
commit 9a4e62fa4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,71 @@
// Type definitions for karma-html-detailed-reporter 2.1
// Project: https://github.com/a11smiles/karma-html-detailed-reporter
// 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 {
/**
* The reporter provides a dashboard detailing specification runs
* see {@link https://github.com/a11smiles/karma-html-detailed-reporter#options}
*/
htmlDetailed?: HtmlDetailedOptions;
}
/**
* see {@link https://github.com/a11smiles/karma-html-detailed-reporter#options}
*/
interface HtmlDetailedOptions {
/**
* Enables/disables the refresh to start automatically
* @default true
*/
autoReload?: boolean;
/**
* Sets the reports output base path
* @default './_reports'
*/
dir?: string;
/**
* Sets the refresh timeout (in milliseconds) for the page
* @default 1000
*/
refreshTimeout?: number;
/**
* Determines whether the results are split into a separate file for each browser
* @default true
*/
splitResults?: boolean;
/**
* Determines whether the detailed results of the successfull tests are default shown or hidden in the browser (you are able to toggle live in the browser)
* @default true
*/
showSuccess?: boolean;
/**
* Determines whether the detailed results of the failed tests are default shown or hidden in the browser (you are able to toggle live in the browser)
* @default true
*/
showFailed?: boolean;
/**
* Determines whether the detailed results of the skipped tests are default shown or hidden in the browser (you are able to toggle live in the browser)
* @default true
*/
showSkipped?: boolean;
/**
* Determines whether to use the hosted versions of Boostrap and jQuery. If testing within a CI build (e.g. TFS, Jenkins, TeamCity),
* setting this to true would allow you to see the reports while the builders do not maintain node modules.
* @default false
*/
useHostedBootstrap?: boolean;
}
}
declare const exp: {
'preprocessor:htmlDetailed': ['factory', any];
'reporter:htmlDetailed': ['type', any];
};
export = exp;

View File

@ -0,0 +1,27 @@
import karma = require('karma');
import karmaHtmlDetailedReporter = require('karma-html-detailed-reporter');
// See https://github.com/karma-runner/karma-coverage/blob/v1.1.2/README.md#basic
module.exports = (config: karma.Config) => {
config.set({
frameworks: ['jasmine'],
reporters: ['progress', 'htmlDetailed'],
browsers: ['Chrome', 'PhantomJS'],
plugins: ['karma-jasmine', 'karma-chrome-launcher', 'karma-html-detailed-reporter'],
// (test) configure the reporter
htmlDetailed: {
autoReload: true,
dir: './_reports',
refreshTimeout: 1000,
splitResults: true,
showSuccess: true,
showFailed: false,
showSkipped: true,
useHostedBootstrap: true,
},
});
};
const [factory, preprocessor] = karmaHtmlDetailedReporter['preprocessor:htmlDetailed'];
const [type, reporter] = karmaHtmlDetailedReporter['reporter:htmlDetailed'];

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-html-detailed-reporter-tests.ts"
]
}

View File

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