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

chore: Update layout/EnterpriseLoginLayout test to Vitest #3209

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b766325
add in vitest
nicholas-codecov Sep 16, 2024
8a1c7b1
rename old_ui tests from spec to test for vitest
nicholas-codecov Sep 16, 2024
627b145
add in data-testid to icon
nicholas-codecov Sep 16, 2024
dc8fe8d
temp
nicholas-codecov Sep 16, 2024
3f154bb
ignore test test files in craco
nicholas-codecov Sep 16, 2024
71f0a33
add in coverage stuff for vitest
nicholas-codecov Sep 16, 2024
b08164b
setup CI to run vitest tests
nicholas-codecov Sep 16, 2024
7b06a1e
whoops didn't mean to commit these
nicholas-codecov Sep 16, 2024
b572a9d
add names to test runner indexes
nicholas-codecov Sep 16, 2024
ce0b6e5
set min threads
nicholas-codecov Sep 16, 2024
bb488b9
add in reporter all tests
nicholas-codecov Sep 16, 2024
950d6ac
conditionally enable junit test reporter
nicholas-codecov Sep 16, 2024
64c2939
only include src files in coverage reporting
nicholas-codecov Sep 16, 2024
9917c18
exclude some files from coverage reporting
nicholas-codecov Sep 16, 2024
cab1973
there are some issues with coverage excludes making the files not acc…
nicholas-codecov Sep 17, 2024
f5b6466
forgot that I moved the setup file to ts
nicholas-codecov Sep 17, 2024
d2bd52b
add --changed to test watch command
nicholas-codecov Sep 17, 2024
d120380
add name to prod uploads for craco and vitest
nicholas-codecov Sep 17, 2024
fc5eb5b
tidying up some stuff in the ci
nicholas-codecov Sep 17, 2024
168ffa4
disable vitest to see what happens
nicholas-codecov Sep 17, 2024
619bbac
increase n builds
nicholas-codecov Sep 17, 2024
84d1276
remove generating icons for webpack
nicholas-codecov Sep 18, 2024
3d6ef25
update ci command
nicholas-codecov Sep 18, 2024
71f0955
rename to .jsx because it contains jsx
nicholas-codecov Sep 18, 2024
53616b2
swap from v8 to istanbul for coverage reporting
nicholas-codecov Sep 18, 2024
d188c3e
only generate icons for vite, and craco build
nicholas-codecov Sep 18, 2024
2a1068d
small tweaks to the codecov yml config
nicholas-codecov Sep 18, 2024
976ade0
generate webpack icons before running tests
nicholas-codecov Sep 18, 2024
0a5ed38
styling tweaks to vitest
nicholas-codecov Sep 18, 2024
e53de7e
small tweaks to vitest config
nicholas-codecov Sep 18, 2024
19b463e
add in msw 2
nicholas-codecov Sep 18, 2024
634a18b
add in examples so our test split function doesn't complain
nicholas-codecov Sep 18, 2024
6e656c5
add in all test file extensions
nicholas-codecov Sep 18, 2024
52fd40c
remove left over log
nicholas-codecov Sep 18, 2024
31b1335
tweak excludes
nicholas-codecov Sep 18, 2024
850a7a8
disable this eslint rule as it seems we need to do the manual cleanup
nicholas-codecov Sep 19, 2024
d8c6af2
make sure TS knows about the vi types globally
nicholas-codecov Sep 19, 2024
79f70a0
sort out vitest with setup stuff as well as loading correct envs
nicholas-codecov Sep 19, 2024
9f73de4
resolve issue with vitest types interferring with craco stuff
nicholas-codecov Sep 19, 2024
1c2aebc
tweak reporters
nicholas-codecov Sep 19, 2024
5d6b24e
remove test files from coverage reporting
nicholas-codecov Sep 19, 2024
ac157ba
update Header
nicholas-codecov Sep 19, 2024
e4839c0
update EnterpriseLoginLayout
nicholas-codecov Sep 19, 2024
6293387
Merge branch 'main' into chore-vitest-update-enterprise-login-layout-…
nicholas-codecov Sep 19, 2024
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
@@ -1,20 +1,29 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { render, screen } from '@testing-library/react'
import { MemoryRouter, Route, useLocation } from 'react-router-dom'
import { type Mock } from 'vitest'

import EnterpriseLoginLayout from './EnterpriseLoginLayout'

jest.mock('layouts/Header/components/GuestHeader', () => () => 'GuestHeader')
jest.mock('layouts/Footer', () => () => 'Footer')
jest.mock('shared/GlobalBanners', () => () => 'GlobalBanners')
jest.mock('layouts/ToastNotifications', () => () => 'ToastNotifications')

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useLocation: jest.fn(),
vi.mock('layouts/Header/components/GuestHeader', () => ({
default: () => 'GuestHeader',
}))
vi.mock('layouts/Footer', () => ({ default: () => 'Footer' }))
vi.mock('shared/GlobalBanners', () => ({ default: () => 'GlobalBanners' }))
vi.mock('layouts/ToastNotifications', () => ({
default: () => 'ToastNotifications',
}))

const mockedUseLocation = useLocation as jest.Mock
vi.mock('react-router-dom', async () => {
const reactRouterDom = await vi.importActual('react-router-dom')

return {
...reactRouterDom,
useLocation: vi.fn(),
}
})

const mockedUseLocation = useLocation as Mock

const queryClient = new QueryClient({
defaultOptions: {
Expand Down Expand Up @@ -43,7 +52,7 @@ describe('EnterpriseLoginLayout', () => {
})

afterAll(() => {
jest.restoreAllMocks()
vi.restoreAllMocks()
})

it('renders children', () => {
Expand Down
Loading