fix: resolve test failures after shared packages migration

Changes:
- Move subprocess-manager tests to @automaker/platform package
  - Tests need to be co-located with source for proper mocking
  - Add vitest configuration to platform package
  - 17/17 platform tests pass

- Update server vitest.config.ts to alias @automaker/* packages
  - Resolve to source files for proper mocking in tests
  - Enables vi.mock() and vi.spyOn() to work correctly

- Fix security.test.ts imports
  - Update dynamic imports from @/lib/security.js to @automaker/platform
  - Module was moved to shared package

- Rewrite prompt-builder.test.ts
  - Use fs/promises mock instead of trying to spy on internal calls
  - 10/10 tests pass

Test Results:
 Server: 536/536 tests pass
 Platform: 17/17 tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Kacper
2025-12-20 00:59:53 +01:00
parent 4afa73521d
commit 57588bfc20
7 changed files with 872 additions and 1053 deletions

View File

@@ -16,7 +16,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -31,7 +31,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -45,7 +45,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "/data/dir";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -58,7 +58,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "/data";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -72,7 +72,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -87,7 +87,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, addAllowedPath, getAllowedPaths } =
await import("@/lib/security.js");
await import("@automaker/platform");
initAllowedPaths();
addAllowedPath("/new/path");
@@ -101,7 +101,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, addAllowedPath, getAllowedPaths } =
await import("@/lib/security.js");
await import("@automaker/platform");
initAllowedPaths();
addAllowedPath("./relative/path");
@@ -118,7 +118,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, isPathAllowed } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -137,7 +137,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, validatePath } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -150,7 +150,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, validatePath } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -167,7 +167,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, validatePath } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -182,7 +182,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "/data";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();
@@ -196,7 +196,7 @@ describe("security.ts", () => {
process.env.DATA_DIR = "";
const { initAllowedPaths, getAllowedPaths } = await import(
"@/lib/security.js"
"@automaker/platform"
);
initAllowedPaths();