mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-08 11:33:48 +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:
@@ -71,19 +71,17 @@ describe("AllianceBehavior.handleAllianceRequests", () => {
|
||||
}
|
||||
});
|
||||
|
||||
jest.spyOn(player, "alliances").mockReturnValue(new Array(alliancesCount));
|
||||
vi.spyOn(player, "alliances").mockReturnValue(new Array(alliancesCount));
|
||||
|
||||
const mockRequest = {
|
||||
requestor: () => requestor,
|
||||
recipient: () => player,
|
||||
createdAt: () => 0 as unknown as Tick,
|
||||
accept: jest.fn(),
|
||||
reject: jest.fn(),
|
||||
accept: vi.fn(),
|
||||
reject: vi.fn(),
|
||||
} as unknown as AllianceRequest;
|
||||
|
||||
jest
|
||||
.spyOn(player, "incomingAllianceRequests")
|
||||
.mockReturnValue([mockRequest]);
|
||||
vi.spyOn(player, "incomingAllianceRequests").mockReturnValue([mockRequest]);
|
||||
|
||||
return mockRequest;
|
||||
}
|
||||
@@ -145,19 +143,19 @@ describe("AllianceBehavior.handleAllianceExtensionRequests", () => {
|
||||
let allianceBehavior: NationAllianceBehavior;
|
||||
|
||||
beforeEach(() => {
|
||||
mockGame = { addExecution: jest.fn() };
|
||||
mockHuman = { id: jest.fn(() => "human_id") };
|
||||
mockGame = { addExecution: vi.fn() };
|
||||
mockHuman = { id: vi.fn(() => "human_id") };
|
||||
mockAlliance = {
|
||||
onlyOneAgreedToExtend: jest.fn(() => true),
|
||||
other: jest.fn(() => mockHuman),
|
||||
onlyOneAgreedToExtend: vi.fn(() => true),
|
||||
other: vi.fn(() => mockHuman),
|
||||
};
|
||||
mockRandom = { chance: jest.fn() };
|
||||
mockRandom = { chance: vi.fn() };
|
||||
|
||||
mockPlayer = {
|
||||
alliances: jest.fn(() => [mockAlliance]),
|
||||
relation: jest.fn(),
|
||||
id: jest.fn(() => "bot_id"),
|
||||
type: jest.fn(() => PlayerType.Nation),
|
||||
alliances: vi.fn(() => [mockAlliance]),
|
||||
relation: vi.fn(),
|
||||
id: vi.fn(() => "bot_id"),
|
||||
type: vi.fn(() => PlayerType.Nation),
|
||||
};
|
||||
|
||||
allianceBehavior = new NationAllianceBehavior(
|
||||
|
||||
Reference in New Issue
Block a user