with one click
fix-test
Fix Test compilation errors
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Fix Test compilation errors
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | fix-test |
| description | Fix Test compilation errors |
| allowed-tools | Read, Edit, Write, Bash, Grep, Glob |
Fix test file compilation errors according to code conventions.
NEVER use:
as keyword (type assertion)any typetypia.random<EmptyType>() - generates invalid dataFix compilation errors in test files to ensure npm run build:test passes.
┌─────────────────────────────────────┐
│ Step 1: Run Build │
│ npm run build:test │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 2: Parse Test Errors │
│ - Empty prepare functions │
│ - Type mismatches │
│ - Missing imports │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 3: Fix by Convention │
│ - Fill prepare functions │
│ - Create generate functions │
│ - Fix import paths │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 4: Re-run Build │
│ Loop until 0 errors │
└─────────────────────────────────────┘
npm run build:test 2>&1 | head -100
Capture test-related errors.
# Find empty returns
grep -rn "return {}" test/prepare/ --include="*.ts"
# Find typia.random with potentially empty types
grep -rn "typia.random<" test/ --include="*.ts"
// Before
export function prepare_random_{prefix}_{entity}(
input?: DeepPartial<I{Prefix}{Entity}.ICreate> | undefined,
): I{Prefix}{Entity}.ICreate {
return {}; // WRONG
}
// After
import { I{Prefix}{Entity} } from "@ORGANIZATION/PROJECT-api/lib/structures/I{Prefix}{Entity}";
import { DeepPartial } from "@ORGANIZATION/PROJECT-api/lib/typings/DeepPartial";
import { RandomGenerator } from "@nestia/e2e";
import { randint } from "tstl";
import { v4 } from "uuid";
export function prepare_random_{prefix}_{entity}(
input?: DeepPartial<I{Prefix}{Entity}.ICreate> | undefined,
): I{Prefix}{Entity}.ICreate {
return {
parent_id: input?.parent_id ?? v4(),
name: input?.name ?? RandomGenerator.name(2),
title: input?.title ?? RandomGenerator.paragraph(1),
content: input?.content ?? RandomGenerator.paragraph(3),
is_public: input?.is_public ?? true,
status: input?.status ?? "active",
};
}
import { I{Prefix}{Entity} } from "@ORGANIZATION/PROJECT-api/lib/structures/I{Prefix}{Entity}";
import { DeepPartial } from "@ORGANIZATION/PROJECT-api/lib/typings/DeepPartial";
import api from "@ORGANIZATION/PROJECT-api";
import { prepare_random_{prefix}_{entity} } from "../prepare/prepare_random_{prefix}_{entity}";
export async function generate_random_{prefix}_{entity}(
connection: api.IConnection,
input?: DeepPartial<I{Prefix}{Entity}.ICreate> | undefined,
): Promise<I{Prefix}{Entity}> {
const body = prepare_random_{prefix}_{entity}(input);
return api.functional.{prefix}.{path}.create(connection, body);
}
| Field Type | Generation Pattern |
|---|---|
| UUID | v4() |
| Name/Title | RandomGenerator.name(2) |
| Paragraph | RandomGenerator.paragraph(1) |
`${RandomGenerator.string(8)}@example.com` | |
| URL | `https://example.com/${RandomGenerator.string(10)}` |
| Integer | randint(min, max) |
| Boolean | Math.random() > 0.5 |
| Date (ISO) | new Date().toISOString() |
| Union Type | (["val1", "val2"] as const)[randint(0, 1)] |
// Before
const data = typia.random<I{Prefix}{Entity}.ICreate>();
// After
import { prepare_random_{prefix}_{entity} } from "../prepare/prepare_random_{prefix}_{entity}";
const data = prepare_random_{prefix}_{entity}({
status: "active", // Can override specific values
});
npm run build:test
Repeat Steps 2-4 until no test build errors.
| Error Pattern | Fix |
|---|---|
Empty return {} | Fill with proper random generators |
typia.random<EmptyType> | Use prepare_random function |
| Missing generate function | Create matching generate_random |
| Import error | Fix import path |
npm run build:test completes with no errorstypia.random with empty typesImplement new feature with self-testing loop until 100% pass
Fix Prisma schema compilation errors
Fix Interface and Controller compilation errors
Fix Provider, Collector, Transformer compilation errors
Validate Prisma schema against requirements specification (read-only)
Validate Controllers and DTOs against requirements (read-only)