feat(karma-jasmine): update to version 3.1 (#41989)

- version bump
- rewrite definition to extend karma configuration with Jasmine specifc
configuration properties support
- tests updated
- type definition configuration changes to match latest recommended
setup for linting and TS details

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-02-06 19:13:49 +01:00 committed by GitHub
parent 05dd3e11cb
commit c72d2cfdd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 91 deletions

View File

@ -1,10 +1,33 @@
// Type definitions for karma-jasmine plugin
// Project: https://github.com/karma-runner/karma-jasmine
// Type definitions for karma-jasmine 3.1
// Project: https://github.com/karma-runner/karma-jasmine#readme
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.2
/// <reference types="jasmine" />
declare function fdescribe(description: string, specDefinitions: () => void): void;
declare function fit(expectation: string, assertion: () => void): void;
import karma = require('karma');
declare module 'karma' {
interface ClientOptions {
jasmine?: jasmine.EnvConfiguration & {
/** @deprecated undocumented to be removed */
timeoutInterval?: number;
};
/**
* run a subset of the full set of specs.
* Complete sharding support needs to be done in the process that calls karma,
* and would need to support test result integration across shards.
* See {@link https://github.com/karma-runner/karma-jasmine#sharding}
*
*/
shardIndex?: number;
/**
* run a subset of the full set of specs.
* Complete sharding support needs to be done in the process that calls karma,
* and would need to support test result integration across shards.
* See {@link https://github.com/karma-runner/karma-jasmine#sharding}
*/
totalShards?: number;
}
}

View File

@ -1,7 +1,30 @@
import karma = require('karma');
fdescribe("A suite", () => {
fit("contains spec with an expectation", () => {
fdescribe('A suite', () => {
fit('contains spec with an expectation', () => {
expect(true).toBe(true);
});
});
// https://github.com/karma-runner/karma-jasmine#configuration
const testOne = (config: karma.Config) => {
config.set({
frameworks: ['jasmine'],
files: ['*.js'],
});
};
const testTwo = (config: karma.Config) => {
config.set({
client: {
jasmine: {
random: true,
seed: 4321,
oneFailurePerSpec: true,
failFast: true,
timeoutInterval: 1000,
},
},
});
};

View File

@ -6,8 +6,8 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@ -20,4 +20,4 @@
"index.d.ts",
"karma-jasmine-tests.ts"
]
}
}

View File

@ -1,80 +1 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"npm-naming": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
{ "extends": "dtslint/dt.json" }