mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-18 09:14:09 +00:00
build: migrate build system to Vite and test runner to Vitest & Remove
depracated husky usage - Replace Webpack with Vite for faster client bundling and HMR. - Migrate tests from Jest to Vitest and update configuration. - Update Web Worker instantiation to standard ESM syntax. - Implement Env utility in `src/core` for safe, hybrid environment variable access (Vite vs Node). - Refactor configuration loaders to remove direct `process.env` dependencies in shared code. - Update TypeScript environment definitions and project scripts for the new toolchain. - Remove the [depracated usage of the husky](https://github.com/typicode/husky/releases/tag/v9.0.1). build(vite): implement robust git commit resolution with fallback
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
import { AutoUpgradeEvent } from "../src/client/InputHandler";
|
||||
import { EventBus } from "../src/core/EventBus";
|
||||
|
||||
@@ -19,7 +16,7 @@ describe("AutoUpgrade Feature", () => {
|
||||
});
|
||||
|
||||
test("should emit AutoUpgradeEvent when created", () => {
|
||||
const mockEmit = jest.spyOn(eventBus, "emit");
|
||||
const mockEmit = vi.spyOn(eventBus, "emit");
|
||||
|
||||
const event = new AutoUpgradeEvent(150, 250);
|
||||
eventBus.emit(event);
|
||||
@@ -36,7 +33,7 @@ describe("AutoUpgrade Feature", () => {
|
||||
|
||||
describe("AutoUpgradeEvent Integration", () => {
|
||||
test("should handle multiple AutoUpgradeEvents", () => {
|
||||
const mockEmit = jest.spyOn(eventBus, "emit");
|
||||
const mockEmit = vi.spyOn(eventBus, "emit");
|
||||
|
||||
const event1 = new AutoUpgradeEvent(100, 200);
|
||||
const event2 = new AutoUpgradeEvent(300, 400);
|
||||
@@ -70,7 +67,7 @@ describe("AutoUpgrade Feature", () => {
|
||||
|
||||
describe("AutoUpgradeEvent Event Bus Integration", () => {
|
||||
test("should allow event listeners to subscribe to AutoUpgradeEvent", () => {
|
||||
const mockListener = jest.fn();
|
||||
const mockListener = vi.fn();
|
||||
const event = new AutoUpgradeEvent(100, 200);
|
||||
|
||||
eventBus.on(AutoUpgradeEvent, mockListener);
|
||||
@@ -80,8 +77,8 @@ describe("AutoUpgrade Feature", () => {
|
||||
});
|
||||
|
||||
test("should allow multiple listeners for AutoUpgradeEvent", () => {
|
||||
const mockListener1 = jest.fn();
|
||||
const mockListener2 = jest.fn();
|
||||
const mockListener1 = vi.fn();
|
||||
const mockListener2 = vi.fn();
|
||||
const event = new AutoUpgradeEvent(100, 200);
|
||||
|
||||
eventBus.on(AutoUpgradeEvent, mockListener1);
|
||||
@@ -93,7 +90,7 @@ describe("AutoUpgrade Feature", () => {
|
||||
});
|
||||
|
||||
test("should not call unsubscribed listeners", () => {
|
||||
const mockListener = jest.fn();
|
||||
const mockListener = vi.fn();
|
||||
const event = new AutoUpgradeEvent(100, 200);
|
||||
|
||||
eventBus.on(AutoUpgradeEvent, mockListener);
|
||||
|
||||
Reference in New Issue
Block a user