Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
48 changes: 40 additions & 8 deletions packages/jest-editor-support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<TestAssertionStatus>;
assertions: Array<TestAssertionStatus> | null;
}

/**
* The Jest Extension's version of a status for
* individual assertion fails
*
*/
export interface TestAssertionStatus {
title: string;
status: TestReconcilationState;
Expand Down Expand Up @@ -133,17 +150,32 @@ export interface JestTotalResults {
numPassedTests: number;
numFailedTests: number;
numPendingTests: number;
coverageMap: any;
testResults: Array<JestFileResults>;
}

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[];
}