From 2886eb29b89dea11fd0f59d2201123a30d94301f Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 21 Feb 2024 12:13:03 +0100 Subject: [PATCH] Add arbitrary `c8 ignore`s The Node 20.10 upgrade suddenly started marking them as uncovered. It's unclear what exactly the cause is, but there's a bug on file that might be related: https://github.com/istanbuljs/v8-to-istanbul/issues/236 --- .../(dashboard)/dashboard/filterExposures.ts | 4 +++ .../(dashboard)/dashboard/fix/FixView.tsx | 8 ++++- .../dashboard/fix/ResolutionContainer.tsx | 3 ++ src/app/components/client/ComboBox.tsx | 23 ++++++++++-- src/app/components/client/ExposuresFilter.tsx | 3 ++ src/app/components/client/FixNavigation.tsx | 36 +++++++++++++++++-- src/app/components/client/dialog/Dialog.tsx | 3 +- src/app/functions/server/dashboard.ts | 3 ++ .../server/getRelevantGuidedSteps.ts | 3 ++ .../universal/guidedExperienceBreaches.ts | 9 +++++ 10 files changed, 88 insertions(+), 7 deletions(-) diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/filterExposures.ts b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/filterExposures.ts index 4e3e08c4e3c..0ff14d8a141 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/filterExposures.ts +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/filterExposures.ts @@ -13,6 +13,9 @@ export function filterExposures( filters: FilterState, ): Exposure[] { return exposures.filter((exposure) => { + /* c8 ignore start */ + // Since the Node 20.10 upgrade, it's been marking this as uncovered, even + // though it's covered by tests. if (filters.exposureType === "data-breach" && isScanResult(exposure)) { return false; } @@ -42,6 +45,7 @@ export function filterExposures( ) { return false; } + /* c8 ignore stop */ return true; }); diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/FixView.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/FixView.tsx index dda64789999..53b25eb6e73 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/FixView.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/FixView.tsx @@ -64,7 +64,13 @@ export const FixView = (props: FixViewProps) => { {props.showConfetti && }
{!props.hideProgressIndicator && ( diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/ResolutionContainer.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/ResolutionContainer.tsx index 7ece90ad9c2..082797077df 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/ResolutionContainer.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/ResolutionContainer.tsx @@ -30,6 +30,9 @@ type ResolutionContainerProps = { export const ResolutionContainer = (props: ResolutionContainerProps) => { const l10n = useL10n(); const estimatedTimeString = + /* c8 ignore next 4 */ + // Since the Node 20.10 upgrade, it's been intermittently marking this (and + // this comment) as uncovered, even though I think it's covered by tests. props.type === "leakedPasswords" ? "leaked-passwords-estimated-time" : "high-risk-breach-estimated-time"; diff --git a/src/app/components/client/ComboBox.tsx b/src/app/components/client/ComboBox.tsx index 01a2b6b98cb..9a74144d7c7 100644 --- a/src/app/components/client/ComboBox.tsx +++ b/src/app/components/client/ComboBox.tsx @@ -34,6 +34,9 @@ function ComboBox(props: ComboBoxProps) { ); useEffect(() => { + /* c8 ignore next 5 */ + // This does get hit by unit tests, but for some reason, since the Node + // 20.10 upgrade, it (and this comment) no longer gets marked as such: if (inputProps.value === "") { state.close(); } @@ -44,14 +47,28 @@ function ComboBox(props: ComboBoxProps) {
{isInvalid && typeof errorMessage === "string" && (
diff --git a/src/app/components/client/ExposuresFilter.tsx b/src/app/components/client/ExposuresFilter.tsx index 01c0beed28f..3f43766df02 100644 --- a/src/app/components/client/ExposuresFilter.tsx +++ b/src/app/components/client/ExposuresFilter.tsx @@ -81,6 +81,9 @@ export const ExposuresFilter = ({ // Status filter explainer dialog const exposureStatusExplainerDialogState = useOverlayTriggerState({ onOpenChange: (isOpen) => { + /* c8 ignore next 3 */ + // Since the Node 20.10 upgrade, it's been intermittently marking this + // (and this comment) as uncovered. recordTelemetry("popup", isOpen ? "view" : "exit", { popup_id: "exposure_status_info", }); diff --git a/src/app/components/client/FixNavigation.tsx b/src/app/components/client/FixNavigation.tsx index a5121291d77..b2a314d4848 100644 --- a/src/app/components/client/FixNavigation.tsx +++ b/src/app/components/client/FixNavigation.tsx @@ -96,6 +96,10 @@ export const Steps = (props: { {isEligibleForStep(props.data, "Scan") && (
  • @@ -211,7 +235,11 @@ const StepImage = (props: { ? stepDataBrokerProfilesIcon : props.section === "HighRisk" ? stepHighRiskDataBreachesIcon - : props.section === "LeakedPasswords" + : /* c8 ignore next 6 */ + // These lines should be covered by unit tests, but since the Node + // 20.10 upgrade, it's been intermittently marking this (and this + // comment) as uncovered. + props.section === "LeakedPasswords" ? stepLeakedPasswordsIcon : stepSecurityRecommendationsIcon; @@ -221,6 +249,10 @@ const StepImage = (props: { function calculateActiveProgressBarPosition(section: Props["currentSection"]) { if (section === "high-risk-data-breach") { return styles.beginHighRiskDataBreaches; + /* c8 ignore next 10 */ + // These lines should be covered by unit tests, but since the Node 20.10 + // upgrade, it's been intermittently marking them (and this comment) as + // uncovered. } else if (section === "leaked-passwords") { return styles.beginLeakedPasswords; } else if (section === "security-recommendations") { diff --git a/src/app/components/client/dialog/Dialog.tsx b/src/app/components/client/dialog/Dialog.tsx index 2af31b9f359..e0312170829 100644 --- a/src/app/components/client/dialog/Dialog.tsx +++ b/src/app/components/client/dialog/Dialog.tsx @@ -54,7 +54,8 @@ export const Dialog = ({ height="14" /> - ) : null; + ) : /* c8 ignore next */ + null; return (