Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sshin/3108
Browse files Browse the repository at this point in the history
  • Loading branch information
suejung-sentry committed Jan 14, 2025
2 parents 616eaa8 + 8c7e9aa commit 6e35b3b
Show file tree
Hide file tree
Showing 71 changed files with 2,400 additions and 2,041 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -500,5 +500,13 @@ module.exports = {
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',

'no-restricted-syntax': [
'warn',
{
selector: "JSXText[value=/\\bGithub\\b|\\bGitlab\\b|\\bBitBucket\\b/]",
message: "Use correct casing (GitHub, GitLab, Bitbucket)"
}
]
},
}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
25.1.3
25.1.10
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@
"@babel/eslint-parser": "^7.25.9",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@chromatic-com/storybook": "^1",
"@codecov/vite-plugin": "^1.2.1",
"@sentry/vite-plugin": "^2.22.4",
"@storybook/addon-a11y": "^8.3.4",
"@storybook/addon-actions": "^8.3.4",
"@storybook/addon-essentials": "^8.3.4",
"@storybook/addon-links": "^8.3.4",
"@storybook/blocks": "^8.3.4",
"@storybook/builder-vite": "^8.3.4",
"@storybook/manager-api": "^8.3.4",
"@storybook/node-logger": "^8.3.4",
"@storybook/react": "^8.3.4",
"@storybook/react-vite": "^8.3.4",
"@storybook/theming": "^8.3.4",
"@codecov/vite-plugin": "^1.7.0",
"@sentry/vite-plugin": "^2.22.7",
"@storybook/addon-a11y": "^8.3.7",
"@storybook/addon-actions": "^8.3.7",
"@storybook/addon-essentials": "^8.3.7",
"@storybook/addon-links": "^8.3.7",
"@storybook/blocks": "^8.3.7",
"@storybook/builder-vite": "^8.3.7",
"@storybook/manager-api": "^8.3.7",
"@storybook/node-logger": "^8.3.7",
"@storybook/react": "^8.3.7",
"@storybook/react-vite": "^8.3.7",
"@storybook/theming": "^8.3.7",
"@tailwindcss/container-queries": "^0.1.1",
"@tanstack/eslint-plugin-query": "^4.38.0",
"@tanstack/react-query-devtools": "^4.29.6",
Expand All @@ -129,13 +129,14 @@
"@types/react-modal": "^3.16.2",
"@types/react-router-dom": "^5.3.3",
"@types/semver": "^7",
"@typescript-eslint/eslint-plugin": "^8.14.0",
"@typescript-eslint/parser": "^8.14.0",
"@vitejs/plugin-legacy": "^5.4.3",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-istanbul": "^2.1.3",
"@vitest/eslint-plugin": "^1.1.7",
"@vitest/ui": "^2.1.3",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@typescript-eslint/utils": "^8.19.1",
"@vitejs/plugin-legacy": "^6.0.0",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-istanbul": "^2.1.8",
"@vitest/eslint-plugin": "^1.1.21",
"@vitest/ui": "^2.1.8",
"autoprefixer": "^10.4.14",
"babel-preset-react-app": "^10.0.1",
"confusing-browser-globals": "^1.0.11",
Expand All @@ -162,12 +163,12 @@
"storybook": "^8.4.7",
"tailwindcss": "^3.4.4",
"terser": "^5.34.1",
"typescript": "^4.9.5",
"vite": "^5.4.10",
"typescript": "~5.7.3",
"vite": "^6.0.6",
"vite-plugin-ejs": "^1.7.0",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.3"
"vite-plugin-svgr": "^4.3.0",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^2.1.8"
},
"engines": {
"node": ">=22.11.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function InstallationHelpBanner() {
const { provider } = useParams()
const { params } = useLocationParams()

if (providerToName(provider) !== 'Github') return null
if (providerToName(provider) !== 'GitHub') return null

const { setup_action: setupAction } = params
if (setupAction !== 'install') return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function UserDropdown() {
})

const { provider } = useParams<URLParams>()
const isGh = providerToName(provider) === 'Github'
const isGh = providerToName(provider) === 'GitHub'
const history = useHistory()

