@ronkovic/aad 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/modules/git-workspace/__tests__/dependency-installer.test.ts +22 -0
- package/src/modules/git-workspace/dependency-installer.ts +5 -2
- package/src/modules/task-execution/__tests__/tester-verify.test.ts +40 -40
- package/src/modules/task-execution/index.ts +1 -1
- package/src/modules/task-execution/phases/tester-verify.ts +1 -74
package/package.json
CHANGED
|
@@ -94,3 +94,25 @@ describe("resolveAvailableCommand", () => {
|
|
|
94
94
|
expect(result).toBe("npx");
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
|
+
|
|
98
|
+
describe("installDependencies integration", () => {
|
|
99
|
+
test("integrates with resolveAvailableCommand", async () => {
|
|
100
|
+
// This test verifies that installDependencies calls resolveAvailableCommand
|
|
101
|
+
// Actual fallback behavior is tested in resolveAvailableCommand tests above
|
|
102
|
+
const { buildInstallCommand } = await import("../dependency-installer");
|
|
103
|
+
|
|
104
|
+
const workspace: WorkspaceInfo = {
|
|
105
|
+
path: "/tmp/test",
|
|
106
|
+
language: "javascript",
|
|
107
|
+
packageManager: "yarn",
|
|
108
|
+
framework: "react",
|
|
109
|
+
testFramework: "jest",
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const command = buildInstallCommand(workspace);
|
|
113
|
+
expect(command).toEqual(["yarn", "install", "--frozen-lockfile"]);
|
|
114
|
+
|
|
115
|
+
// The actual fallback is applied at runtime in installDependencies
|
|
116
|
+
// when yarn is not available in PATH, resolveAvailableCommand returns "npx"
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -76,11 +76,14 @@ export async function installDependencies(
|
|
|
76
76
|
return { success: true, output: "", duration: 0, skipped: true };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const [
|
|
79
|
+
const [rawCmd, ...args] = command;
|
|
80
|
+
|
|
81
|
+
// Resolve command with fallback (e.g., yarn → npx if yarn not found)
|
|
82
|
+
const cmd = await resolveAvailableCommand(rawCmd!);
|
|
80
83
|
logger.info({ cmd, args, cwd: workspace.path }, "Installing dependencies");
|
|
81
84
|
|
|
82
85
|
// Bun.spawn で実行(default-spawner.ts と同パターン)
|
|
83
|
-
const proc = Bun.spawn([cmd
|
|
86
|
+
const proc = Bun.spawn([cmd, ...args], {
|
|
84
87
|
cwd: workspace.path,
|
|
85
88
|
stdout: "pipe",
|
|
86
89
|
stderr: "pipe",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { describe, test, expect } from "bun:test";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
buildTestCommandWithFallback,
|
|
4
4
|
runTests,
|
|
5
5
|
type ProcessSpawner,
|
|
6
6
|
} from "../phases/tester-verify";
|
|
7
7
|
import type { WorkspaceInfo } from "@aad/shared/types";
|
|
8
8
|
|
|
9
|
-
describe("
|
|
10
|
-
test("builds bun test command", () => {
|
|
9
|
+
describe("buildTestCommandWithFallback", () => {
|
|
10
|
+
test("builds bun test command", async () => {
|
|
11
11
|
const workspace: WorkspaceInfo = {
|
|
12
12
|
path: "/path/to/workspace",
|
|
13
13
|
language: "typescript",
|
|
@@ -16,10 +16,10 @@ describe("buildTestCommand", () => {
|
|
|
16
16
|
testFramework: "bun-test",
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
expect(
|
|
19
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["bun", "test"]);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
test("builds vitest command", () => {
|
|
22
|
+
test("builds vitest command", async () => {
|
|
23
23
|
const workspace: WorkspaceInfo = {
|
|
24
24
|
path: "/path/to/workspace",
|
|
25
25
|
language: "typescript",
|
|
@@ -28,10 +28,10 @@ describe("buildTestCommand", () => {
|
|
|
28
28
|
testFramework: "vitest",
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
expect(
|
|
31
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npm", "run", "test"]);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
test("builds jest command", () => {
|
|
34
|
+
test("builds jest command", async () => {
|
|
35
35
|
const workspace: WorkspaceInfo = {
|
|
36
36
|
path: "/path/to/workspace",
|
|
37
37
|
language: "javascript",
|
|
@@ -40,10 +40,10 @@ describe("buildTestCommand", () => {
|
|
|
40
40
|
testFramework: "jest",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
expect(
|
|
43
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["yarn", "test"]);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
test("builds pytest command", () => {
|
|
46
|
+
test("builds pytest command", async () => {
|
|
47
47
|
const workspace: WorkspaceInfo = {
|
|
48
48
|
path: "/path/to/workspace",
|
|
49
49
|
language: "python",
|
|
@@ -52,10 +52,10 @@ describe("buildTestCommand", () => {
|
|
|
52
52
|
testFramework: "pytest",
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
expect(
|
|
55
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["pytest", "-v"]);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
test("builds go test command", () => {
|
|
58
|
+
test("builds go test command", async () => {
|
|
59
59
|
const workspace: WorkspaceInfo = {
|
|
60
60
|
path: "/path/to/workspace",
|
|
61
61
|
language: "go",
|
|
@@ -64,10 +64,10 @@ describe("buildTestCommand", () => {
|
|
|
64
64
|
testFramework: "go-test",
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
expect(
|
|
67
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["go", "test", "./..."]);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
test("builds cargo test command", () => {
|
|
70
|
+
test("builds cargo test command", async () => {
|
|
71
71
|
const workspace: WorkspaceInfo = {
|
|
72
72
|
path: "/path/to/workspace",
|
|
73
73
|
language: "rust",
|
|
@@ -76,10 +76,10 @@ describe("buildTestCommand", () => {
|
|
|
76
76
|
testFramework: "cargo",
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
expect(
|
|
79
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["cargo", "test"]);
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
test("builds vitest command with yarn", () => {
|
|
82
|
+
test("builds vitest command with yarn", async () => {
|
|
83
83
|
const workspace: WorkspaceInfo = {
|
|
84
84
|
path: "/path",
|
|
85
85
|
language: "typescript",
|
|
@@ -87,10 +87,10 @@ describe("buildTestCommand", () => {
|
|
|
87
87
|
framework: "vite",
|
|
88
88
|
testFramework: "vitest",
|
|
89
89
|
};
|
|
90
|
-
expect(
|
|
90
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["yarn", "test"]);
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
test("builds vitest command with pnpm", () => {
|
|
93
|
+
test("builds vitest command with pnpm", async () => {
|
|
94
94
|
const workspace: WorkspaceInfo = {
|
|
95
95
|
path: "/path",
|
|
96
96
|
language: "typescript",
|
|
@@ -98,10 +98,10 @@ describe("buildTestCommand", () => {
|
|
|
98
98
|
framework: "vite",
|
|
99
99
|
testFramework: "vitest",
|
|
100
100
|
};
|
|
101
|
-
expect(
|
|
101
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["pnpm", "test"]);
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
test("builds vitest command with default (npx)", () => {
|
|
104
|
+
test("builds vitest command with default (npx)", async () => {
|
|
105
105
|
const workspace: WorkspaceInfo = {
|
|
106
106
|
path: "/path",
|
|
107
107
|
language: "typescript",
|
|
@@ -109,10 +109,10 @@ describe("buildTestCommand", () => {
|
|
|
109
109
|
framework: "vite",
|
|
110
110
|
testFramework: "vitest",
|
|
111
111
|
};
|
|
112
|
-
expect(
|
|
112
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npx", "vitest", "run"]);
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
test("builds jest command with npm", () => {
|
|
115
|
+
test("builds jest command with npm", async () => {
|
|
116
116
|
const workspace: WorkspaceInfo = {
|
|
117
117
|
path: "/path",
|
|
118
118
|
language: "javascript",
|
|
@@ -120,10 +120,10 @@ describe("buildTestCommand", () => {
|
|
|
120
120
|
framework: "react",
|
|
121
121
|
testFramework: "jest",
|
|
122
122
|
};
|
|
123
|
-
expect(
|
|
123
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npm", "test"]);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
test("builds jest command with pnpm", () => {
|
|
126
|
+
test("builds jest command with pnpm", async () => {
|
|
127
127
|
const workspace: WorkspaceInfo = {
|
|
128
128
|
path: "/path",
|
|
129
129
|
language: "javascript",
|
|
@@ -131,10 +131,10 @@ describe("buildTestCommand", () => {
|
|
|
131
131
|
framework: "react",
|
|
132
132
|
testFramework: "jest",
|
|
133
133
|
};
|
|
134
|
-
expect(
|
|
134
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["pnpm", "test"]);
|
|
135
135
|
});
|
|
136
136
|
|
|
137
|
-
test("builds jest command with default (npx)", () => {
|
|
137
|
+
test("builds jest command with default (npx)", async () => {
|
|
138
138
|
const workspace: WorkspaceInfo = {
|
|
139
139
|
path: "/path",
|
|
140
140
|
language: "javascript",
|
|
@@ -142,10 +142,10 @@ describe("buildTestCommand", () => {
|
|
|
142
142
|
framework: "react",
|
|
143
143
|
testFramework: "jest",
|
|
144
144
|
};
|
|
145
|
-
expect(
|
|
145
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npx", "jest"]);
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
test("builds mocha command with npm", () => {
|
|
148
|
+
test("builds mocha command with npm", async () => {
|
|
149
149
|
const workspace: WorkspaceInfo = {
|
|
150
150
|
path: "/path",
|
|
151
151
|
language: "javascript",
|
|
@@ -153,10 +153,10 @@ describe("buildTestCommand", () => {
|
|
|
153
153
|
framework: "express",
|
|
154
154
|
testFramework: "mocha",
|
|
155
155
|
};
|
|
156
|
-
expect(
|
|
156
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npm", "test"]);
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
test("builds mocha command with yarn", () => {
|
|
159
|
+
test("builds mocha command with yarn", async () => {
|
|
160
160
|
const workspace: WorkspaceInfo = {
|
|
161
161
|
path: "/path",
|
|
162
162
|
language: "javascript",
|
|
@@ -164,10 +164,10 @@ describe("buildTestCommand", () => {
|
|
|
164
164
|
framework: "express",
|
|
165
165
|
testFramework: "mocha",
|
|
166
166
|
};
|
|
167
|
-
expect(
|
|
167
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["yarn", "test"]);
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
-
test("builds mocha command with default (npx)", () => {
|
|
170
|
+
test("builds mocha command with default (npx)", async () => {
|
|
171
171
|
const workspace: WorkspaceInfo = {
|
|
172
172
|
path: "/path",
|
|
173
173
|
language: "javascript",
|
|
@@ -175,10 +175,10 @@ describe("buildTestCommand", () => {
|
|
|
175
175
|
framework: "express",
|
|
176
176
|
testFramework: "mocha",
|
|
177
177
|
};
|
|
178
|
-
expect(
|
|
178
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npx", "mocha"]);
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
test("builds maven test command", () => {
|
|
181
|
+
test("builds maven test command", async () => {
|
|
182
182
|
const workspace: WorkspaceInfo = {
|
|
183
183
|
path: "/path",
|
|
184
184
|
language: "java",
|
|
@@ -186,10 +186,10 @@ describe("buildTestCommand", () => {
|
|
|
186
186
|
framework: "spring",
|
|
187
187
|
testFramework: "maven",
|
|
188
188
|
};
|
|
189
|
-
expect(
|
|
189
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["mvn", "test"]);
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
test("builds gradle test command", () => {
|
|
192
|
+
test("builds gradle test command", async () => {
|
|
193
193
|
const workspace: WorkspaceInfo = {
|
|
194
194
|
path: "/path",
|
|
195
195
|
language: "java",
|
|
@@ -197,10 +197,10 @@ describe("buildTestCommand", () => {
|
|
|
197
197
|
framework: "spring",
|
|
198
198
|
testFramework: "gradle",
|
|
199
199
|
};
|
|
200
|
-
expect(
|
|
200
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["./gradlew", "test"]);
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
test("returns fallback for unknown test framework", () => {
|
|
203
|
+
test("returns fallback for unknown test framework", async () => {
|
|
204
204
|
const workspace: WorkspaceInfo = {
|
|
205
205
|
path: "/path/to/workspace",
|
|
206
206
|
language: "unknown",
|
|
@@ -210,7 +210,7 @@ describe("buildTestCommand", () => {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
// After fallback implementation, unknown should return npm test
|
|
213
|
-
expect(
|
|
213
|
+
expect(await buildTestCommandWithFallback(workspace)).toEqual(["npm", "test"]);
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
test("builds vitest with fallback when yarn is unavailable", async () => {
|
|
@@ -230,7 +230,7 @@ describe("buildTestCommand", () => {
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
try {
|
|
233
|
-
const result = await
|
|
233
|
+
const result = await buildTestCommandWithFallback(workspace);
|
|
234
234
|
expect(result).toEqual(["npx", "yarn", "test"]);
|
|
235
235
|
} finally {
|
|
236
236
|
Bun.which = originalWhich;
|
|
@@ -253,7 +253,7 @@ describe("buildTestCommand", () => {
|
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
try {
|
|
256
|
-
const result = await
|
|
256
|
+
const result = await buildTestCommandWithFallback(workspace);
|
|
257
257
|
expect(result).toEqual(["npx", "pnpm", "test"]);
|
|
258
258
|
} finally {
|
|
259
259
|
Bun.which = originalWhich;
|
|
@@ -14,7 +14,7 @@ export {
|
|
|
14
14
|
} from "./phases/implementer-green";
|
|
15
15
|
export type { ImplementerGreenOptions } from "./phases/implementer-green";
|
|
16
16
|
|
|
17
|
-
export { runTests,
|
|
17
|
+
export { runTests, buildTestCommandWithFallback } from "./phases/tester-verify";
|
|
18
18
|
export type {
|
|
19
19
|
TestResult,
|
|
20
20
|
ProcessSpawner,
|
|
@@ -111,79 +111,6 @@ export async function buildTestCommandWithFallback(workspace: WorkspaceInfo): Pr
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* Build test command based on detected test framework
|
|
116
|
-
*/
|
|
117
|
-
export function buildTestCommand(workspace: WorkspaceInfo): string[] {
|
|
118
|
-
const { testFramework, packageManager } = workspace;
|
|
119
|
-
|
|
120
|
-
switch (testFramework) {
|
|
121
|
-
case "bun-test":
|
|
122
|
-
return ["bun", "test"];
|
|
123
|
-
|
|
124
|
-
case "vitest":
|
|
125
|
-
if (packageManager === "npm") return ["npm", "run", "test"];
|
|
126
|
-
if (packageManager === "yarn") return ["yarn", "test"];
|
|
127
|
-
if (packageManager === "pnpm") return ["pnpm", "test"];
|
|
128
|
-
return ["npx", "vitest", "run"];
|
|
129
|
-
|
|
130
|
-
case "jest":
|
|
131
|
-
if (packageManager === "npm") return ["npm", "test"];
|
|
132
|
-
if (packageManager === "yarn") return ["yarn", "test"];
|
|
133
|
-
if (packageManager === "pnpm") return ["pnpm", "test"];
|
|
134
|
-
return ["npx", "jest"];
|
|
135
|
-
|
|
136
|
-
case "mocha":
|
|
137
|
-
if (packageManager === "npm") return ["npm", "test"];
|
|
138
|
-
if (packageManager === "yarn") return ["yarn", "test"];
|
|
139
|
-
return ["npx", "mocha"];
|
|
140
|
-
|
|
141
|
-
case "pytest": {
|
|
142
|
-
const { packageManager } = workspace;
|
|
143
|
-
if (packageManager === "uv") return ["uv", "run", "pytest", "-v"];
|
|
144
|
-
if (packageManager === "poetry") return ["poetry", "run", "pytest", "-v"];
|
|
145
|
-
return ["pytest", "-v"];
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
case "go-test":
|
|
149
|
-
return ["go", "test", "./..."];
|
|
150
|
-
|
|
151
|
-
case "cargo":
|
|
152
|
-
return ["cargo", "test"];
|
|
153
|
-
|
|
154
|
-
case "maven":
|
|
155
|
-
return ["mvn", "test"];
|
|
156
|
-
|
|
157
|
-
case "gradle":
|
|
158
|
-
return ["./gradlew", "test"];
|
|
159
|
-
|
|
160
|
-
case "playwright":
|
|
161
|
-
return ["npx", "playwright", "test"];
|
|
162
|
-
|
|
163
|
-
case "terraform":
|
|
164
|
-
return ["terraform", "validate"];
|
|
165
|
-
|
|
166
|
-
case "unknown": {
|
|
167
|
-
// Fallback: use package manager-based test command
|
|
168
|
-
const { packageManager } = workspace;
|
|
169
|
-
if (packageManager === "bun") return ["bun", "test"];
|
|
170
|
-
if (packageManager === "npm") return ["npm", "test"];
|
|
171
|
-
if (packageManager === "yarn") return ["yarn", "test"];
|
|
172
|
-
if (packageManager === "pnpm") return ["pnpm", "test"];
|
|
173
|
-
if (packageManager === "uv") return ["uv", "run", "pytest", "-v"];
|
|
174
|
-
if (packageManager === "poetry") return ["poetry", "run", "pytest", "-v"];
|
|
175
|
-
return ["npm", "test"];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
default: {
|
|
179
|
-
const exhaustive: never = testFramework;
|
|
180
|
-
throw new TestRunnerError(
|
|
181
|
-
`Unsupported test framework: ${exhaustive}`,
|
|
182
|
-
{ testFramework }
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
114
|
|
|
188
115
|
/**
|
|
189
116
|
* Run tests in workspace and return result
|
|
@@ -196,7 +123,7 @@ export async function runTests(
|
|
|
196
123
|
spawner?: ProcessSpawner,
|
|
197
124
|
timeout = 300000
|
|
198
125
|
): Promise<TestResult> {
|
|
199
|
-
const command =
|
|
126
|
+
const command = await buildTestCommandWithFallback(workspace);
|
|
200
127
|
const [cmd, ...args] = command;
|
|
201
128
|
|
|
202
129
|
if (!cmd) {
|