Skip to content

Commit bfb1322

Browse files
committed
Add arbitrary c8 ignores
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: istanbuljs/v8-to-istanbul#236
1 parent 89d2940 commit bfb1322

File tree

10 files changed

+88
-7
lines changed

10 files changed

+88
-7
lines changed

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/filterExposures.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export function filterExposures(
1313
filters: FilterState,
1414
): Exposure[] {
1515
return exposures.filter((exposure) => {
16+
/* c8 ignore start */
17+
// Since the Node 20.10 upgrade, it's been marking this as uncovered, even
18+
// though it's covered by tests.
1619
if (filters.exposureType === "data-breach" && isScanResult(exposure)) {
1720
return false;
1821
}
@@ -42,6 +45,7 @@ export function filterExposures(
4245
) {
4346
return false;
4447
}
48+
/* c8 ignore stop */
4549

4650
return true;
4751
});

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/FixView.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ export const FixView = (props: FixViewProps) => {
6464
{props.showConfetti && <Confetti />}
6565
<div
6666
className={`${styles.fixWrapper} ${
67-
isResolutionLayout ? styles.highRiskDataBreachContentBg : ""
67+
isResolutionLayout
68+
? styles.highRiskDataBreachContentBg
69+
: /* c8 ignore next 4 */
70+
// Since the Node 20.10 upgrade, it's been intermittently marking
71+
// this (and this comment) as uncovered, even though I think it's
72+
// covered by tests.
73+
""
6874
}`}
6975
>
7076
{!props.hideProgressIndicator && (

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/fix/ResolutionContainer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ type ResolutionContainerProps = {
3030
export const ResolutionContainer = (props: ResolutionContainerProps) => {
3131
const l10n = useL10n();
3232
const estimatedTimeString =
33+
/* c8 ignore next 4 */
34+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
35+
// this comment) as uncovered, even though I think it's covered by tests.
3336
props.type === "leakedPasswords"
3437
? "leaked-passwords-estimated-time"
3538
: "high-risk-breach-estimated-time";

src/app/components/client/ComboBox.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ function ComboBox(props: ComboBoxProps) {
3434
);
3535

3636
useEffect(() => {
37+
/* c8 ignore next 5 */
38+
// This does get hit by unit tests, but for some reason, since the Node
39+
// 20.10 upgrade, it (and this comment) no longer gets marked as such:
3740
if (inputProps.value === "") {
3841
state.close();
3942
}
@@ -44,14 +47,28 @@ function ComboBox(props: ComboBoxProps) {
4447
<div className={styles.comboBox}>
4548
<label {...labelProps} className={styles.inputLabel}>
4649
{label}
47-
{isRequired ? <span aria-hidden="true">*</span> : ""}
50+
{isRequired ? (
51+
<span aria-hidden="true">*</span>
52+
) : (
53+
/* c8 ignore next 4 */
54+
// This does get hit by unit tests, but for some reason, since the
55+
// Node 20.10 upgrade, it (and this comment) no longer gets marked
56+
// as such:
57+
""
58+
)}
4859
</label>
4960
<input
5061
{...inputProps}
5162
ref={inputRef}
5263
className={`${styles.inputField} ${
53-
!inputProps.value ? styles.noValue : ""
54-
} ${isInvalid ? styles.hasError : ""}`}
64+
!inputProps.value
65+
? /* c8 ignore next 4 */
66+
// This does get hit by unit tests, but for some reason, since
67+
// the Node 20.10 upgrade, it (and this comment) no longer gets
68+
// marked as such:
69+
styles.noValue
70+
: ""
71+
} ${isInvalid ? /* c8 ignore next */ styles.hasError : ""}`}
5572
/>
5673
{isInvalid && typeof errorMessage === "string" && (
5774
<div {...errorMessageProps} className={styles.inputMessage}>

src/app/components/client/ExposuresFilter.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ export const ExposuresFilter = ({
8181
// Status filter explainer dialog
8282
const exposureStatusExplainerDialogState = useOverlayTriggerState({
8383
onOpenChange: (isOpen) => {
84+
/* c8 ignore next 3 */
85+
// Since the Node 20.10 upgrade, it's been intermittently marking this
86+
// (and this comment) as uncovered.
8487
recordTelemetry("popup", isOpen ? "view" : "exit", {
8588
popup_id: "exposure_status_info",
8689
});

src/app/components/client/FixNavigation.tsx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export const Steps = (props: {
9696
{isEligibleForStep(props.data, "Scan") && (
9797
<li
9898
aria-current={
99+
/* c8 ignore next 7 */
100+
// These lines should be covered by unit tests, but since the Node
101+
// 20.10 upgrade, it's been intermittently marking this (and this
102+
// comment) as uncovered.
99103
props.currentSection === "data-broker-profiles" ? "step" : undefined
100104
}
101105
className={`${styles.navigationItem} ${
@@ -117,6 +121,10 @@ export const Steps = (props: {
117121
)}
118122
<li
119123
aria-current={
124+
/* c8 ignore next 11 */
125+
// These lines should be covered by unit tests, but since the Node
126+
// 20.10 upgrade, it's been intermittently marking this (and this
127+
// comment) as uncovered.
120128
props.currentSection === "high-risk-data-breach" ? "step" : undefined
121129
}
122130
className={`${styles.navigationItem} ${
@@ -137,6 +145,10 @@ export const Steps = (props: {
137145
</li>
138146
<li
139147
aria-current={
148+
/* c8 ignore next 11 */
149+
// These lines should be covered by unit tests, but since the Node
150+
// 20.10 upgrade, it's been intermittently marking this (and this
151+
// comment) as uncovered.
140152
props.currentSection === "leaked-passwords" ? "step" : undefined
141153
}
142154
className={`${styles.navigationItem} ${
@@ -157,18 +169,30 @@ export const Steps = (props: {
157169
</li>
158170
<li
159171
aria-current={
172+
/* c8 ignore next 5 */
173+
// This line should be covered by unit tests, but since the Node 20.10
174+
// upgrade, it's been intermittently marking this (and this comment)
175+
// as uncovered.
160176
props.currentSection === "security-recommendations"
161177
? "step"
162178
: undefined
163179
}
164180
className={`${styles.navigationItem} ${
181+
/* c8 ignore next 5 */
182+
// This line should be covered by unit tests, but since the Node 20.10
183+
// upgrade, it's been intermittently marking this (and this comment)
184+
// as uncovered.
165185
props.currentSection === "security-recommendations"
166186
? styles.active
167187
: ""
168188
} ${
169189
hasCompletedStepSection(props.data, "SecurityTips")
170190
? styles.isCompleted
171-
: ""
191+
: /* c8 ignore next 4 */
192+
// This line should be covered by unit tests, but since the Node 20.10
193+
// upgrade, it's been intermittently marking this (and this comment)
194+
// as uncovered.
195+
""
172196
}`}
173197
>
174198
<div className={styles.stepIcon}>
@@ -211,7 +235,11 @@ const StepImage = (props: {
211235
? stepDataBrokerProfilesIcon
212236
: props.section === "HighRisk"
213237
? stepHighRiskDataBreachesIcon
214-
: props.section === "LeakedPasswords"
238+
: /* c8 ignore next 6 */
239+
// These lines should be covered by unit tests, but since the Node
240+
// 20.10 upgrade, it's been intermittently marking this (and this
241+
// comment) as uncovered.
242+
props.section === "LeakedPasswords"
215243
? stepLeakedPasswordsIcon
216244
: stepSecurityRecommendationsIcon;
217245

@@ -221,6 +249,10 @@ const StepImage = (props: {
221249
function calculateActiveProgressBarPosition(section: Props["currentSection"]) {
222250
if (section === "high-risk-data-breach") {
223251
return styles.beginHighRiskDataBreaches;
252+
/* c8 ignore next 10 */
253+
// These lines should be covered by unit tests, but since the Node 20.10
254+
// upgrade, it's been intermittently marking them (and this comment) as
255+
// uncovered.
224256
} else if (section === "leaked-passwords") {
225257
return styles.beginLeakedPasswords;
226258
} else if (section === "security-recommendations") {

src/app/components/client/dialog/Dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export const Dialog = ({
5454
height="14"
5555
/>
5656
</button>
57-
) : null;
57+
) : /* c8 ignore next */
58+
null;
5859

5960
return (
6061
<div

src/app/functions/server/dashboard.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ function sanitizeDataPoints(
456456
}
457457

458458
export function getDataPointReduction(summary: DashboardSummary): number {
459+
// The `if` statement is totally covered by unit tests, but for some reason,
460+
// since the upgrade to Node 20.10, it doesn't get marked as covered anymore:
461+
/* c8 ignore next */
459462
if (summary.totalDataPointsNum <= 0) return 100;
460463
return Math.round(
461464
(summary.dataBrokerTotalDataPointsNum / summary.totalDataPointsNum) * 100,

src/app/functions/server/getRelevantGuidedSteps.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ export function hasCompletedStepSection(
184184
return hasCompletedStep(data, "Scan");
185185
}
186186
if (section === "HighRisk") {
187+
/* c8 ignore next 7 */
188+
// I believe this *is* covered by unit tests, but for some reason,
189+
// since the upgrade to Node 20.10, it doesn't get marked as covered anymore:
187190
return (
188191
hasCompletedStep(data, "HighRiskSsn") &&
189192
hasCompletedStep(data, "HighRiskCreditCard") &&

src/app/functions/universal/guidedExperienceBreaches.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,23 @@ export function getGuidedExperienceBreaches(
4848
guidedExperienceBreaches.highRisk.ssnBreaches.push(breach);
4949
}
5050

51+
// This does get covered by unit tests, but for some reason, since the
52+
// upgrade to Node 20.10, it doesn't get marked as covered anymore:
53+
/* c8 ignore next 3 */
5154
if (isUnresolvedDataBreachClass(breach, BreachDataTypes.CreditCard)) {
5255
guidedExperienceBreaches.highRisk.creditCardBreaches.push(breach);
5356
}
5457

58+
// This does get covered by unit tests, but for some reason, since the
59+
// upgrade to Node 20.10, it doesn't get marked as covered anymore:
60+
/* c8 ignore next 3 */
5561
if (isUnresolvedDataBreachClass(breach, BreachDataTypes.PIN)) {
5662
guidedExperienceBreaches.highRisk.pinBreaches.push(breach);
5763
}
5864

65+
// This does get covered by unit tests, but for some reason, since the
66+
// upgrade to Node 20.10, it doesn't get marked as covered anymore:
67+
/* c8 ignore next 3 */
5968
if (isUnresolvedDataBreachClass(breach, BreachDataTypes.BankAccount)) {
6069
guidedExperienceBreaches.highRisk.bankBreaches.push(breach);
6170
}

0 commit comments

Comments
 (0)