const items =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function GithubIntegrationCopy({ integrationId }) {
return (
<p>
This account is configured via the GitHub App. You can manage the apps
repository integration on <A to={{ pageName: 'github' }}>Github.</A>
repository integration on <A to={{ pageName: 'github' }}>GitHub.</A>
</p>
)
return (
Expand Down Expand Up @@ -47,7 +47,7 @@ function GithubIntegrationSection() {

return (
<div className="flex flex-col gap-2">
<h2 className="text-lg font-semibold">Github Integration</h2>
<h2 className="text-lg font-semibold">GitHub Integration</h2>
<GithubIntegrationCopy integrationId={accountDetails?.integrationId} />
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('GithubIntegrationSection', () => {
render(<GithubIntegrationSection />, { wrapper: wrapper() })

const link = await screen.findByRole('link', {
name: /Github/i,
name: /GitHub/i,
})
expect(link).toBeInTheDocument()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default function AdminTable() {
if (!isLoading && !tableData?.length) {
return (
<p>
No admins yet. Note that admins in your Github organization are
No admins yet. Note that admins in your GitHub organization are
automatically considered admins.
</p>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('ManageAdminCard', () => {
render(<ManageAdminCard />, { wrapper })

const noAdmins = await screen.findByText(
/No admins yet. Note that admins in your Github organization are automatically considered admins./
/No admins yet. Note that admins in your GitHub organization are automatically considered admins./
)
expect(noAdmins).toBeInTheDocument()
})
Expand All @@ -123,7 +123,7 @@ describe('ManageAdminCard', () => {
render(<ManageAdminCard />, { wrapper })

const noAdmins = await screen.findByText(
/No admins yet. Note that admins in your Github organization are automatically considered admins./
/No admins yet. Note that admins in your GitHub organization are automatically considered admins./
)
expect(noAdmins).toBeInTheDocument()
})
Expand Down
4 changes: 2 additions & 2 deletions src/pages/CodecovAIPage/InstallCodecovAI/InstallCodecovAI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const COPY_APP_INSTALL_STRING =
const InstallCodecovAI: React.FC = () => {
const { theme } = useThemeContext()
const isDarkMode = theme === Theme.DARK
const githubImage = loginProviderImage('Github', !isDarkMode)
const githubImage = loginProviderImage('GitHub', !isDarkMode)

return (
<div>
<Card>
<Card.Header>
<Card.Title size="base">
Install the Codecov AI app on Github
Install the Codecov AI app on GitHub
</Card.Title>
</Card.Header>
<Card.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
QueryClientProvider as QueryClientProviderV5,
QueryClient as QueryClientV5,
} from '@tanstack/react-queryV5'
import { render, screen } from '@testing-library/react'
import { render, screen, waitFor } from '@testing-library/react'
import { graphql, HttpResponse } from 'msw'
import { setupServer } from 'msw/node'
import { Suspense } from 'react'
Expand All @@ -22,11 +22,13 @@ const mockCommitPageData = ({
coverageEnabled = true,
firstPullRequest = false,
comparisonError = false,
hasCachedBundle = false,
}: {
bundleAnalysisEnabled?: boolean
coverageEnabled?: boolean
firstPullRequest?: boolean
comparisonError?: boolean
hasCachedBundle?: boolean
}) => ({
owner: {
isCurrentUserPartOfOrg: true,
Expand All @@ -43,7 +45,7 @@ const mockCommitPageData = ({
bundleAnalysis: {
bundleAnalysisReport: {
__typename: 'BundleAnalysisReport',
isCached: false,
isCached: hasCachedBundle,
},
bundleAnalysisCompareWithParent: {
__typename: firstPullRequest
Expand Down Expand Up @@ -179,6 +181,7 @@ interface SetupArgs {
noData?: boolean
firstPullRequest?: boolean
comparisonError?: boolean
hasCachedBundle?: boolean
}

describe('CommitBundleAnalysis', () => {
Expand All @@ -190,13 +193,15 @@ describe('CommitBundleAnalysis', () => {
noData = false,
firstPullRequest = false,
comparisonError = false,
hasCachedBundle = false,
}: SetupArgs = {
coverageEnabled: true,
bundleAnalysisEnabled: true,
uncompress: 0,
noData: false,
firstPullRequest: false,
comparisonError: false,
hasCachedBundle: false,
}
) {
server.use(
Expand All @@ -207,6 +212,7 @@ describe('CommitBundleAnalysis', () => {
bundleAnalysisEnabled,
firstPullRequest,
comparisonError,
hasCachedBundle,
}),
})
}),
Expand Down Expand Up @@ -240,6 +246,33 @@ describe('CommitBundleAnalysis', () => {
expect(commitBundleAnalysisTable).toBeInTheDocument()
})

describe('there are cached bundles', () => {
it('renders CachedBundleContentBanner', async () => {
setup({ hasCachedBundle: true })
render(<CommitBundleAnalysis />, { wrapper })

const cachedBundleContentBanner = await screen.findByText(
'The reported bundle size includes cached data from previous commits'
)
expect(cachedBundleContentBanner).toBeInTheDocument()
})
})

describe('there are no cached bundles', () => {
it('does not render CachedBundleContentBanner', async () => {
setup({ hasCachedBundle: false })
render(<CommitBundleAnalysis />, { wrapper })

await waitFor(() => queryClientV5.isFetching())
await waitFor(() => !queryClientV5.isFetching())

const cachedBundleContentBanner = screen.queryByText(
'The reported bundle size includes cached data from previous commits'
)
expect(cachedBundleContentBanner).not.toBeInTheDocument()
})
})

describe('there is no data', () => {
it('renders unknown error message', async () => {
setup({
Expand Down Expand Up @@ -514,6 +547,33 @@ describe('CommitBundleAnalysis', () => {
})
})

describe('there are cached bundles', () => {
it('renders CachedBundleContentBanner', async () => {
setup({ hasCachedBundle: true })
render(<CommitBundleAnalysis />, { wrapper })

const cachedBundleContentBanner = await screen.findByText(
'The reported bundle size includes cached data from previous commits'
)
expect(cachedBundleContentBanner).toBeInTheDocument()
})
})

describe('there are no cached bundles', () => {
it('does not render CachedBundleContentBanner', async () => {
setup({ hasCachedBundle: false })
render(<CommitBundleAnalysis />, { wrapper })

await waitFor(() => queryClientV5.isFetching())
await waitFor(() => !queryClientV5.isFetching())

const cachedBundleContentBanner = screen.queryByText(
'The reported bundle size includes cached data from previous commits'
)
expect(cachedBundleContentBanner).not.toBeInTheDocument()
})
})

it('renders CommitBundleAnalysisTable', async () => {
setup({ coverageEnabled: false, bundleAnalysisEnabled: true })
render(<CommitBundleAnalysis />, { wrapper })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useSuspenseQuery as useSuspenseQueryV5 } from '@tanstack/react-queryV5'
import { lazy, Suspense } from 'react'
import { useParams } from 'react-router-dom'

import { CachedBundleContentBanner } from 'shared/CachedBundleContentBanner/CachedBundleContentBanner'
import ComparisonErrorBanner from 'shared/ComparisonErrorBanner'
import { ReportUploadType } from 'shared/utils/comparison'
import Spinner from 'ui/Spinner'
Expand Down Expand Up @@ -34,9 +35,13 @@ const Loader = () => (

interface BundleContentProps {
bundleCompareType?: TBundleAnalysisComparisonResult
hasCachedBundle: boolean
}

const BundleContent: React.FC<BundleContentProps> = ({ bundleCompareType }) => {
const BundleContent: React.FC<BundleContentProps> = ({
bundleCompareType,
hasCachedBundle,
}) => {
if (bundleCompareType === 'FirstPullRequest') {
return (
<>
Expand All @@ -59,9 +64,12 @@ const BundleContent: React.FC<BundleContentProps> = ({ bundleCompareType }) => {
}

return (
<Suspense fallback={<Loader />}>
<CommitBundleAnalysisTable />
</Suspense>
<>
{hasCachedBundle ? <CachedBundleContentBanner /> : null}
<Suspense fallback={<Loader />}>
<CommitBundleAnalysisTable />
</Suspense>
</>
)
}

Expand All @@ -80,19 +88,36 @@ const CommitBundleAnalysis: React.FC = () => {
commitPageData?.commit?.bundleAnalysis?.bundleAnalysisCompareWithParent
?.__typename

let hasCachedBundle = false
if (
commitPageData?.commit?.bundleAnalysis?.bundleAnalysisReport?.__typename ===
'BundleAnalysisReport'
) {
hasCachedBundle =
commitPageData?.commit?.bundleAnalysis?.bundleAnalysisReport?.isCached
}

if (
commitPageData?.coverageEnabled &&
commitPageData?.bundleAnalysisEnabled
) {
return <BundleContent bundleCompareType={bundleCompareType} />
return (
<BundleContent
bundleCompareType={bundleCompareType}
hasCachedBundle={hasCachedBundle}
/>
)
}

return (
<>
<p className="flex w-full items-center gap-2 bg-ds-gray-primary px-2 py-4 text-base">
<BundleMessage />
</p>
<BundleContent bundleCompareType={bundleCompareType} />
<BundleContent
bundleCompareType={bundleCompareType}
hasCachedBundle={hasCachedBundle}
/>
</>
)
}
Expand Down
Loading

0 comments on commit 6e35b3b

Please sign in to comment.