chore: Bump vulnerable deps. (#34395)

* Bump all testing libs to force babel to upgrade itself.

* Remove react-hooks package, it's included in @testing-library/react.

* Add await to all useEvent calls.

* Remove duplicate babel/helpers.

* Deduplicate babel/core.

* Bump vite to non-vuln version.

* Bump estree-util-value-to-estree.
This commit is contained in:
Ivan Vasilov
2025-04-16 10:02:06 +02:00
committed by GitHub
parent 912dce3c4b
commit 326c7535f6
19 changed files with 249 additions and 2019 deletions

View File

@@ -140,7 +140,7 @@
"twoslash": "^0.3.1",
"typescript": "~5.5.0",
"unist-util-visit-parents": "5.1.3",
"vite": "^6.2.4",
"vite": "^6.2.6",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^3.0.5"
}

View File

@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks'
import { renderHook } from '@testing-library/react'
import { useRouter } from 'next/router'
import { withNuqsTestingAdapter } from 'nuqs/adapters/testing'
import { beforeAll, describe, expect, it, vi } from 'vitest'

View File

@@ -135,11 +135,10 @@
"@radix-ui/react-use-escape-keydown": "^1.0.3",
"@supabase/postgres-meta": "^0.64.4",
"@tailwindcss/container-queries": "^0.1.1",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^13.5.0",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.6.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.0.0",
"@types/common-tags": "^1.8.1",
"@types/file-saver": "^2.0.2",
"@types/json-logic-js": "^1.2.1",
@@ -179,7 +178,7 @@
"tailwindcss": "^3.4.1",
"tsx": "^4.19.3",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vite": "^6.2.6",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^3.0.5"
}

View File

