Dev & Debug Tools - Incomplete-Infinity/eve-companion GitHub Wiki
๐งช Dev & Debug Tools
This page outlines the tools and practices used to support development, logging, debugging, testing, and code quality in the EVE Companion App.
๐ Logging and Diagnostics
electron-log
We use electron-log
to write debug and error messages to disk. This works in both the main and renderer processes.
import log from 'electron-log';
log.info('App started');
log.error('Something went wrong');
Log files are saved in platform-specific user directories (e.g., ~\AppData\Roaming\...
on Windows).
electron-store
electron-store
is used for persistent local config:
import Store from 'electron-store';
const store = new Store();
store.set('auth.token', 'abc123');
const token = store.get('auth.token');
Values are serialized to JSON and automatically persisted.
๐ง Optional Testing Stack
Vitest
We optionally include Vitest for unit testing with fast in-memory execution. It supports modern syntax and works well with Vite + Webpack.
import { describe, it, expect } from 'vitest';
describe('Math test', () => {
it('adds numbers', () => {
expect(1 + 2).toBe(3);
});
});
Mocha (legacy Electron tests)
For Electron-specific tests (e.g., main process lifecycle or IPC), we optionally use mocha
in environments that support it.
๐๏ธ Linting and Formatting
ESLint
We recommend using ESLint with a config like:
npm install eslint eslint-plugin-import --save-dev
Create .eslintrc
:
{
"env": { "browser": true, "node": true },
"extends": ["eslint:recommended"],
"plugins": ["import"],
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "single"]
}
}
Prettier (Optional)
For consistent formatting, Prettier may be used either standalone or alongside ESLint.
๐ Dev Tips
- Enable verbose logs with
log.transports.console.level = 'debug'
- Use
electron-store
to persist per-user preferences, tokens, and recent state - Keep testable logic separate from UI for easier unit testing
๐ Summary
Tool | Purpose |
---|---|
electron-log |
Cross-process file-based logging |
electron-store |
Persistent key-value config |
vitest |
Fast unit tests (optional) |
mocha |
Electron-compatible test runner |
eslint |
Code quality checks |
prettier |
Formatting consistency (optional) |
Next: Project Structure