mirror of
https://github.com/cita-777/metapi.git
synced 2026-11-02 05:05:37 +08:00
feat: add run-server script to manage server execution and compatibility checks feat: create main application logic for desktop with window management, server handling, and auto-updater test: add unit tests for desktop runtime helpers feat: implement desktop server environment configuration and health check test: add tests for server configuration and desktop routes feat: add native module guard for better-sqlite3 compatibility test: add tests for native module guard functionality test: add comprehensive tests for account verification feedback handling feat: implement account verification feedback helpers chore: add TypeScript configuration for desktop builds
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
buildBetterSqliteRebuildCommand,
|
|
isNodeModuleVersionMismatch,
|
|
} from './nativeModuleGuard.js';
|
|
|
|
describe('nativeModuleGuard', () => {
|
|
it('detects better-sqlite3 ABI mismatch errors', () => {
|
|
const error = Object.assign(
|
|
new Error('NODE_MODULE_VERSION 133. This version of Node.js requires NODE_MODULE_VERSION 137.'),
|
|
{ code: 'ERR_DLOPEN_FAILED' },
|
|
);
|
|
|
|
expect(isNodeModuleVersionMismatch(error)).toBe(true);
|
|
});
|
|
|
|
it('ignores unrelated native module errors', () => {
|
|
const error = Object.assign(
|
|
new Error('Cannot find module'),
|
|
{ code: 'MODULE_NOT_FOUND' },
|
|
);
|
|
|
|
expect(isNodeModuleVersionMismatch(error)).toBe(false);
|
|
});
|
|
|
|
it('builds a rebuild command for the current npm client', () => {
|
|
const command = buildBetterSqliteRebuildCommand({
|
|
npmExecPath: '/tmp/npm-cli.js',
|
|
});
|
|
|
|
expect(command.command).toBe(process.execPath);
|
|
expect(command.args).toEqual([
|
|
'/tmp/npm-cli.js',
|
|
'rebuild',
|
|
'better-sqlite3',
|
|
'--no-audit',
|
|
'--fund=false',
|
|
]);
|
|
});
|
|
});
|