fix: remove unused imports and fix logger test isolation

- Remove unused imports (run, trackDuration, PerformanceTracker,
  ConfigManager, disconnectDb) flagged by ESLint
- Remove unused isSlow variable in performance-monitor catch block
- Add eslint-disable for require() in Playwright JS script
- Fix logger-performance test flakiness by using vi.resetModules()
  with dynamic imports to prevent cached logger references across
  test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-04-05 12:15:18 +08:00
parent e54d94fce2
commit e2669af870
14 changed files with 157 additions and 66 deletions

View File

@@ -132,7 +132,7 @@ describe('prepareSql', () => {
it('should preserve string literals with escaped quotes', () => {
const sql = "WHERE UserName = 'O''Brien'"
const result = prepareSql(sql)
expect(result).toBe('WHERE "UserName" = \'O\'\'Brien\'')
expect(result).toBe("WHERE \"UserName\" = 'O''Brien'")
})
it('should preserve $N parameter placeholders', () => {
@@ -145,17 +145,13 @@ describe('prepareSql', () => {
it('should handle COUNT(*) correctly', () => {
const sql = 'SELECT COUNT(*) as count FROM "dbo"."BIPUsers" WHERE UserName = $1'
const result = prepareSql(sql)
expect(result).toBe(
'SELECT COUNT(*) as count FROM "dbo"."BIPUsers" WHERE "UserName" = $1'
)
expect(result).toBe('SELECT COUNT(*) as count FROM "dbo"."BIPUsers" WHERE "UserName" = $1')
})
it('should quote underscore-containing column names', () => {
const sql = 'SELECT ERP_URL, ERP_Username, ERP_Password FROM "dbo"."BIPUsers"'
const result = prepareSql(sql)
expect(result).toBe(
'SELECT "ERP_URL", "ERP_Username", "ERP_Password" FROM "dbo"."BIPUsers"'
)
expect(result).toBe('SELECT "ERP_URL", "ERP_Username", "ERP_Password" FROM "dbo"."BIPUsers"')
})
it('should handle ON CONFLICT DO UPDATE SET with EXCLUDED', () => {
@@ -168,7 +164,7 @@ describe('prepareSql', () => {
})
it('should handle CURRENT_TIMESTAMP without quoting', () => {
const sql = "INSERT INTO t (OperationTime) VALUES (CURRENT_TIMESTAMP)"
const sql = 'INSERT INTO t (OperationTime) VALUES (CURRENT_TIMESTAMP)'
const result = prepareSql(sql)
expect(result).toBe('INSERT INTO "t" ("OperationTime") VALUES (CURRENT_TIMESTAMP)')
})