mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-09-24 05:26:59 +00:00
* feat: 初始化插件系统 * refactor: 收口插件系统运行时重构 * perf: 优化插件系统类型提示 * fix&perf: 修复和优化插件系统 * fix: 修复gitignore规则误忽略插件文件的问题 * fix: 修复运行时插件根路径算错的问题 * fix: 加强插件发现和路由注册的防护措施 * revert: 回滚定时任务白名单 * fix: 移除未使用的应用路由注册探测 * revert: 恢复部分代码 * perf: 优化插件系统 * docs: 新增插件开发文档 * perf: 优化插件管理模块 * perf: 提升插件系统核心能力 * refactor: 重构生命周期 step runner * fix: 修复lint错误 * test: 清理测试用例 * test: 调整测试目录名称 * fix: 修复前后端目录硬编码的问题 * fix: 修复插件系统安全性缺口 * refactor: 重新设计插件生命周期 Migration 事务与回滚 * perf: 优化插件系统边界问题 * refactor: 重构当前插件系统的依赖体系设计 * perf: 优化代码 * perf: 优化代码 * fix: 修复代码合并问题 * fix: 修复bug * perf: 优化代码 * perf&fix: 优化代码和修复bug * docs: 优化文档格式 * feat: 适配Vue2版本 * docs: 更新README文档 * fix: 修复ruff lint错误 * chore: 更新后端依赖文件
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
import { readdirSync } from 'node:fs'
|
|
import { dirname, join, relative } from 'node:path'
|
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = dirname(__filename)
|
|
|
|
const collectTestFiles = (root) => {
|
|
const entries = readdirSync(root, { withFileTypes: true })
|
|
const testFiles = []
|
|
|
|
for (const entry of entries) {
|
|
const entryPath = join(root, entry.name)
|
|
if (entry.isDirectory()) {
|
|
testFiles.push(...collectTestFiles(entryPath))
|
|
continue
|
|
}
|
|
if (entry.isFile() && entry.name.endsWith('.test.js')) {
|
|
testFiles.push(entryPath)
|
|
}
|
|
}
|
|
|
|
return testFiles.sort()
|
|
}
|
|
|
|
const testFiles = collectTestFiles(__dirname)
|
|
|
|
if (testFiles.length === 0) {
|
|
console.error('No plugin tests found')
|
|
process.exitCode = 1
|
|
} else {
|
|
let failedCount = 0
|
|
|
|
for (const testFile of testFiles) {
|
|
const testName = relative(__dirname, testFile)
|
|
|
|
try {
|
|
await import(pathToFileURL(testFile).href)
|
|
console.log(`ok ${testName}`)
|
|
} catch (error) {
|
|
failedCount += 1
|
|
console.error(`not ok ${testName}`)
|
|
console.error(error?.stack ?? error)
|
|
}
|
|
}
|
|
|
|
if (failedCount > 0) {
|
|
console.error(`Plugin tests failed: ${failedCount}/${testFiles.length}`)
|
|
process.exitCode = 1
|
|
} else {
|
|
console.log(`Plugin tests passed: ${testFiles.length}`)
|
|
}
|
|
}
|