Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More arbitrary c8 ignores #4305

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ResolutionContainerProps = {
export const ResolutionContainer = (props: ResolutionContainerProps) => {
const l10n = useL10n();
const estimatedTimeString =
/* c8 ignore next 4 */
/* c8 ignore next 8 */
// 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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const ResolutionContent = ({
});

const listOfBreaches =
/* 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.
exposedData &&
exposedData.map(({ id, title, breachDate }) => (
<div key={id} className={styles.breachItem}>
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/client/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export const Button = (props: ButtonProps) => {
// If `props.isLoading` is not undefined, the contents of the link is going to
// change into a loading indicator, which needs to be read by a screen reader:
const ariaLiveValue: AriaAttributes["aria-live"] =
/* c8 ignore next 3 */
// 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.
typeof isLoading === "boolean" ? "polite" : undefined;

return typeof href === "string" ? (
Expand Down
24 changes: 15 additions & 9 deletions src/app/components/client/FixNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const Steps = (props: {
breachesByClassification.highRisk,
).reduce((acc, array) => acc + array.length, 0);
const totalDataBrokerProfiles =
/* c8 ignore next 3 */
// 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.data.latestScanData?.results.length ?? 0;
const totalPasswordBreaches = Object.values(
breachesByClassification.passwordBreaches,
Expand Down Expand Up @@ -198,6 +201,10 @@ export const Steps = (props: {
className={`${
styles.activeProgressBarLine
} ${calculateActiveProgressBarPosition(props.currentSection)} ${
/* c8 ignore next 5 */
// 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.
isEligibleForStep(props.data, "Scan")
? styles.hasFourSteps
: styles.hasThreeSteps
Expand All @@ -219,29 +226,28 @@ const StepImage = (props: {
);
}

/* c8 ignore next 10 */
// 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.
const src =
props.section === "Scan"
? stepDataBrokerProfilesIcon
: props.section === "HighRisk"
? stepHighRiskDataBreachesIcon
: /* 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"
: props.section === "LeakedPasswords"
? stepLeakedPasswordsIcon
: stepSecurityRecommendationsIcon;

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

/* c8 ignore next 14 */
// 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.
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") {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/client/ScanResultCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
},
);
}
/* c8 ignore start */
if (props.isOnManualRemovePage) {
/* c8 ignore start */
return scanResult.manually_resolved
? l10n.getFragment(
"exposure-card-description-info-for-sale-fixed-manually-fixed",
Expand All @@ -174,8 +174,8 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
},
},
);
/* c8 ignore stop */
}
/* c8 ignore stop */
return l10n.getFragment(
"exposure-card-description-info-for-sale-action-needed-dashboard",
{
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/client/UpsellBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export function UpsellBadge(props: UpsellButtonProps) {
const countryCode = useContext(CountryCodeContext);
const session = useSession();

/* c8 ignore next 5 */
// 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.
if (!session.data) {
return <></>;
}
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/client/toolbar/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export const UserMenu = (props: UserMenuProps) => {
signout: "signout",
};

/* c8 ignore next 21 */
// 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.
const handleOnAction = (menuItemKey: Key) => {
switch (menuItemKey) {
case itemKeys.fxa:
Expand Down
3 changes: 3 additions & 0 deletions src/app/functions/server/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ export function getDashboardSummary(
}
}

/* c8 ignore next 11 */
// 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.
if (dataClasses.includes(BreachDataTypes.BankAccount)) {
summary.totalDataPointsNum += increment;
summary.dataBreachTotalDataPointsNum += increment;
Expand Down
3 changes: 3 additions & 0 deletions src/app/functions/server/getRelevantGuidedSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ export function hasCompletedStepSection(
data: StepDeterminationData,
section: "Scan" | "HighRisk" | "LeakedPasswords" | "SecurityTips",
): boolean {
/* c8 ignore next 5 */
// I believe this *is* covered by unit tests, but for some reason,
// since the upgrade to Node 20.10, it doesn't get marked as covered anymore:
if (section === "Scan") {
return hasCompletedStep(data, "Scan");
}
Expand Down
3 changes: 3 additions & 0 deletions src/app/functions/universal/guidedExperienceBreaches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export function getGuidedExperienceBreaches(

subscriberBreaches.forEach((breach) => {
// high risks
// 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.SSN)) {
guidedExperienceBreaches.highRisk.ssnBreaches.push(breach);
}
Expand Down
9 changes: 8 additions & 1 deletion src/app/hooks/useLocalDismissal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ export function useLocalDismissal(
const maxAgeInSeconds =
typeof options.duration === "number"
? options.duration
: 100 * 365 * 24 * 60 * 60;
: /* 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.
100 * 365 * 24 * 60 * 60;
setCookie(cookieId, Date.now().toString(), {
maxAge: maxAgeInSeconds,
});
/* c8 ignore next 3 */
// 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.
if (dismissOptions?.soft !== true) {
setIsDismissed(true);
}
Expand Down
Loading