Skip to content

Commit

Permalink
chore: update vitest and vitest-when (#17149)
Browse files Browse the repository at this point in the history
* chore: update vitest and vitest-when
  • Loading branch information
koji authored Dec 20, 2024
1 parent a80aa00 commit 04dea6c
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('DownloadUpdateModal', () => {

let props: React.ComponentProps<typeof RobotUpdateProgressModal>
const mockCreateLiveCommand = vi.fn()
const mockDispatchStartRobotUpdate = vi.fn()

beforeEach(() => {
mockCreateLiveCommand.mockResolvedValue(null)
Expand All @@ -68,7 +69,9 @@ describe('DownloadUpdateModal', () => {
progressPercent: 50,
})
vi.mocked(getRobotSessionIsManualFile).mockReturnValue(false)
vi.mocked(useDispatchStartRobotUpdate).mockReturnValue(vi.fn)
vi.mocked(useDispatchStartRobotUpdate).mockReturnValue(
mockDispatchStartRobotUpdate
)
vi.mocked(getRobotUpdateDownloadError).mockReturnValue(null)
})

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitejs/plugin-react": "4.2.0",
"@vitest/coverage-v8": "1.3.0",
"@vitest/coverage-v8": "2.1.8",
"ajv": "6.12.3",
"aws-sdk": "^2.493.0",
"babel-loader": "^8.2.2",
Expand Down Expand Up @@ -151,8 +151,8 @@
"typescript": "5.3.3",
"url-loader": "^2.1.0",
"vite": "5.3.2",
"vitest": "1.2.2",
"vitest-when": "0.3.1",
"vitest": "2.1.8",
"vitest-when": "0.5.0",
"wait-on": "^4.0.2",
"webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.6.0",
Expand Down
8 changes: 5 additions & 3 deletions protocol-designer/src/__tests__/persist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import type { MockInstance } from 'vitest'
import * as persist from '../persist'

describe('persist', () => {
let getItemSpy: MockInstance<unknown[], unknown>
let setItemSpy: MockInstance<unknown[], unknown>
let getItemSpy: MockInstance<(key: string) => string | null>
let setItemSpy: MockInstance<(key: string, value: string) => void>

beforeEach(() => {
const LocalStorageProto = Object.getPrototypeOf(global.localStorage)
getItemSpy = vi.spyOn(LocalStorageProto, 'getItem')
getItemSpy = vi.spyOn(LocalStorageProto, 'getItem') as MockInstance<
(key: string) => string | null
>
setItemSpy = vi.spyOn(LocalStorageProto, 'setItem')
})

Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion vitest.config.ts → vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ export default mergeConfig(
environment: 'jsdom',
allowOnly: true,
exclude: [...configDefaults.exclude, '**/node_modules/**', '**/dist/**'],
setupFiles: ['./setup-vitest.ts'],
setupFiles: ['./setup-vitest.mts'],
coverage: {
exclude: ['**/node_modules/**', '**/dist/**', '**/__tests__/**'],
provider: 'v8',
reporter: ['text', 'json', 'html'],
},
},
resolve: {
alias: {
Expand Down
Loading

0 comments on commit 04dea6c

Please sign in to comment.