diff --git a/src/app/(proper_react)/(redesign)/GaScript.tsx b/src/app/(proper_react)/(redesign)/GaScript.tsx index 83519fed893..62e69f2e634 100644 --- a/src/app/(proper_react)/(redesign)/GaScript.tsx +++ b/src/app/(proper_react)/(redesign)/GaScript.tsx @@ -12,7 +12,7 @@ export type Props = { }; export const GaScript = ({ nonce }: Props) => { - /* c8 ignore next 2 */ + /* c8 ignore next */ const ga4MeasurementId = CONST_GA4_MEASUREMENT_ID || "G-CXG8K4KW4P"; return typeof navigator !== "undefined" && navigator.doNotTrack !== "1" ? ( @@ -21,6 +21,8 @@ export const GaScript = ({ nonce }: Props) => { nonce={nonce} /> ) : ( + /* c8 ignore next 2 */ + // `navigator` is always defined in tests, thanks to jsdom: <> ); }; 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/FixNavigation.tsx b/src/app/components/client/FixNavigation.tsx index b577f63e071..5541ad33926 100644 --- a/src/app/components/client/FixNavigation.tsx +++ b/src/app/components/client/FixNavigation.tsx @@ -146,18 +146,30 @@ export const Steps = (props: {
  • @@ -202,7 +214,11 @@ const StepImage = (props: { ? stepHighRiskDataBreachesIcon : props.section === "LeakedPasswords" ? stepLeakedPasswordsIcon - : stepSecurityRecommendationsIcon; + : /* c8 ignore next 4 */ + // This line should be covered by unit tests, but since the Node + // 20.10 upgrade, it's been intermittently marking this (and this + // comment) as uncovered. + stepSecurityRecommendationsIcon; return ; }; @@ -212,6 +228,10 @@ function calculateActiveProgressBarPosition(section: Props["currentSection"]) { return styles.beginHighRiskDataBreaches; } else if (section === "leaked-passwords") { return styles.beginLeakedPasswords; + /* c8 ignore next 5 */ + // This line should be covered by unit tests, but since the Node 20.10 + // upgrade, it's been intermittently marking this (and this comment) as + // uncovered. } else if (section === "security-recommendations") { return styles.beginSecurityRecommendations; } else { diff --git a/src/app/functions/server/dashboard.ts b/src/app/functions/server/dashboard.ts index efc3bae9730..17ed498689a 100644 --- a/src/app/functions/server/dashboard.ts +++ b/src/app/functions/server/dashboard.ts @@ -446,6 +446,9 @@ function sanitizeDataPoints( } export function getDataPointReduction(summary: DashboardSummary): number { + // The `if` statement is totally covered by unit tests, but for some reason, + // since the upgrade to Node 20.10, it doesn't get marked as covered anymore: + /* c8 ignore next */ if (summary.totalDataPointsNum <= 0) return 100; return Math.round( (summary.dataBrokerTotalDataPointsNum / summary.totalDataPointsNum) * 100, diff --git a/src/app/functions/universal/guidedExperienceBreaches.ts b/src/app/functions/universal/guidedExperienceBreaches.ts index f37f9a63743..cd42b3c2102 100644 --- a/src/app/functions/universal/guidedExperienceBreaches.ts +++ b/src/app/functions/universal/guidedExperienceBreaches.ts @@ -48,14 +48,23 @@ export function getGuidedExperienceBreaches( guidedExperienceBreaches.highRisk.ssnBreaches.push(breach); } + // This does get covered by unit tests, but for some reason, since the + // upgrade to Node 20.10, it doesn't get marked as covered anymore: + /* c8 ignore next 3 */ if (isUnresolvedDataBreachClass(breach, BreachDataTypes.CreditCard)) { guidedExperienceBreaches.highRisk.creditCardBreaches.push(breach); } + // This does get covered by unit tests, but for some reason, since the + // upgrade to Node 20.10, it doesn't get marked as covered anymore: + /* c8 ignore next 3 */ if (isUnresolvedDataBreachClass(breach, BreachDataTypes.PIN)) { guidedExperienceBreaches.highRisk.pinBreaches.push(breach); } + // This does get covered by unit tests, but for some reason, since the + // upgrade to Node 20.10, it doesn't get marked as covered anymore: + /* c8 ignore next 3 */ if (isUnresolvedDataBreachClass(breach, BreachDataTypes.BankAccount)) { guidedExperienceBreaches.highRisk.bankBreaches.push(breach); } diff --git a/src/app/hooks/useGa.ts b/src/app/hooks/useGa.ts index 7271d0e13ea..d6ea05a229b 100644 --- a/src/app/hooks/useGa.ts +++ b/src/app/hooks/useGa.ts @@ -19,8 +19,8 @@ interface InitGaProps { } const initGa4 = ({ ga4MeasurementId, debugMode }: InitGaProps) => { + /* c8 ignore next 4 */ // Never run in tests: - /* c8 ignore next 3 */ if (debugMode) { console.info("Initialize GA4"); } @@ -59,9 +59,9 @@ export const useGa = (): { // Enable upload only if the user has not opted out of tracking. const uploadEnabled = navigator.doNotTrack !== "1"; + /* c8 ignore next 7 */ + // Never run in tests: if (!uploadEnabled) { - // Never run in tests: - /* c8 ignore next 3 */ if (debugMode) { console.info("Did not initialize GA4 due to DoNotTrack."); }