test(ci): remove suite-order mock coupling

This commit is contained in:
YeonGyu-Kim
2026-05-15 18:21:04 +09:00
parent f1fb1e08eb
commit a02686e729
17 changed files with 387 additions and 401 deletions
+8 -8
View File
@@ -1,4 +1,4 @@
import { closeSync, existsSync, fsyncSync, openSync, readFileSync, renameSync, writeFileSync } from "node:fs"
import * as fs from "node:fs"
import { applyEdits, modify } from "jsonc-parser"
@@ -36,10 +36,10 @@ function updateJsoncPluginArray(content: string, pluginEntries: string[]): strin
}
export function migrateLegacyPluginEntry(configPath: string): boolean {
if (!existsSync(configPath)) return false
if (!fs.existsSync(configPath)) return false
try {
const content = readFileSync(configPath, "utf-8")
const content = fs.readFileSync(configPath, "utf-8")
if (!content.includes(LEGACY_PLUGIN_NAME)) return false
const parseResult = parseJsoncSafe<OpenCodeConfig>(content)
@@ -53,15 +53,15 @@ export function migrateLegacyPluginEntry(configPath: string): boolean {
if (!updated || updated === content) return false
const tempPath = `${configPath}.tmp`
writeFileSync(tempPath, updated, "utf-8")
const tempFileDescriptor = openSync(tempPath, "r+")
fs.writeFileSync(tempPath, updated, "utf-8")
const tempFileDescriptor = fs.openSync(tempPath, "r+")
try {
fsyncSync(tempFileDescriptor)
fs.fsyncSync(tempFileDescriptor)
} finally {
closeSync(tempFileDescriptor)
fs.closeSync(tempFileDescriptor)
}
renameSync(tempPath, configPath)
fs.renameSync(tempPath, configPath)
log("[migrateLegacyPluginEntry] Auto-migrated opencode.json plugin entry", {
configPath,
from: LEGACY_PLUGIN_NAME,