chore: Switch coverage from istanbul to the v8 provider for speed (#2619)
This commit is contained in:
@@ -171,9 +171,14 @@ export const actionHandler = directive(
|
||||
return noChange;
|
||||
}
|
||||
|
||||
// istanbul ignore next -- @preserve Required by Lit Directive API but never called (update() is used instead)
|
||||
// Required by Lit Directive API but never called (update() is used instead).
|
||||
// The start/stop form of the coverage hint is used because the `next` form
|
||||
// applies to whatever immediately follows the comment, which here is
|
||||
// another comment.
|
||||
/* v8 ignore start -- @preserve */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
render(_options?: AdvancedCameraCardActionHandlerOptions) {}
|
||||
/* v8 ignore stop -- @preserve */
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -104,6 +104,14 @@ export class Camera {
|
||||
this._capabilities ??
|
||||
(await this._buildCapabilities(hass, options));
|
||||
|
||||
// The else path is tested, but the `v8` coverage provider miscounts it: a
|
||||
// missing `else` is given the count of the `if` statement minus the count
|
||||
// of its body, and the engine only counts code after an `await` for the
|
||||
// calls that actually paused there. Calls that took an earlier `??` value
|
||||
// above skipped the `await`, which makes the first number the smaller one
|
||||
// and the result negative.
|
||||
// See: https://github.com/AriPerkkio/ast-v8-to-istanbul/issues/148
|
||||
/* v8 ignore else -- @preserve */
|
||||
if (this._capabilities.has('trigger')) {
|
||||
await this._getTriggerEntities(hass, options);
|
||||
this._config.triggers.entities = uniq(this._config.triggers.entities);
|
||||
|
||||
@@ -489,7 +489,7 @@ export class FrigateCamera extends Camera {
|
||||
return;
|
||||
}
|
||||
|
||||
/* istanbul ignore next -- exercising the matcher is not possible when the
|
||||
/* v8 ignore next -- exercising the matcher is not possible when the
|
||||
test uses an event watcher -- @preserve */
|
||||
const request: FrigateWatcherRequest<FrigateEventChange> = {
|
||||
instanceID: config.frigate.client_id,
|
||||
@@ -573,7 +573,7 @@ export class FrigateCamera extends Camera {
|
||||
return;
|
||||
}
|
||||
|
||||
/* istanbul ignore next -- exercising the matcher is not possible when the
|
||||
/* v8 ignore next -- exercising the matcher is not possible when the
|
||||
test uses a review watcher -- @preserve */
|
||||
const request: FrigateWatcherRequest<FrigateReviewChange> = {
|
||||
instanceID: config.frigate.client_id,
|
||||
|
||||
@@ -429,7 +429,7 @@ export class FrigateCameraManagerEngine
|
||||
instanceID: string,
|
||||
cameraIDs?: Set<string>,
|
||||
): Promise<void> => {
|
||||
/* istanbul ignore next: defensive guard, instances.get() always returns
|
||||
/* v8 ignore next: defensive guard, instances.get() always returns
|
||||
a value when iterating instances.keys() -- @preserve */
|
||||
if (!cameraIDs?.size) {
|
||||
return;
|
||||
@@ -508,7 +508,7 @@ export class FrigateCameraManagerEngine
|
||||
instanceID: string,
|
||||
cameraIDs?: Set<string>,
|
||||
): Promise<void> => {
|
||||
/* istanbul ignore next: defensive guard, instances.get() always returns
|
||||
/* v8 ignore next: defensive guard, instances.get() always returns
|
||||
a value when iterating instances.keys() -- @preserve */
|
||||
if (!cameraIDs?.size) {
|
||||
return;
|
||||
@@ -1032,7 +1032,7 @@ export class FrigateCameraManagerEngine
|
||||
}
|
||||
|
||||
for (const result of recordings.values()) {
|
||||
/* istanbul ignore next: this engine's getRecordings() always produces
|
||||
/* v8 ignore next: this engine's getRecordings() always produces
|
||||
FrigateRecordingQueryResults -- @preserve */
|
||||
if (!FrigateQueryResultsClassifier.isFrigateRecordingQueryResults(result)) {
|
||||
continue;
|
||||
@@ -1102,7 +1102,7 @@ export class FrigateCameraManagerEngine
|
||||
}
|
||||
|
||||
for (const [query, result] of results) {
|
||||
/* istanbul ignore next: this engine's getRecordings() always produces
|
||||
/* v8 ignore next: this engine's getRecordings() always produces
|
||||
FrigateRecordingQueryResults -- @preserve */
|
||||
if (!FrigateQueryResultsClassifier.isFrigateRecordingQueryResults(result)) {
|
||||
continue;
|
||||
|
||||
@@ -187,7 +187,7 @@ export class CameraManager {
|
||||
const engines: Map<Engine, CameraManagerEngine> = new Map();
|
||||
const hass = this._api.getHASSManager().getHASS();
|
||||
|
||||
/* istanbul ignore if: the if path cannot be reached -- @preserve */
|
||||
/* v8 ignore if: the if path cannot be reached -- @preserve */
|
||||
if (!hass) {
|
||||
return output;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ export class CameraManager {
|
||||
const initializationStartTime = new Date();
|
||||
const hass = this._api.getHASSManager().getHASS();
|
||||
|
||||
/* istanbul ignore if: the if path cannot be reached -- @preserve */
|
||||
/* v8 ignore if: the if path cannot be reached -- @preserve */
|
||||
if (!hass) {
|
||||
return;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ export class CameraManager {
|
||||
|
||||
for (const [engine, cameraIDs] of engines) {
|
||||
let queries: CameraQuery[] | null = null;
|
||||
/* istanbul ignore else: the else path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: the else path cannot be reached -- @preserve */
|
||||
if (CameraQueryClassifier.isEventQuery(partialQuery)) {
|
||||
queries = engine.generateDefaultEventQuery(this._store, cameraIDs, partialQuery);
|
||||
} else if (CameraQueryClassifier.isRecordingQuery(partialQuery)) {
|
||||
@@ -540,7 +540,7 @@ export class CameraManager {
|
||||
for (const query of queries) {
|
||||
const newChunkQuery = { ...query };
|
||||
|
||||
/* istanbul ignore else: the else path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: the else path cannot be reached -- @preserve */
|
||||
if (direction === 'later') {
|
||||
const latestResult = getTimeFromResults('latest');
|
||||
if (latestResult) {
|
||||
@@ -728,7 +728,7 @@ export class CameraManager {
|
||||
): Promise<void> => {
|
||||
let engineResult: Map<QT, QueryReturnType<QT>> | null = null;
|
||||
|
||||
/* istanbul ignore else: the else path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: the else path cannot be reached -- @preserve */
|
||||
if (CameraQueryClassifier.isEventQuery(query)) {
|
||||
engineResult = (await engine.getEvents(
|
||||
hass,
|
||||
@@ -825,7 +825,7 @@ export class CameraManager {
|
||||
|
||||
if (engine) {
|
||||
let media: ViewMedia[] | null = null;
|
||||
/* istanbul ignore else: the else path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: the else path cannot be reached -- @preserve */
|
||||
if (
|
||||
CameraQueryClassifier.isEventQuery(query) &&
|
||||
QueryResultClassifier.isEventQueryResult(result)
|
||||
|
||||
@@ -93,7 +93,7 @@ export class MotionEyeCameraManagerEngine extends BrowseMediaCameraManagerEngine
|
||||
parent?: RichBrowseMedia<BrowseMediaMetadata>,
|
||||
): BrowseMediaMetadata | null {
|
||||
let startDate = parent?._metadata?.startDate ?? new Date();
|
||||
/* istanbul ignore next: dateFormat is always non-null for files because
|
||||
/* v8 ignore next: dateFormat is always non-null for files because
|
||||
Zod requires file_pattern to contain % -- @preserve */
|
||||
if (dateFormat) {
|
||||
const extensionlessTitle = media.title.replace(/\.[^/.]+$/, '');
|
||||
|
||||
@@ -239,7 +239,7 @@ export class ReolinkCamera extends EntityCamera {
|
||||
reolinkPTZCapabilities.presets = ptzPresetsEntityState.attributes.options;
|
||||
}
|
||||
|
||||
/* istanbul ignore next: this path cannot be reached as ptzEntities will
|
||||
/* v8 ignore next: this path cannot be reached as ptzEntities will
|
||||
always have contents when this function is called -- @preserve */
|
||||
return Object.keys(reolinkPTZCapabilities).length ? reolinkPTZCapabilities : null;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ export class ReolinkCamera extends EntityCamera {
|
||||
hass: HomeAssistant,
|
||||
entityRegistry: EntityRegistryManager,
|
||||
): Promise<PTZEntities | null> {
|
||||
/* istanbul ignore next: this path cannot be reached as an exception is
|
||||
/* v8 ignore next: this path cannot be reached as an exception is
|
||||
thrown in initialize() if this value is not found -- @preserve */
|
||||
if (!this._reolinkHostID) {
|
||||
return null;
|
||||
|
||||
@@ -90,7 +90,7 @@ export class ReolinkCameraManagerEngine extends BrowseMediaCameraManagerEngine {
|
||||
media: BrowseMedia,
|
||||
parent?: RichBrowseMedia<BrowseMediaMetadata>,
|
||||
): BrowseMediaMetadata | null {
|
||||
/* istanbul ignore next: This situation cannot happen as the directory would
|
||||
/* v8 ignore next: This situation cannot happen as the directory would
|
||||
be rejected by _reolinkDirectoryMetadataGenerator if there was no start date
|
||||
-- @preserve */
|
||||
if (!parent?._metadata?.startDate || media.media_class !== MEDIA_CLASS_VIDEO) {
|
||||
@@ -375,7 +375,7 @@ export class ReolinkCameraManagerEngine extends BrowseMediaCameraManagerEngine {
|
||||
engineOptions,
|
||||
);
|
||||
for (const dayDirectory of directories ?? []) {
|
||||
/* istanbul ignore next: This situation cannot happen as the directory
|
||||
/* v8 ignore next: This situation cannot happen as the directory
|
||||
will not match without metadata -- @preserve */
|
||||
if (dayDirectory._metadata?.startDate) {
|
||||
days.add(formatDate(dayDirectory._metadata.startDate));
|
||||
|
||||
@@ -67,7 +67,7 @@ export class PTZDigitalAction extends AdvancedCameraCardAction<PTZDigitialAction
|
||||
return await this._stepChange(api, targetID);
|
||||
}
|
||||
|
||||
/* istanbul ignore else: the else path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: the else path cannot be reached -- @preserve */
|
||||
if (action.ptz_phase === 'start') {
|
||||
await stopInProgressForThisTarget(targetID, this._context.ptzDigital);
|
||||
setInProgressForThisTarget(targetID, this._context, 'ptzDigital', this);
|
||||
|
||||
@@ -99,7 +99,7 @@ export class PTZAction extends AdvancedCameraCardAction<PTZActionConfig> {
|
||||
setInProgressForThisTarget(ptzCameraID, this._context, 'ptz', this);
|
||||
|
||||
const singleStep = async (): Promise<void> => {
|
||||
/* istanbul ignore else: the else path cannot be reached as ptz_action
|
||||
/* v8 ignore else: the else path cannot be reached as ptz_action
|
||||
being present is checked above -- @preserve */
|
||||
if (action.ptz_action) {
|
||||
await api.getCameraManager().executePTZAction(ptzCameraID, action.ptz_action, {
|
||||
@@ -133,7 +133,7 @@ export class PTZAction extends AdvancedCameraCardAction<PTZActionConfig> {
|
||||
});
|
||||
|
||||
this._timer.start(ptzConfiguration.c2r_delay_between_calls_seconds, async () => {
|
||||
/* istanbul ignore else: the else path cannot be reached as ptz_action
|
||||
/* v8 ignore else: the else path cannot be reached as ptz_action
|
||||
being present is checked above -- @preserve */
|
||||
if (action.ptz_action) {
|
||||
await api.getCameraManager().executePTZAction(ptzCameraID, action.ptz_action, {
|
||||
|
||||
@@ -53,7 +53,7 @@ export abstract class GeneratedTone implements Tone {
|
||||
// Current AudioContext time. Subclasses only read this from inside `_play()`
|
||||
// where the context is always set.
|
||||
protected get _currentTime(): number {
|
||||
/* istanbul ignore next: _currentTime is only read by subclasses from
|
||||
/* v8 ignore next: _currentTime is only read by subclasses from
|
||||
_play() during an active context -- @preserve */
|
||||
return this._context?.currentTime ?? 0;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ export abstract class GeneratedTone implements Tone {
|
||||
// of their pattern to loop. No-ops if the context has already been closed so
|
||||
// a stopped tone can never re-arm its loop.
|
||||
protected _scheduleNext(intervalSeconds: number): void {
|
||||
/* istanbul ignore next: defensive guard against a subclass calling
|
||||
/* v8 ignore next: defensive guard against a subclass calling
|
||||
_scheduleNext after stop() -- JS single-threading makes this unreachable
|
||||
from the existing subclasses -- @preserve */
|
||||
if (!this._context) {
|
||||
@@ -78,7 +78,7 @@ export abstract class GeneratedTone implements Tone {
|
||||
return;
|
||||
}
|
||||
this._timer.start(intervalSeconds, () => {
|
||||
/* istanbul ignore next: Timer.stop() cancels pending callbacks, so this
|
||||
/* v8 ignore next: Timer.stop() cancels pending callbacks, so this
|
||||
re-entry guard is unreachable in practice -- @preserve */
|
||||
if (!this._context) {
|
||||
return;
|
||||
@@ -89,7 +89,7 @@ export abstract class GeneratedTone implements Tone {
|
||||
|
||||
// Plays one note: a smooth tone that rises to peak volume and then fades.
|
||||
protected _playNote(freq: number, when: number, envelope: ToneEnvelope): void {
|
||||
/* istanbul ignore next: _playNote is only called by subclasses from
|
||||
/* v8 ignore next: _playNote is only called by subclasses from
|
||||
_play() during an active context -- @preserve */
|
||||
if (!this._context) {
|
||||
return;
|
||||
|
||||
@@ -51,7 +51,7 @@ export class CustomTone implements Tone {
|
||||
}
|
||||
|
||||
private _handleEnded = (): void => {
|
||||
/* istanbul ignore next: stop() removes this listener before nulling
|
||||
/* v8 ignore next: stop() removes this listener before nulling
|
||||
_audio, so the handler can't fire with a null _audio -- @preserve */
|
||||
if (!this._audio) {
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ export class CustomTone implements Tone {
|
||||
};
|
||||
|
||||
private _playAudio(): void {
|
||||
/* istanbul ignore next: callers (start, _handleEnded) only invoke
|
||||
/* v8 ignore next: callers (start, _handleEnded) only invoke
|
||||
_playAudio when _audio is non-null -- @preserve */
|
||||
if (!this._audio) {
|
||||
return;
|
||||
|
||||
@@ -242,7 +242,7 @@ export class CameraTriggersManager {
|
||||
} else if (ev.fidelity === 'high' && triggerAction === 'media') {
|
||||
// Choose the most appropriate media view based on what's available.
|
||||
// Priority: review > clip > snapshot
|
||||
/* istanbul ignore next: the `null` case is unreachable due to `skipViewAction` above -- @preserve */
|
||||
/* v8 ignore next: the `null` case is unreachable due to `skipViewAction` above -- @preserve */
|
||||
const view = ev.review
|
||||
? 'review'
|
||||
: ev.clip
|
||||
@@ -251,7 +251,7 @@ export class CameraTriggersManager {
|
||||
? 'snapshot'
|
||||
: null;
|
||||
|
||||
/* istanbul ignore next: unreachable due to `skipViewAction` above -- @preserve */
|
||||
/* v8 ignore next: unreachable due to `skipViewAction` above -- @preserve */
|
||||
if (view) {
|
||||
await this._api.getViewManager().setViewByParametersWithNewQuery({
|
||||
params: {
|
||||
|
||||
@@ -163,7 +163,7 @@ export class ConfigManager {
|
||||
}
|
||||
|
||||
private _processOverrideConfig(): void {
|
||||
/* istanbul ignore if: No (current) way to reach this code -- @preserve */
|
||||
/* v8 ignore if: No (current) way to reach this code -- @preserve */
|
||||
if (!this._config) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class ViewItemManager {
|
||||
try {
|
||||
await this._download(item);
|
||||
} catch (error: unknown) {
|
||||
/* istanbul ignore if: catch always provides a non-null error -- @preserve */
|
||||
/* v8 ignore if: catch always provides a non-null error -- @preserve */
|
||||
if (error == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export class ViewItemManager {
|
||||
if (source === ViewMediaSource.Camera && ViewItemClassifier.isMedia(item)) {
|
||||
return await this._api.getCameraManager().favoriteMedia(item, favorite);
|
||||
}
|
||||
/* istanbul ignore else: this path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: this path cannot be reached -- @preserve */
|
||||
if (source === ViewMediaSource.Folder) {
|
||||
return this._api.getFoldersManager().favorite(item, favorite);
|
||||
}
|
||||
@@ -78,7 +78,6 @@ export class ViewItemManager {
|
||||
return ViewMediaSource.Folder;
|
||||
}
|
||||
|
||||
/* istanbul ignore next: this path cannot be reached -- @preserve */
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -133,12 +132,12 @@ export class ViewItemManager {
|
||||
);
|
||||
}
|
||||
|
||||
/* istanbul ignore else: this path cannot be reached -- @preserve */
|
||||
/* v8 ignore else: this path cannot be reached -- @preserve */
|
||||
if (ViewItemClassifier.isFolder(item)) {
|
||||
return toFilename(item.getTitle() ?? 'media');
|
||||
}
|
||||
|
||||
/* istanbul ignore next: this path cannot be reached -- @preserve */
|
||||
/* v8 ignore next: this path cannot be reached -- @preserve */
|
||||
return 'download';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
/* istanbul ignore if: the if path cannot be reached as the view is set
|
||||
/* v8 ignore if: the if path cannot be reached as the view is set
|
||||
above -- @preserve */
|
||||
if (!this._view) {
|
||||
return;
|
||||
|
||||
@@ -227,7 +227,7 @@ export class ViewQueryExecutor {
|
||||
const now = new Date();
|
||||
const liveConfig = this._api.getConfigManager().getConfig()?.live;
|
||||
|
||||
/* istanbul ignore if: this if branch cannot be reached as if the config is
|
||||
/* v8 ignore if: this if branch cannot be reached as if the config is
|
||||
empty this function is never called -- @preserve */
|
||||
if (!liveConfig) {
|
||||
return [];
|
||||
|
||||
@@ -10,7 +10,7 @@ export class MJPEGStreamSource extends ImageFrameStreamSource {
|
||||
}
|
||||
|
||||
protected _handleFrame(data: ArrayBuffer): void {
|
||||
/* istanbul ignore next: This never rejects; the catch satisfies the no-floating-promises -- @preserve */
|
||||
/* v8 ignore next: This never rejects; the catch satisfies the no-floating-promises -- @preserve */
|
||||
this._showFrame(new Blob([data], { type: 'image/jpeg' })).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export class MP4StreamSource extends ImageFrameStreamSource {
|
||||
context.drawImage(decoder, 0, 0, canvas.width, canvas.height);
|
||||
canvas.toBlob((frame) => {
|
||||
if (frame) {
|
||||
/* istanbul ignore next: This never rejects; the catch satisfies the no-floating-promises -- @preserve */
|
||||
/* v8 ignore next: This never rejects; the catch satisfies the no-floating-promises -- @preserve */
|
||||
this._showFrame(frame).catch(() => {});
|
||||
}
|
||||
}, 'image/jpeg');
|
||||
|
||||
@@ -353,7 +353,6 @@ export class MediaGridController {
|
||||
const eventPath = ev.composedPath();
|
||||
|
||||
for (const [id, element] of this._gridContents.entries()) {
|
||||
/* istanbul ignore else: the else path cannot be reached -- @preserve */
|
||||
if (eventPath.includes(element)) {
|
||||
if (this._selected !== id) {
|
||||
// Fire the request but do not mutate local state. The authoritative
|
||||
|
||||
@@ -101,7 +101,7 @@ export class MediaHeightController {
|
||||
}
|
||||
|
||||
private _initializeRoot(): void {
|
||||
/* istanbul ignore next: the absent-root path cannot be reached as root will
|
||||
/* v8 ignore next: the absent-root path cannot be reached as root will
|
||||
always exist by the time the mutation observer is observing -- @preserve */
|
||||
const children = [
|
||||
...(this._root?.querySelectorAll<HTMLElement>(this._selector) ?? []),
|
||||
|
||||
@@ -130,7 +130,7 @@ export class PTZDragController implements ReactiveController {
|
||||
}
|
||||
|
||||
private _restoreGestureStyles(): void {
|
||||
/* istanbul ignore next: only called when gesture is active -- @preserve */
|
||||
/* v8 ignore next: only called when gesture is active -- @preserve */
|
||||
if (this._gestureElement) {
|
||||
this._gestureElement.style.cursor = this._savedCursor;
|
||||
this._gestureElement.style.touchAction = this._savedTouchAction;
|
||||
@@ -138,7 +138,7 @@ export class PTZDragController implements ReactiveController {
|
||||
}
|
||||
|
||||
private _setCursor(grabbing: boolean): void {
|
||||
/* istanbul ignore next: only called when gesture is active -- @preserve */
|
||||
/* v8 ignore next: only called when gesture is active -- @preserve */
|
||||
if (this._gestureElement) {
|
||||
this._gestureElement.style.cursor = grabbing ? CURSOR_GRABBING : CURSOR_GRAB;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ export class PTZDragController implements ReactiveController {
|
||||
};
|
||||
|
||||
private _dispatch(action: PTZAction | null, phase?: PTZActionPhase): void {
|
||||
/* istanbul ignore next: all call sites guard against this -- @preserve */
|
||||
/* v8 ignore next: all call sites guard against this -- @preserve */
|
||||
if (!action) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ export class StatusBarController {
|
||||
}
|
||||
|
||||
private _getSufficientValue(item: StatusBarItem): string | null {
|
||||
/* istanbul ignore else: cannot happen -- @preserve */
|
||||
/* v8 ignore else: cannot happen -- @preserve */
|
||||
if (item.type === 'custom:advanced-camera-card-status-bar-icon') {
|
||||
return item.icon;
|
||||
} else if (item.type === 'custom:advanced-camera-card-status-bar-string') {
|
||||
|
||||
@@ -123,10 +123,6 @@ export class ZoomController {
|
||||
config?.zoom ?? ZOOM_DEFAULT_SCALE,
|
||||
);
|
||||
|
||||
// The ZOOM_DEFAULT_SCALE fallback is not reachable: without a zoom value a
|
||||
// default of 1 is assumed in _convertPercentToXYPan, which returns null at
|
||||
// the default zoom, leaving `converted` unset.
|
||||
/* istanbul ignore next @preserve */
|
||||
const startScale = config?.zoom ?? ZOOM_DEFAULT_SCALE;
|
||||
|
||||
this._panzoom = Panzoom(this._element, {
|
||||
@@ -243,23 +239,19 @@ export class ZoomController {
|
||||
// used fully specified by this object. It's kept as-is for completeness.
|
||||
return (
|
||||
arefloatsApproximatelyEqual(
|
||||
/* istanbul ignore next @preserve */
|
||||
a.zoom ?? ZOOM_DEFAULT_SCALE,
|
||||
/* istanbul ignore next @preserve */
|
||||
b.zoom ?? ZOOM_DEFAULT_SCALE,
|
||||
ZOOM_PRECISION,
|
||||
) &&
|
||||
arefloatsApproximatelyEqual(
|
||||
/* istanbul ignore next @preserve */
|
||||
a.pan?.x ?? ZOOM_DEFAULT_PAN_X,
|
||||
/* istanbul ignore next @preserve */
|
||||
b.pan?.x ?? ZOOM_DEFAULT_PAN_X,
|
||||
ZOOM_PRECISION,
|
||||
) &&
|
||||
arefloatsApproximatelyEqual(
|
||||
/* istanbul ignore next @preserve */
|
||||
/* v8 ignore next @preserve */
|
||||
a.pan?.y ?? ZOOM_DEFAULT_PAN_Y,
|
||||
/* istanbul ignore next @preserve */
|
||||
/* v8 ignore next @preserve */
|
||||
b.pan?.y ?? ZOOM_DEFAULT_PAN_Y,
|
||||
ZOOM_PRECISION,
|
||||
)
|
||||
@@ -436,7 +428,7 @@ export class ZoomController {
|
||||
// The ZOOM_DEFAULT_SCALE fallback cannot be reached: when
|
||||
// this._defaultSettings.zoom is undefined, convertedDefault ends up null
|
||||
// above and this function has already returned.
|
||||
/* istanbul ignore next @preserve */
|
||||
/* v8 ignore next @preserve */
|
||||
const defaultScale = this._defaultSettings.zoom ?? ZOOM_DEFAULT_SCALE;
|
||||
|
||||
return (
|
||||
|
||||
@@ -204,7 +204,7 @@ export class HASSConnectionSubscriptionManager<K, R> {
|
||||
}
|
||||
|
||||
private _listenToHASS(): void {
|
||||
/* istanbul ignore if: only called when transitioning from zero to one
|
||||
/* v8 ignore if: only called when transitioning from zero to one
|
||||
request, so `_unlistenCallback` is always null here -- @preserve */
|
||||
if (this._unlistenCallback) {
|
||||
return;
|
||||
@@ -296,14 +296,14 @@ export class HASSConnectionSubscriptionManager<K, R> {
|
||||
private _runScheduledRetry(request: R): void {
|
||||
const registration = this._requests.get(request);
|
||||
|
||||
/* istanbul ignore if: unsubscribe() and `_endEra()` both stop the timer
|
||||
/* v8 ignore if: unsubscribe() and `_endEra()` both stop the timer
|
||||
before tearing down state, so by the time we get here the request is
|
||||
still alive and the era is still ready -- @preserve */
|
||||
if (!registration || !this._connection) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* istanbul ignore if: the timer can only fire while its token is null (set
|
||||
/* v8 ignore if: the timer can only fire while its token is null (set
|
||||
null by the catch that scheduled this timer) -- @preserve */
|
||||
if (registration.token != null) {
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ export class LatestValueRunner<T> {
|
||||
this._running = true;
|
||||
// The drain loop cannot reject (the operation's errors are caught within
|
||||
// it); the catch only satisfies the no-floating-promises rule.
|
||||
/* istanbul ignore next -- @preserve */
|
||||
/* v8 ignore next -- @preserve */
|
||||
this._drain().catch(() => {});
|
||||
}
|
||||
return ran;
|
||||
|
||||
@@ -24,12 +24,12 @@ interface IntegrationDiagnostics {
|
||||
export const getReleaseVersion = (): string => {
|
||||
const releaseVersion: string = '__ADVANCED_CAMERA_CARD_RELEASE_VERSION__';
|
||||
|
||||
/* istanbul ignore if: depends on rollup substitution -- @preserve */
|
||||
/* v8 ignore if: depends on rollup substitution -- @preserve */
|
||||
if (releaseVersion === 'pkg') {
|
||||
return pkg.version;
|
||||
}
|
||||
|
||||
/* istanbul ignore if: depends on rollup substitution -- @preserve */
|
||||
/* v8 ignore if: depends on rollup substitution -- @preserve */
|
||||
if (releaseVersion === 'dev') {
|
||||
return `dev+${pkg['gitAbbrevHash']}`;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export const MediaTypeSpec = {
|
||||
* Note on code coverage: Throughout this class, _buildBaseQueryNode and similar
|
||||
* methods return null only when cameraIDs is empty. Public methods guard
|
||||
* against empty cameraIDs before calling these internal methods, making the
|
||||
* null branches unreachable. Istanbul ignore comments reference this note.
|
||||
* null branches unreachable. Coverage ignore comments reference this note.
|
||||
*/
|
||||
export class UnifiedQueryBuilder {
|
||||
private _cameraManager: CameraManager;
|
||||
@@ -132,7 +132,7 @@ export class UnifiedQueryBuilder {
|
||||
new UnifiedQuery(),
|
||||
this._buildRecordingsQueryNode(cameraIDs, options),
|
||||
);
|
||||
/* istanbul ignore next: see class note on code coverage -- @preserve */
|
||||
/* v8 ignore next: see class note on code coverage -- @preserve */
|
||||
return query.hasNodes() ? query : null;
|
||||
}
|
||||
|
||||
@@ -229,14 +229,13 @@ export class UnifiedQueryBuilder {
|
||||
if (effectiveCameraIDs.size) {
|
||||
for (const mediaType of effectiveMediaTypes) {
|
||||
const node = this._buildFilterQueryNode(mediaType, effectiveCameraIDs, options);
|
||||
/* istanbul ignore next: see class note on code coverage -- @preserve */
|
||||
/* v8 ignore next: see class note on code coverage -- @preserve */
|
||||
if (node) {
|
||||
query.addNode(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next: see class note on code coverage -- @preserve */
|
||||
return query.hasNodes() ? query : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ export const getCameraIDsWithCapabilityForView = (
|
||||
};
|
||||
const capability = requirements.mediaCapabilities;
|
||||
|
||||
/* istanbul ignore next: this path is currently unreachable given the mapping
|
||||
/* v8 ignore next: this path is currently unreachable given the mapping
|
||||
in VIEW_REQUIREMENTS includes mediaCapabilities for all camera or 'any'
|
||||
related views -- @preserve */
|
||||
if (!capability) {
|
||||
|
||||
Reference in New Issue
Block a user