@@ -7,7 +7,7 @@ When simulating clicks on these components, do the following:
```js
// for Popovers
import userEvent from '@testing-library/user-event'
userEvent.click('Hello world')
await userEvent.click('Hello world')
// for Dropdowns
import clickDropdown from 'tests/helpers'

View File

@@ -8,7 +8,7 @@ import { render } from 'tests/helpers'
test('shows copied text', async () => {
const callback = vi.fn()
render(<CopyButton text="some text" onClick={callback} />)
userEvent.click(await screen.findByText('Copy'))
await userEvent.click(await screen.findByText('Copy'))
await screen.findByText('Copied')
expect(callback).toBeCalled()
})

View File

@@ -2,12 +2,12 @@ import { prettyDOM, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import LogTable from 'components/interfaces/Settings/Logs/LogTable'
import dayjs from 'dayjs'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import relativeTime from 'dayjs/plugin/relativeTime'
import timezone from 'dayjs/plugin/timezone'
import utc from 'dayjs/plugin/utc'
import { beforeAll, expect, test, vi } from 'vitest'
import { render } from '../../helpers'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import utc from 'dayjs/plugin/utc'
import timezone from 'dayjs/plugin/timezone'
import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.extend(customParseFormat)
dayjs.extend(utc)
@@ -51,7 +51,7 @@ test.skip('can display log data', async () => {
const row = await screen.findByText(/event message/)
userEvent.click(row)
await userEvent.click(row)
// [Joshen] commenting out for now - seems like we need to mock more stuff
await screen.findByText(/my_key/)
@@ -79,7 +79,7 @@ test('can run if no queryType provided', async () => {
)
const run = await screen.findByText('Run')
userEvent.click(run)
await userEvent.click(run)
// expect(mockRun).toBeCalled()
})
@@ -104,7 +104,7 @@ test('can run if no queryType provided', async () => {
)
const run = await screen.findByText('Run')
userEvent.click(run)
await userEvent.click(run)
// expect(mockRun).toBeCalled()
})
@@ -156,7 +156,7 @@ test("closes the selection if the selected row's data changes", async () => {
/>
)
const text = await screen.findByText(/some event message/)
userEvent.click(text)
await userEvent.click(text)
rerender(
<LogTable

View File

@@ -25,7 +25,7 @@ test('renders warning', async () => {
onChange={mockFn}
/>
)
userEvent.click(await screen.findByText(RegExp(from.format('DD MMM'))))
await userEvent.click(await screen.findByText(RegExp(from.format('DD MMM'))))
await screen.findByText(/memory errors/)
await screen.findByText(RegExp(from.format('MMMM YYYY')))
})
@@ -42,7 +42,7 @@ test('renders dates in local time', async () => {
/>
)
// renders time locally
userEvent.click(await screen.findByText(RegExp(from.format('DD MMM'))))
await userEvent.click(await screen.findByText(RegExp(from.format('DD MMM'))))
await screen.findByText(RegExp(from.format('MMMM YYYY')))
})
@@ -58,7 +58,7 @@ test('renders datepicker selected dates in local time', async () => {
/>
)
// renders time locally
userEvent.click(await screen.findByText(RegExp(from.format('DD MMM'))))
await userEvent.click(await screen.findByText(RegExp(from.format('DD MMM'))))
// inputs with local time
await screen.findAllByDisplayValue(from.format('HH'))
await screen.findAllByDisplayValue(from.format('mm'))
@@ -73,20 +73,20 @@ test('datepicker onChange will return ISO string of selected dates', async () =>
const mockFn = vi.fn()
render(<DatePickers helpers={PREVIEWER_DATEPICKER_HELPERS} to={''} from={''} onChange={mockFn} />)
// renders time locally
userEvent.click(await screen.findByText('Custom'))
await userEvent.click(await screen.findByText('Custom'))
// inputs with local time
const toHH = await screen.findByDisplayValue('23')
userEvent.clear(toHH)
userEvent.type(toHH, '12')
await userEvent.clear(toHH)
await userEvent.type(toHH, '12')
// Find and click on the date elements
const day20 = await screen.findByText('20')
userEvent.click(day20)
await userEvent.click(day20)
const day21 = await screen.findByText('21')
userEvent.click(day21)
await userEvent.click(day21)
userEvent.click(await screen.findByText('Apply'))
await userEvent.click(await screen.findByText('Apply'))
expect(mockFn).toBeCalled()
const call = mockFn.mock.calls[0][0]

View File

@@ -29,7 +29,7 @@ vi.mock('lib/gotrue', () => ({
test.skip('Search will trigger a log refresh', async () => {
render(<LogsPreviewer projectRef="123" queryType="auth" />)
userEvent.type(screen.getByPlaceholderText(/Search events/), 'something{enter}')
await userEvent.type(screen.getByPlaceholderText(/Search events/), 'something{enter}')
await waitFor(
() => {
@@ -57,7 +57,7 @@ test.skip('poll count for new messages', async () => {
await waitFor(() => screen.getByText(/999/))
// Refresh button only exists with the queryType param, which no longer shows the id column
userEvent.click(screen.getByTitle('refresh'))
await userEvent.click(screen.getByTitle('refresh'))
await waitFor(() => screen.queryByText(/999/) === null)
await screen.findByText(/200/)
})

View File

@@ -7,7 +7,7 @@ test.skip('filter input change and submit', async () => {
// render(<PreviewFilterPanel onSearch={mockFn} queryUrl={'/'} />)
expect(mockFn).not.toBeCalled()
const search = screen.getByPlaceholderText(/Search/)
userEvent.type(search, '12345{enter}')
await userEvent.type(search, '12345{enter}')
expect(mockFn).toBeCalled()
})
@@ -20,14 +20,14 @@ test.skip('filter input change and submit', async () => {
// const mockFn = vi.fn()
// render(<PreviewFilterPanel onRefresh={mockFn} queryUrl={'/'} />)
// const btn = await screen.findByTitle('refresh')
// userEvent.click(btn)
// await userEvent.click(btn)
// expect(mockFn).toBeCalled()
// })
// test('Datepicker dropdown', async () => {
// const fn = vi.fn()
// render(<PreviewFilterPanel onSearch={fn} queryUrl={'/'} />)
// clickDropdown(await screen.findByText(/Last hour/))
// userEvent.click(await screen.findByText(/Last 3 hours/))
// await userEvent.click(await screen.findByText(/Last 3 hours/))
// expect(fn).toBeCalled()
// })

View File

@@ -3,9 +3,9 @@ import userEvent from '@testing-library/user-event'
import dayjs from 'dayjs'
import { LogsExplorerPage } from 'pages/project/[ref]/logs/explorer/index'
import { clickDropdown } from 'tests/helpers'
import { customRender as render } from 'tests/lib/custom-render'
import { routerMock } from 'tests/mocks/router'
import { beforeAll, describe, expect, test, vi } from 'vitest'
import { customRender as render } from 'tests/lib/custom-render'
const router = routerMock
@@ -37,12 +37,12 @@ test.skip('can display log data', async () => {
throw new Error('editor not found')
}
userEvent.type(editor, 'select \ncount(*) as my_count \nfrom edge_logs')
await userEvent.type(editor, 'select \ncount(*) as my_count \nfrom edge_logs')
await screen.findByText(/Save query/)
const button = await screen.findByTitle('run-logs-query')
userEvent.click(button)
await userEvent.click(button)
const row = await screen.findByText(/timestamp/)
userEvent.click(row)
await userEvent.click(row)
await screen.findByText(/metadata/)
await screen.findByText(/request/)
})
@@ -76,19 +76,19 @@ test.skip('custom sql querying', async () => {
}
// type new query
userEvent.type(editor, 'select \ncount(*) as my_count \nfrom edge_logs')
await userEvent.type(editor, 'select \ncount(*) as my_count \nfrom edge_logs')
// run query by button
userEvent.click(await screen.findByText('Run'))
await userEvent.click(await screen.findByText('Run'))
// run query by editor
userEvent.type(editor, '\nlimit 123{ctrl}{enter}')
await userEvent.type(editor, '\nlimit 123{ctrl}{enter}')
await screen.findByText(/my_count/) //column header
const rowValue = await screen.findByText(/12345/) // row value
// clicking on the row value should not show log selection panel
userEvent.click(rowValue)
await userEvent.click(rowValue)
await expect(screen.findByText(/Metadata/)).rejects.toThrow()
// should not see chronological features
@@ -98,7 +98,7 @@ test.skip('custom sql querying', async () => {
test.skip('bug: can edit query after selecting a log', async () => {
const { container } = render(<LogsExplorerPage dehydratedState={{}} />)
// run default query
userEvent.click(await screen.findByText('Run'))
await userEvent.click(await screen.findByText('Run'))
const rowValue = await screen.findByText(/12345/) // row value
// open up an show selection panel
await userEvent.click(rowValue)
@@ -112,10 +112,10 @@ test.skip('bug: can edit query after selecting a log', async () => {
}
// type new query
userEvent.click(editor)
userEvent.type(editor, ' something')
userEvent.type(editor, '\nsomething{ctrl}{enter}')
userEvent.click(await screen.findByText('Run'))
await userEvent.click(editor)
await userEvent.type(editor, ' something')
await userEvent.type(editor, '\nsomething{ctrl}{enter}')
await userEvent.click(await screen.findByText('Run'))
// closes the selection panel
await expect(screen.findByText('Copy')).rejects.toThrow()
@@ -135,7 +135,7 @@ test.skip('query warnings', async () => {
test('field reference', async () => {
render(<LogsExplorerPage dehydratedState={{}} />)
userEvent.click(await screen.findByText('Field Reference'))
await userEvent.click(await screen.findByText('Field Reference'))
await screen.findByText('metadata.request.cf.asOrganization')
})

View File

@@ -77,6 +77,6 @@
"tsx": "^4.19.3",
"typescript": "~5.5.0",
"unist-builder": "3.0.0",
"vite": "^6.2.4"
"vite": "^6.2.6"
}
}

View File

@@ -55,8 +55,8 @@
"overrides": {
"@supabase/supabase-js>@supabase/auth-js": "2.69.0-rc.3",
"vinxi>esbuild": "0.25.2",
"@tanstack/directive-functions-plugin>vite": "6.2.4",
"@tanstack/react-start-plugin>vite": "6.2.4"
"@tanstack/directive-functions-plugin>vite": "6.2.6",
"@tanstack/react-start-plugin>vite": "6.2.6"
}
},
"engines": {

View File

@@ -34,7 +34,7 @@
"sql-formatter": "^15.0.0",
"tsconfig": "workspace:*",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vite": "^6.2.6",
"vitest": "^3.0.5"
}
}

View File

@@ -25,7 +25,7 @@
"pg": "^8.13.1",
"postgres-array": "^3.0.2",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vite": "^6.2.6",
"vitest": "^3.0.5"
}
}

View File

@@ -142,15 +142,15 @@ describe('useRegisterCommand', () => {
expect(screen.getByRole('listitem')).toHaveTextContent('Command one')
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.queryByRole('listitem')).toBeNull()
})
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.getByRole('listitem')).toHaveTextContent('Command one')
@@ -169,8 +169,8 @@ describe('useRegisterCommand', () => {
expect(screen.getAllByRole('listitem')).toHaveLength(2)
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.queryAllByRole('listitem')).toHaveLength(0)
@@ -189,15 +189,15 @@ describe('useRegisterCommand', () => {
expect(screen.getByRole('listitem')).toHaveTextContent('Command one')
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.queryByRole('listitem')).toBeNull()
})
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.getByRole('listitem')).toHaveTextContent('Command one')
@@ -216,8 +216,8 @@ describe('useRegisterCommand', () => {
expect(screen.getByText('Command one')).toBeVisible()
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.queryByText('Command one')).toBeNull()
@@ -240,8 +240,8 @@ describe('useRegisterCommand', () => {
// React renders twice in dev mode
expect(mockCommandMenuRenderCount).toBe(2)
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => screen.getByText('Render flag: 1'))

View File

@@ -4,8 +4,8 @@ import { useEffect, useState } from 'react'
import { describe, expect, it } from 'vitest'
import { CommandProvider } from '../CommandProvider'
import { useCurrentPage, useRegisterPage, useSetPage } from './pagesHooks'
import { PageType } from '../utils'
import { useCurrentPage, useRegisterPage, useSetPage } from './pagesHooks'
const PageAdderOne = ({ enabled = true }) => {
useRegisterPage('Page one', { type: PageType.Commands, sections: [] }, { enabled })
@@ -97,8 +97,8 @@ describe('useRegisterPage', () => {
expect(screen.getByTestId('current-page')).toHaveTextContent('Page one')
})
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.getByTestId('current-page')).toHaveTextContent('[None]')
@@ -119,15 +119,15 @@ describe('useRegisterPage', () => {
expect(screen.getByTestId('current-page')).toHaveTextContent('Page one')
})
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.getByTestId('current-page')).toHaveTextContent('[None]')
})
act(() => {
userEvent.click(screen.getByRole('button'))
await act(async () => {
await userEvent.click(screen.getByRole('button'))
})
await waitFor(() => {
expect(screen.getByTestId('current-page')).toHaveTextContent('Page one')

View File

@@ -52,10 +52,10 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.6.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^13.5.0",
"@testing-library/user-event": "^14.0.0",
"@types/common-tags": "^1.8.4",
"@types/lodash": "^4.17.5",
"@types/mdast": "^3.0.0",
@@ -67,7 +67,7 @@
"typescript": "~5.5.0",
"unified": "^11.0.5",
"vfile": "^6.0.3",
"vite": "^6.2.4",
"vite": "^6.2.6",
"vitest": "^3.0.5"
},
"peerDependencies": {

View File

@@ -80,8 +80,8 @@
},
"devDependencies": {
"@ctrl/tinycolor": "^3.4.0",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@testing-library/jest-dom": "^6.6.0",
"@testing-library/react": "^16.0.0",
"@types/lodash": "4.17.5",
"@types/node": "catalog:",
"@types/react": "catalog:",
@@ -94,7 +94,7 @@
"style-dictionary": "^3.7.1",
"tsconfig": "workspace:*",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vite": "^6.2.6",
"vitest": "^3.0.5"
},
"peerDependencies": {

2111
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff