diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc29fb21254..1877cf403e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## master +### Fixes + +* `[jest-editor-support]` Update TypeScript definitions + ([#5625](https://github.com/facebook/jest/pull/5625)) + ### Features * `[jest-runtime]` Provide `require.main` property set to module with test suite diff --git a/packages/jest-editor-support/index.d.ts b/packages/jest-editor-support/index.d.ts index ba06ad586bb4..ce9b8d6d9cb4 100644 --- a/packages/jest-editor-support/index.d.ts +++ b/packages/jest-editor-support/index.d.ts @@ -8,15 +8,19 @@ import {EventEmitter} from 'events'; import {ChildProcess} from 'child_process'; +export interface SpawnOptions { + shell?: boolean; +} + export interface Options { createProcess?( workspace: ProjectWorkspace, args: string[], - debugPort?: number, + options?: SpawnOptions, ): ChildProcess; - debugPort?: number; testNamePattern?: string; testFileNamePattern?: string; + shell?: boolean; } export class Runner extends EventEmitter { @@ -84,19 +88,32 @@ export class TestReconciler { updateFileWithJestStatus(data: any): TestFileAssertionStatus[]; } +/** + * Did the thing pass, fail or was it not run? + */ export type TestReconcilationState = - | 'Unknown' - | 'KnownSuccess' - | 'KnownFail' - | 'KnownSkip'; + | 'Unknown' // The file has not changed, so the watcher didn't hit it + | 'KnownFail' // Definitely failed + | 'KnownSuccess' // Definitely passed + | 'KnownSkip'; // Definitely skipped +/** + * The Jest Extension's version of a status for + * whether the file passed or not + * + */ export interface TestFileAssertionStatus { file: string; message: string; status: TestReconcilationState; - assertions: Array; + assertions: Array | null; } +/** + * The Jest Extension's version of a status for + * individual assertion fails + * + */ export interface TestAssertionStatus { title: string; status: TestReconcilationState; @@ -133,6 +150,7 @@ export interface JestTotalResults { numPassedTests: number; numFailedTests: number; numPendingTests: number; + coverageMap: any; testResults: Array; } @@ -140,10 +158,24 @@ export interface JestTotalResultsMeta { noTestsFound: boolean; } -export enum MessageTypes { +export enum messageTypes { noTests = 1, unknown = 0, watchUsage = 2, } export type MessageType = number; + +export interface SnapshotMetadata { + exists: boolean; + name: string; + node: { + loc: editor.Node + }; + content?: string; +} + +export class Snapshot { + constructor(parser: any, customMatchers?: string[]); + getMetadata(filepath: string): SnapshotMetadata[]; +} \ No newline at end of file