Remove Jest typings (#41837)

* chore: jest-matcher-utils has official typings

* chore: jest-docblock has official typings

* chore: jest-validate has official typings

* chore: jest-matchers has been renamed to expect, and has own types
This commit is contained in:
Simen Bekkhus
2020-01-24 16:57:24 -08:00
committed by Ben Lichtman
parent 60c8a720cc
commit 3d136b8594
18 changed files with 24 additions and 347 deletions
+24
View File
@@ -2250,6 +2250,12 @@
"sourceRepoURL": "https://github.com/facebook/jest/tree/master/packages/jest-diff",
"asOfVersion": "24.3.0"
},
{
"libraryName": "jest-docblock",
"typingsPackageName": "jest-docblock",
"sourceRepoURL": "https://github.com/facebook/jest/tree/master/packages/jest-docblock",
"asOfVersion": "25.1.0"
},
{
"libraryName": "jest-each",
"typingsPackageName": "jest-each",
@@ -2262,6 +2268,24 @@
"sourceRepoURL": "https://github.com/facebook/jest/tree/master/packages/jest-get-type",
"asOfVersion": "24.2.0"
},
{
"libraryName": "jest-matcher-utils",
"typingsPackageName": "jest-matcher-utils",
"sourceRepoURL": "https://github.com/facebook/jest/tree/master/packages/jest-matcher-utils",
"asOfVersion": "25.1.0"
},
{
"libraryName": "expect",
"typingsPackageName": "jest-matchers",
"sourceRepoURL": "https://github.com/facebook/jest/tree/master/packages/expect",
"asOfVersion": "25.1.0"
},
{
"libraryName": "jest-validate",
"typingsPackageName": "jest-validate",
"sourceRepoURL": "https://github.com/facebook/jest/tree/master/packages/jest-validate",
"asOfVersion": "25.1.0"
},
{
"libraryName": "jimp",
"typingsPackageName": "jimp",
-14
View File
@@ -1,14 +0,0 @@
// Type definitions for jest-docblock 21.0
// Project: https://github.com/facebook/jest/tree/master/packages/jest-docblock, https://github.com/facebook/jest
// Definitions by: Ika <https://github.com/ikatyang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* extract the "first" docblock from code, return empty string if not found.
*/
export function extract(code: string): string;
/**
* parse @pragma from docblock.
*/
export function parse(docblock: string): { [pragma: string]: string };
@@ -1,8 +0,0 @@
import * as docblock from 'jest-docblock';
docblock.extract(`
/** @pragma */
const abc = 123;
`); // => "/** @pragma */"
docblock.parse(`/** @pragma 123 */`); // => { pragma: "123" }
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jest-docblock-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }
-45
View File
@@ -1,45 +0,0 @@
// Type definitions for jest-matcher-utils 21.0
// Project: https://github.com/facebook/jest
// Definitions by: Alex Coles <https://github.com/myabc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Chalk } from 'chalk';
export const EXPECTED_COLOR: Chalk;
export const RECEIVED_COLOR: Chalk;
export const EXPECTED_BG: Chalk; // TODO: removed in b430e51a
export const RECEIVED_BG: Chalk; // TODO: removed in b430e51a
export const SUGGEST_TO_EQUAL: string;
export function stringify(object: any, maxDepth?: number): string;
export function highlightTrailingWhitespace(
text: string,
bgColor: Chalk // removed in b430e51a
): string;
export function printReceived(object: any): string;
export function printExpected(value: any): string;
export function printWithType(
name: string,
received: any,
print: (value: any) => string
): string;
export function ensureNoExpected(actual: any, matcherName?: string): void;
export function ensureActualIsNumber(actual: any, matcherName?: string): void;
export function ensureExpectedIsNumber(actual: any, matcherName?: string): void;
export function ensureNumbers(
actual: any,
expected: any,
matcherName?: string
): void;
export function pluralize(word: string, count: number): string;
export function matcherHint(
matcherName: string,
received?: string,
expected?: string,
options?: { secondArgument?: string; isDirectExpectCall?: boolean }
): string;
@@ -1,57 +0,0 @@
import chalk from 'chalk';
import * as utils from 'jest-matcher-utils';
utils.EXPECTED_COLOR; // $ExpectType Chalk
utils.RECEIVED_COLOR; // $ExpectType Chalk
utils.SUGGEST_TO_EQUAL; // $ExpectType string
utils.stringify({}); // $ExpectType string
utils.stringify({}, 44);
utils.stringify({}, '44'); // $ExpectError
utils.stringify({}, false); // $ExpectError
utils.highlightTrailingWhitespace('', chalk.red); // $ExpectType string
utils.highlightTrailingWhitespace(44, chalk.blue); // $ExpectError
utils.highlightTrailingWhitespace(false, chalk.green); // $ExpectError
utils.printReceived({}); // $ExpectType string
utils.printExpected({}); // $ExpectType string
utils.printWithType('obj', {}, () => ''); // $ExpectType string
utils.ensureNoExpected(null, ''); // $ExpectType void
utils.ensureNoExpected('', '');
utils.ensureActualIsNumber(66); // $ExpectType void
utils.ensureActualIsNumber(66, 'highwayRouteMatcher');
utils.ensureActualIsNumber('66', 'highwayRouteMatcher');
utils.ensureExpectedIsNumber(66); // $ExpectType void
utils.ensureExpectedIsNumber(66, 'highwayRouteMatcher');
utils.ensureExpectedIsNumber('66', 'highwayRouteMatcher');
utils.ensureNumbers(66, 66); // $ExpectType void
utils.ensureNumbers(66, 66, 'highwayRouteMatcher');
utils.ensureNumbers('66', 'highwayRouteMatcher');
utils.ensureNumbers(66); // $ExpectError
utils.pluralize('fox', 1); // $ExpectType string
utils.pluralize('fox', 9);
utils.pluralize('fox', 'a yuge number'); // $ExpectError
utils.pluralize(1, 2); // $ExpectError
utils.matcherHint('[.not]primeNumberMatcher'); // $ExpectType string
utils.matcherHint('[.not]primeNumberMatcher', '12');
utils.matcherHint('[.not]primeNumberMatcher', '12', '13');
utils.matcherHint('[.not]primeNumberMatcher', '12', '13', {});
utils.matcherHint('[.not]primeNumberMatcher', '12', '13', {
secondArgument: ''
});
utils.matcherHint('[.not]primeNumberMatcher', '12', '13', {
secondArgument: '',
isDirectExpectCall: true
});
utils.matcherHint('[.not]primeNumberMatcher', '12', '13', {
secondArgument: '',
isDirectExpectCall: true,
notAnOption: 'notAnOptionValue' // $ExpectError
});
-6
View File
@@ -1,6 +0,0 @@
{
"private": true,
"dependencies": {
"chalk": "^2.2.0"
}
}
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jest-matcher-utils-tests.ts"
]
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "dtslint/dt.json"
}
-8
View File
@@ -1,8 +0,0 @@
// Type definitions for jest-matchers 20.0
// Project: https://github.com/facebook/jest#readme
// Definitions by: Joscha Feth <https://github.com/joscha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="jest" />
export = expect;
@@ -1,3 +0,0 @@
import * as expect from 'jest-matchers';
expect('x').toEqual('x');
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jest-matchers-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }
-95
View File
@@ -1,95 +0,0 @@
// Type definitions for jest-validate 21.0
// Project: https://github.com/facebook/jest/tree/master/packages/jest-validate, https://github.com/facebook/jest
// Definitions by: Ika <https://github.com/ikatyang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export class ValidationError extends Error {
name: string;
message: string;
constructor(name: string, message: string, comment?: string);
}
export function createDidYouMeanMessage(
unrecognized: string,
allowedOptions: string[]
): string;
export function format(value: any): string;
export function logValidationWarning(
name: string,
message: string,
commant?: string
): void;
export interface Title {
deprecation?: string;
error?: string;
warning?: string;
}
export interface DeprecatedConfig {
[key: string]: (config: object) => string;
}
export interface ValidationOptions {
/**
* optional string to be rendered below error/warning message.
*/
comment?: string;
/**
* an optional function with validation condition.
*/
condition?(value: any, exampleValue: any): boolean;
/**
* optional object with deprecated config keys.
*/
deprecatedConfig?: DeprecatedConfig;
/**
* the only **required** option with configuration against which you'd like to test.
*/
exampleConfig: object;
/**
* optional object of titles for errors and messages.
*/
title?: Title;
/**
* optional functions responsible for displaying warning and error messages.
*/
deprecate?(
config: object,
key: string,
deprecatedConfig: DeprecatedConfig,
options: ValidationOptions
): boolean;
/**
* optional functions responsible for displaying warning and error messages.
*/
error?(
key: string,
received: any,
exampleValue: any,
options: ValidationOptions
): void;
/**
* optional functions responsible for displaying warning and error messages.
*/
unknown?(
config: object,
exampleConfig: object,
key: string,
options: ValidationOptions
): void;
}
/**
* By default jest-validate will print generic warning and error messages.
* You can however customize this behavior by providing `options: ValidationOptions` object as a second argument:
*
* Almost anything can be overwritten to suite your needs.
*/
export function validate(
config: object,
options: ValidationOptions
): { hasDeprecationWarnings: boolean; isValid: boolean };
@@ -1,13 +0,0 @@
import { validate, format, createDidYouMeanMessage } from 'jest-validate';
validate(
{ a: 0 },
{
condition: () => false,
exampleConfig: { a: 1, b: 2 },
},
);
const formatted = format({ c: 3 });
const didYouMeanMessage = createDidYouMeanMessage('bbb', ['aaa', 'ccc']);
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jest-validate-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }