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(test): migrate to vitest v2 #3326

Merged
merged 3 commits into from
Aug 29, 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
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@
"@types/jsdom": "^21.1.4",
"@types/node": "20.11.4",
"@types/supertest": "^2.0.12",
"@vitest/coverage-v8": "^1.1.0",
"@vitest/coverage-v8": "^2.0.5",
"arg": "^5.0.2",
"crypto-js": "^4.1.1",
"esbuild": "^0.15.12",
Expand All @@ -631,7 +631,7 @@
"supertest": "^6.3.3",
"typescript": "^5.3.3",
"vite-plugin-fastly-js-compute": "^0.4.2",
"vitest": "^1.2.2",
"vitest": "^2.0.5",
"wrangler": "^3.58.0",
"ws": "^8.17.0",
"zod": "^3.20.2"
Expand Down
2 changes: 1 addition & 1 deletion src/helper/ssg/ssg.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('toSSG function', () => {
writeFile: vi.fn(() => Promise.resolve()),
mkdir: vi.fn(() => Promise.resolve()),
}
const afterGenerateHookMock: AfterGenerateHook = vi.fn((result) => {
const afterGenerateHookMock: AfterGenerateHook = vi.fn<AfterGenerateHook>((result) => {
if (result.files) {
result.files.forEach((file) => console.log(file))
}
Expand Down
4 changes: 2 additions & 2 deletions src/router/common.case.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Suite } from 'vitest'
import type { ParamIndexMap, Params, Router } from '../router'

const getSuiteHierarchy = (suite: Suite) => {
const getSuiteHierarchy = (suite?: Suite) => {
const res: Suite[] = []
let s: Suite | undefined = suite
while (s) {
Expand All @@ -28,7 +28,7 @@ export const runTest = ({

beforeEach(({ task, skip: skipTask }) => {
const suites = getSuiteHierarchy(task.suite)
const name = [...suites.slice(3).map((s) => s.name), task.name].join(' > ')
const name = [...suites.slice(2).map((s) => s.name), task.name].join(' > ')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const isSkip = skip.find((s) => s.tests.includes(name))
if (isSkip) {
console.log(`Skip: ${isSkip.reason}`)
Expand Down
Loading