feat(karma-jsdom-launcher): new type definition package (#43031)

- type definition
- tests

https://github.com/badeball/karma-jsdom-launcher#readme

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-03-27 18:08:22 +01:00 committed by GitHub
parent 40e033c885
commit 418fbfd443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 0 deletions

25
types/karma-jsdom-launcher/index.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
// Type definitions for karma-jsdom-launcher 8.0
// Project: https://github.com/badeball/karma-jsdom-launcher#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';
import jsdom = require('jsdom');
declare module 'karma' {
interface ConfigOptions {
/**
* Launcher for jsdom configuration
*/
jsdomLauncher?: JsdomLauncherOptions;
}
interface JsdomLauncherOptions {
/**
* You can pass options directly to jsdom as shown below.
* See jsdom's own documentation for all supported options.
*/
jsdom: jsdom.ConstructorOptions;
}
}

View File

@ -0,0 +1,24 @@
import karma = require('karma');
import jsdom = require('jsdom');
const resourceLoader = new jsdom.ResourceLoader({
proxy: 'http://127.0.0.1:9001',
strictSSL: false,
userAgent: 'Mellblomenator/9000',
});
const virtualConsole = new jsdom.VirtualConsole();
const cookieJar = new jsdom.CookieJar();
module.exports = (config: karma.Config) => {
config.set({
browsers: ['jsdom'],
jsdomLauncher: {
jsdom: {
resources: resourceLoader,
virtualConsole,
cookieJar,
},
},
});
};

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"DOM"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"karma-jsdom-launcher-tests.ts"
]
}

View File

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