jest-watcher
Advanced tools
Comparing version 27.5.1 to 28.0.0-alpha.0
@@ -8,16 +8,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -30,7 +16,6 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
class BaseWatchPlugin { | ||
_stdin; | ||
_stdout; | ||
constructor({stdin, stdout}) { | ||
_defineProperty(this, '_stdin', void 0); | ||
_defineProperty(this, '_stdout', void 0); | ||
this._stdin = stdin; | ||
@@ -37,0 +22,0 @@ this._stdout = stdout; |
@@ -7,8 +7,198 @@ /** | ||
*/ | ||
export { default as BaseWatchPlugin } from './BaseWatchPlugin'; | ||
export { default as JestHook } from './JestHooks'; | ||
export { default as PatternPrompt } from './PatternPrompt'; | ||
export * from './constants'; | ||
export type { AllowedConfigOptions, JestHookEmitter, JestHookSubscriber, ScrollOptions, UpdateConfigCallback, UsageData, WatchPlugin, WatchPluginClass, } from './types'; | ||
export { default as Prompt } from './lib/Prompt'; | ||
export * from './lib/patternModeHelpers'; | ||
/// <reference types="node" /> | ||
import type {AggregatedResult} from '@jest/test-result'; | ||
import type {Config} from '@jest/types'; | ||
export declare type AllowedConfigOptions = Partial< | ||
Pick< | ||
Config.GlobalConfig, | ||
| 'bail' | ||
| 'changedSince' | ||
| 'collectCoverage' | ||
| 'collectCoverageFrom' | ||
| 'collectCoverageOnlyFrom' | ||
| 'coverageDirectory' | ||
| 'coverageReporters' | ||
| 'findRelatedTests' | ||
| 'nonFlagArgs' | ||
| 'notify' | ||
| 'notifyMode' | ||
| 'onlyFailures' | ||
| 'reporters' | ||
| 'testNamePattern' | ||
| 'testPathPattern' | ||
| 'updateSnapshot' | ||
| 'verbose' | ||
> & { | ||
mode: 'watch' | 'watchAll'; | ||
} | ||
>; | ||
declare type AvailableHooks = | ||
| 'onFileChange' | ||
| 'onTestRunComplete' | ||
| 'shouldRunTestSuite'; | ||
export declare abstract class BaseWatchPlugin implements WatchPlugin { | ||
protected _stdin: NodeJS.ReadStream; | ||
protected _stdout: NodeJS.WriteStream; | ||
constructor({ | ||
stdin, | ||
stdout, | ||
}: { | ||
stdin: NodeJS.ReadStream; | ||
stdout: NodeJS.WriteStream; | ||
}); | ||
apply(_hooks: JestHookSubscriber): void; | ||
getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null; | ||
onKey(_key: string): void; | ||
run( | ||
_globalConfig: Config.GlobalConfig, | ||
_updateConfigAndRun: UpdateConfigCallback, | ||
): Promise<void | boolean>; | ||
} | ||
declare type FileChange = (fs: JestHookExposedFS) => void; | ||
export declare class JestHook { | ||
private _listeners; | ||
private _subscriber; | ||
private _emitter; | ||
constructor(); | ||
isUsed(hook: AvailableHooks): boolean; | ||
getSubscriber(): Readonly<JestHookSubscriber>; | ||
getEmitter(): Readonly<JestHookEmitter>; | ||
} | ||
export declare type JestHookEmitter = { | ||
onFileChange: (fs: JestHookExposedFS) => void; | ||
onTestRunComplete: (results: AggregatedResult) => void; | ||
shouldRunTestSuite: ( | ||
testSuiteInfo: TestSuiteInfo, | ||
) => Promise<boolean> | boolean; | ||
}; | ||
declare type JestHookExposedFS = { | ||
projects: Array<{ | ||
config: Config.ProjectConfig; | ||
testPaths: Array<Config.Path>; | ||
}>; | ||
}; | ||
export declare type JestHookSubscriber = { | ||
onFileChange: (fn: FileChange) => void; | ||
onTestRunComplete: (fn: TestRunComplete) => void; | ||
shouldRunTestSuite: (fn: ShouldRunTestSuite) => void; | ||
}; | ||
export declare const KEYS: { | ||
ARROW_DOWN: string; | ||
ARROW_LEFT: string; | ||
ARROW_RIGHT: string; | ||
ARROW_UP: string; | ||
BACKSPACE: string; | ||
CONTROL_C: string; | ||
CONTROL_D: string; | ||
CONTROL_U: string; | ||
ENTER: string; | ||
ESCAPE: string; | ||
}; | ||
export declare class PatternPrompt { | ||
protected _pipe: NodeJS.WritableStream; | ||
protected _prompt: Prompt; | ||
protected _entityName: string; | ||
protected _currentUsageRows: number; | ||
constructor(pipe: NodeJS.WritableStream, prompt: Prompt); | ||
run( | ||
onSuccess: (value: string) => void, | ||
onCancel: () => void, | ||
options?: { | ||
header: string; | ||
}, | ||
): void; | ||
protected _onChange(_pattern: string, _options: ScrollOptions_2): void; | ||
} | ||
export declare const printPatternCaret: ( | ||
pattern: string, | ||
pipe: NodeJS.WritableStream, | ||
) => void; | ||
export declare const printRestoredPatternCaret: ( | ||
pattern: string, | ||
currentUsageRows: number, | ||
pipe: NodeJS.WritableStream, | ||
) => void; | ||
export declare class Prompt { | ||
private _entering; | ||
private _value; | ||
private _onChange; | ||
private _onSuccess; | ||
private _onCancel; | ||
private _offset; | ||
private _promptLength; | ||
private _selection; | ||
constructor(); | ||
private _onResize; | ||
enter( | ||
onChange: (pattern: string, options: ScrollOptions_2) => void, | ||
onSuccess: (pattern: string) => void, | ||
onCancel: () => void, | ||
): void; | ||
setPromptLength(length: number): void; | ||
setPromptSelection(selected: string): void; | ||
put(key: string): void; | ||
abort(): void; | ||
isEntering(): boolean; | ||
} | ||
declare type ScrollOptions_2 = { | ||
offset: number; | ||
max: number; | ||
}; | ||
export {ScrollOptions_2 as ScrollOptions}; | ||
declare type ShouldRunTestSuite = ( | ||
testSuiteInfo: TestSuiteInfo, | ||
) => Promise<boolean>; | ||
declare type TestRunComplete = (results: AggregatedResult) => void; | ||
declare type TestSuiteInfo = { | ||
config: Config.ProjectConfig; | ||
duration?: number; | ||
testPath: string; | ||
}; | ||
export declare type UpdateConfigCallback = ( | ||
config?: AllowedConfigOptions, | ||
) => void; | ||
export declare type UsageData = { | ||
key: string; | ||
prompt: string; | ||
}; | ||
export declare interface WatchPlugin { | ||
isInternal?: boolean; | ||
apply?: (hooks: JestHookSubscriber) => void; | ||
getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null; | ||
onKey?: (value: string) => void; | ||
run?: ( | ||
globalConfig: Config.GlobalConfig, | ||
updateConfigAndRun: UpdateConfigCallback, | ||
) => Promise<void | boolean>; | ||
} | ||
export declare interface WatchPluginClass { | ||
new (options: { | ||
config: Record<string, unknown>; | ||
stdin: NodeJS.ReadStream; | ||
stdout: NodeJS.WriteStream; | ||
}): WatchPlugin; | ||
} | ||
export {}; |
@@ -8,16 +8,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -30,9 +16,7 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
class JestHooks { | ||
_listeners; | ||
_subscriber; | ||
_emitter; | ||
constructor() { | ||
_defineProperty(this, '_listeners', void 0); | ||
_defineProperty(this, '_subscriber', void 0); | ||
_defineProperty(this, '_emitter', void 0); | ||
this._listeners = { | ||
@@ -39,0 +23,0 @@ onFileChange: [], |
@@ -10,38 +10,19 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
class Prompt { | ||
_entering; | ||
_value; | ||
_onChange; | ||
_onSuccess; | ||
_onCancel; | ||
_offset; | ||
_promptLength; | ||
_selection; | ||
class Prompt { | ||
constructor() { | ||
_defineProperty(this, '_entering', void 0); | ||
_defineProperty(this, '_value', void 0); | ||
_defineProperty(this, '_onChange', void 0); | ||
_defineProperty(this, '_onSuccess', void 0); | ||
_defineProperty(this, '_onCancel', void 0); | ||
_defineProperty(this, '_offset', void 0); | ||
_defineProperty(this, '_promptLength', void 0); | ||
_defineProperty(this, '_selection', void 0); | ||
_defineProperty(this, '_onResize', () => { | ||
this._onChange(); | ||
}); | ||
// Copied from `enter` to satisfy TS | ||
@@ -61,2 +42,6 @@ this._entering = true; | ||
_onResize = () => { | ||
this._onChange(); | ||
}; | ||
enter(onChange, onSuccess, onCancel) { | ||
@@ -63,0 +48,0 @@ this._entering = true; |
@@ -42,16 +42,8 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
const {CLEAR} = _jestUtil().specialChars; | ||
@@ -71,11 +63,8 @@ | ||
class PatternPrompt { | ||
_pipe; | ||
_prompt; | ||
_entityName; | ||
_currentUsageRows; | ||
constructor(pipe, prompt) { | ||
_defineProperty(this, '_pipe', void 0); | ||
_defineProperty(this, '_prompt', void 0); | ||
_defineProperty(this, '_entityName', void 0); | ||
_defineProperty(this, '_currentUsageRows', void 0); | ||
// TODO: Should come in the constructor | ||
@@ -82,0 +71,0 @@ this._entityName = ''; |
{ | ||
"name": "jest-watcher", | ||
"description": "Delightful JavaScript Testing.", | ||
"version": "27.5.1", | ||
"version": "28.0.0-alpha.0", | ||
"main": "./build/index.js", | ||
@@ -15,8 +15,8 @@ "types": "./build/index.d.ts", | ||
"dependencies": { | ||
"@jest/test-result": "^27.5.1", | ||
"@jest/types": "^27.5.1", | ||
"@jest/test-result": "^28.0.0-alpha.0", | ||
"@jest/types": "^28.0.0-alpha.0", | ||
"@types/node": "*", | ||
"ansi-escapes": "^4.2.1", | ||
"chalk": "^4.0.0", | ||
"jest-util": "^27.5.1", | ||
"jest-util": "^28.0.0-alpha.0", | ||
"string-length": "^4.0.1" | ||
@@ -33,3 +33,3 @@ }, | ||
"engines": { | ||
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" | ||
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" | ||
}, | ||
@@ -41,3 +41,3 @@ "homepage": "https://jestjs.io/", | ||
}, | ||
"gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" | ||
"gitHead": "89275b08977065d98e42ad71fcf223f4ad169f09" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22184
14
2
80
725
1
+ Added@jest/console@28.1.3(transitive)
+ Added@jest/schemas@28.1.3(transitive)
+ Added@jest/test-result@28.1.3(transitive)
+ Added@jest/types@28.1.3(transitive)
+ Added@sinclair/typebox@0.24.51(transitive)
+ Added@types/yargs@17.0.33(transitive)
+ Addedjest-message-util@28.1.3(transitive)
+ Addedjest-util@28.1.3(transitive)
+ Addedpretty-format@28.1.3(transitive)
+ Addedreact-is@18.3.1(transitive)
- Removed@jest/console@27.5.1(transitive)
- Removed@jest/test-result@27.5.1(transitive)
- Removed@jest/types@27.5.1(transitive)
- Removed@types/yargs@16.0.9(transitive)
- Removedjest-message-util@27.5.1(transitive)
- Removedjest-util@27.5.1(transitive)
- Removedpretty-format@27.5.1(transitive)
- Removedreact-is@17.0.2(transitive)
Updated@jest/types@^28.0.0-alpha.0
Updatedjest-util@^28.0.0-alpha.0