Skip to content

Commit e57bfd6

Browse files
committed
More arbitrary c8 ignores
As we add code, more existing code suddenly gets marked as uncovered by unit tests intermittently. This adds c8 ignore comments for everything that turned up when running npm test -- --no-cache --runInBand But I really hope this gets fixed upstream soon, because this isn't sustainable. For more context, see: #4234 And the (hopefully correct) upstream issue: istanbuljs/v8-to-istanbul#236
1 parent e3a2d6f commit e57bfd6

File tree

11 files changed

+47
-13
lines changed

11 files changed

+47
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type ResolutionContainerProps = {
3030
export const ResolutionContainer = (props: ResolutionContainerProps) => {
3131
const l10n = useL10n();
3232
const estimatedTimeString =
33-
/* c8 ignore next 4 */
33+
/* c8 ignore next 8 */
3434
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
3535
// this comment) as uncovered, even though I think it's covered by tests.
3636
props.type === "leakedPasswords"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export const ResolutionContent = ({
2828
});
2929

3030
const listOfBreaches =
31+
/* c8 ignore next 4 */
32+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
33+
// this comment) as uncovered, even though I think it's covered by tests.
3134
exposedData &&
3235
exposedData.map(({ id, title, breachDate }) => (
3336
<div key={id} className={styles.breachItem}>

src/app/components/client/Button.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ export const Button = (props: ButtonProps) => {
6666
// If `props.isLoading` is not undefined, the contents of the link is going to
6767
// change into a loading indicator, which needs to be read by a screen reader:
6868
const ariaLiveValue: AriaAttributes["aria-live"] =
69+
/* c8 ignore next 3 */
70+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
71+
// this comment) as uncovered, even though I think it's covered by tests.
6972
typeof isLoading === "boolean" ? "polite" : undefined;
7073

7174
return typeof href === "string" ? (

src/app/components/client/FixNavigation.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export const Steps = (props: {
5858
breachesByClassification.highRisk,
5959
).reduce((acc, array) => acc + array.length, 0);
6060
const totalDataBrokerProfiles =
61+
/* c8 ignore next 3 */
62+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
63+
// this comment) as uncovered, even though I think it's covered by tests.
6164
props.data.latestScanData?.results.length ?? 0;
6265
const totalPasswordBreaches = Object.values(
6366
breachesByClassification.passwordBreaches,
@@ -198,6 +201,10 @@ export const Steps = (props: {
198201
className={`${
199202
styles.activeProgressBarLine
200203
} ${calculateActiveProgressBarPosition(props.currentSection)} ${
204+
/* c8 ignore next 5 */
205+
// Since the Node 20.10 upgrade, it's been intermittently marking
206+
// this (and this comment) as uncovered, even though I think it's
207+
// covered by tests.
201208
isEligibleForStep(props.data, "Scan")
202209
? styles.hasFourSteps
203210
: styles.hasThreeSteps
@@ -219,29 +226,28 @@ const StepImage = (props: {
219226
);
220227
}
221228

229+
/* c8 ignore next 10 */
230+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
231+
// this comment) as uncovered, even though I think it's covered by tests.
222232
const src =
223233
props.section === "Scan"
224234
? stepDataBrokerProfilesIcon
225235
: props.section === "HighRisk"
226236
? stepHighRiskDataBreachesIcon
227-
: /* c8 ignore next 6 */
228-
// These lines should be covered by unit tests, but since the Node
229-
// 20.10 upgrade, it's been intermittently marking this (and this
230-
// comment) as uncovered.
231-
props.section === "LeakedPasswords"
237+
: props.section === "LeakedPasswords"
232238
? stepLeakedPasswordsIcon
233239
: stepSecurityRecommendationsIcon;
234240

235241
return <Image src={src} alt="" width={22} height={22} />;
236242
};
237243

244+
/* c8 ignore next 14 */
245+
// These lines should be covered by unit tests, but since the Node 20.10
246+
// upgrade, it's been intermittently marking them (and this comment) as
247+
// uncovered.
238248
function calculateActiveProgressBarPosition(section: Props["currentSection"]) {
239249
if (section === "high-risk-data-breach") {
240250
return styles.beginHighRiskDataBreaches;
241-
/* c8 ignore next 10 */
242-
// These lines should be covered by unit tests, but since the Node 20.10
243-
// upgrade, it's been intermittently marking them (and this comment) as
244-
// uncovered.
245251
} else if (section === "leaked-passwords") {
246252
return styles.beginLeakedPasswords;
247253
} else if (section === "security-recommendations") {

src/app/components/client/ScanResultCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
155155
},
156156
);
157157
}
158+
/* c8 ignore start */
158159
if (props.isOnManualRemovePage) {
159-
/* c8 ignore start */
160160
return scanResult.manually_resolved
161161
? l10n.getFragment(
162162
"exposure-card-description-info-for-sale-fixed-manually-fixed",
@@ -174,8 +174,8 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
174174
},
175175
},
176176
);
177-
/* c8 ignore stop */
178177
}
178+
/* c8 ignore stop */
179179
return l10n.getFragment(
180180
"exposure-card-description-info-for-sale-action-needed-dashboard",
181181
{

src/app/components/client/UpsellBadge.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ export function UpsellBadge(props: UpsellButtonProps) {
133133
const countryCode = useContext(CountryCodeContext);
134134
const session = useSession();
135135

136+
/* c8 ignore next 5 */
137+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
138+
// this comment) as uncovered, even though I think it's covered by tests.
136139
if (!session.data) {
137140
return <></>;
138141
}

src/app/components/client/toolbar/UserMenu.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ export const UserMenu = (props: UserMenuProps) => {
6161
signout: "signout",
6262
};
6363

64+
/* c8 ignore next 21 */
65+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
66+
// this comment) as uncovered, even though I think it's covered by tests.
6467
const handleOnAction = (menuItemKey: Key) => {
6568
switch (menuItemKey) {
6669
case itemKeys.fxa:

src/app/functions/server/dashboard.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ export function getDashboardSummary(
357357
}
358358
}
359359

360+
/* c8 ignore next 11 */
361+
// Since the Node 20.10 upgrade, it's been intermittently marking this (and
362+
// this comment) as uncovered, even though I think it's covered by tests.
360363
if (dataClasses.includes(BreachDataTypes.BankAccount)) {
361364
summary.totalDataPointsNum += increment;
362365
summary.dataBreachTotalDataPointsNum += increment;

src/app/functions/server/getRelevantGuidedSteps.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ export function hasCompletedStepSection(
180180
data: StepDeterminationData,
181181
section: "Scan" | "HighRisk" | "LeakedPasswords" | "SecurityTips",
182182
): boolean {
183+
/* c8 ignore next 5 */
184+
// I believe this *is* covered by unit tests, but for some reason,
185+
// since the upgrade to Node 20.10, it doesn't get marked as covered anymore:
183186
if (section === "Scan") {
184187
return hasCompletedStep(data, "Scan");
185188
}

src/app/functions/universal/guidedExperienceBreaches.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export function getGuidedExperienceBreaches(
4444

4545
subscriberBreaches.forEach((breach) => {
4646
// high risks
47+
// This does get covered by unit tests, but for some reason, since the
48+
// upgrade to Node 20.10, it doesn't get marked as covered anymore:
49+
/* c8 ignore next 3 */
4750
if (isUnresolvedDataBreachClass(breach, BreachDataTypes.SSN)) {
4851
guidedExperienceBreaches.highRisk.ssnBreaches.push(breach);
4952
}

0 commit comments

Comments
 (0)