cherry-studio/tests/__mocks__/MainLoggerService.ts
Phantom 4d1d3e316f
feat: use oxlint to speed up lint (#10168)
* build: add eslint-plugin-oxlint dependency

Add new eslint plugin to enhance linting capabilities with oxlint rules

* build(eslint): add oxlint plugin to eslint config

Add oxlint plugin as recommended in the documentation to enhance linting capabilities

* build: add oxlint v1.15.0 as a dependency

* build: add oxlint to linting commands

Add oxlint alongside eslint in test:lint and lint scripts for enhanced static analysis

* build: add oxlint configuration file

Configure oxlint with a comprehensive set of rules for JavaScript/TypeScript code quality checks

* chore: update oxlint configuration and related settings

- Add oxc to editor code actions on save
- Update oxlint configs to use eslint, typescript, and unicorn presets
- Extend ignore patterns in oxlint configuration
- Simplify oxlint command in package.json scripts
- Add oxlint-tsgolint dependency

* fix: lint warning

* chore: update oxlintrc from eslint.recommended

* refactor(lint): update eslint and oxlint configurations

- Add src/preload to eslint ignore patterns
- Update oxlint env to es2022 and add environment overrides
- Adjust several lint rule severities and configurations

* fix: lint error

* fix(file): replace eslint-disable with oxlint-disable in sanitizeFilename

The linter was changed from ESLint to oxlint, so the directive needs to be updated accordingly.

* fix: enforce stricter linting by failing on warnings in test:lint script

* feat: add recommended ts-eslint rules into exlint

* docs: remove outdated comment in oxlint config file

* style: disable typescript/no-require-imports rule in oxlint config

* docs(utils): fix comment typo from NODE to NOTE

* fix(MessageErrorBoundary): correct error description display condition

The error description was incorrectly showing in production and hiding in development. Fix the logic to show detailed errors only in development mode

* chore: add oxc-vscode extension to recommended list

* ci(workflows): reorder format check step in pr-ci.yml

* chore: update yarn.lock
2025-09-15 19:42:13 +08:00

63 lines
1.5 KiB
TypeScript

/* oslint-disable @typescript-eslint/no-empty-function */
// Simple mock LoggerService class for main process
export class MockMainLoggerService {
private static instance: MockMainLoggerService
public static getInstance(): MockMainLoggerService {
if (!MockMainLoggerService.instance) {
MockMainLoggerService.instance = new MockMainLoggerService()
}
return MockMainLoggerService.instance
}
public static resetInstance(): void {
MockMainLoggerService.instance = new MockMainLoggerService()
}
public withContext(): MockMainLoggerService {
return this
}
public finish(): void {}
public setLevel(): void {}
public getLevel(): string {
return 'silly'
}
public resetLevel(): void {}
public getLogsDir(): string {
return '/mock/logs'
}
public getBaseLogger(): any {
return {}
}
public error(...args: any[]): void {
console.error(...args)
}
public warn(...args: any[]): void {
console.warn(...args)
}
public info(...args: any[]): void {
console.info(...args)
}
public verbose(...args: any[]): void {
console.log(...args)
}
public debug(...args: any[]): void {
console.debug(...args)
}
public silly(...args: any[]): void {
console.log(...args)
}
}
// Create and export the mock instance
export const mockMainLoggerService = MockMainLoggerService.getInstance()
// Mock the LoggerService module for main process
const MainLoggerServiceMock = {
LoggerService: MockMainLoggerService,
loggerService: mockMainLoggerService
}
export default MainLoggerServiceMock