fix: CI test failures

- Add React import back in FileTreeComponent.test.tsx (required for JSX)
- Fix isValidPath to recognize Windows paths on non-Windows platforms

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Jiayuan
2026-01-23 16:15:15 +08:00
parent 58817b651f
commit 0833a6e972
2 changed files with 7 additions and 1 deletions

View File

@@ -1,7 +1,12 @@
import * as path from 'path'
// Regex to match Windows absolute paths (e.g., C:\Users or D:\)
const WINDOWS_ABSOLUTE_PATH_REGEX = /^[a-zA-Z]:[/\\]/
export function isValidPath(inputPath: string): boolean {
if (!path.isAbsolute(inputPath)) {
// Check for absolute path (POSIX or Windows)
const isAbsolute = path.isAbsolute(inputPath) || WINDOWS_ABSOLUTE_PATH_REGEX.test(inputPath)
if (!isAbsolute) {
return false
}

View File

@@ -1,6 +1,7 @@
/**
* @vitest-environment jsdom
*/
import * as React from 'react'
import { act } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { createRoot, type Root } from 'react-dom/client'