Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ jobs:
- name: TypeScript type check
run: npx tsc --noEmit

- name: Test TypeScript type check
run: npm run test:typecheck

commitlint:
name: Validate Commit Messages
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"clean": "rm -rf dist/",
"start": "tsx src/main.ts",
"test": "vitest run",
"test:typecheck": "tsc -p tsconfig.test.json --noEmit",
"test:integration": "vitest run --config vitest.integration.config.ts",
"test:watch": "vitest",
"test:ui": "vitest --ui",
Expand Down
27 changes: 27 additions & 0 deletions scripts/release/calver-plugin.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export interface MapCalverReleaseTypeInput {
branchName: string;
releaseType: string | null;
lastVersion: string;
nowIso?: string;
}

export interface AnalyzeCommitsContext {
branch?: { name?: string };
lastRelease?: { version?: string };
logger: { log(message: string): void };
nextRelease?: { version?: string };
}

export declare function mapCalverReleaseType(
input: MapCalverReleaseTypeInput,
): string | null;

export declare function analyzeCommits(
pluginConfig: unknown,
context: AnalyzeCommitsContext,
): Promise<string | null>;

export declare function verifyRelease(
pluginConfig: unknown,
context: AnalyzeCommitsContext,
): Promise<void>;
13 changes: 13 additions & 0 deletions scripts/release/calver.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface ComputeCalverVersionInput {
lastVersion: string;
branchName: string;
nowIso?: string;
}

export declare function computeCalverVersion(
input: ComputeCalverVersionInput,
): string;

export declare function isMonthRollover(
input: ComputeCalverVersionInput,
): boolean;
9 changes: 6 additions & 3 deletions tests/unit/services/initiative-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { type DocumentNode, type FragmentDefinitionNode, Kind } from "graphql";
import { describe, expect, it, vi } from "vitest";
import type { GraphQLClient } from "../../../src/client/graphql-client.js";
import { GetInitiativeDocument } from "../../../src/gql/graphql.js";
import {
GetInitiativeDocument,
PaginationOrderBy,
} from "../../../src/gql/graphql.js";
import {
archiveInitiative,
createInitiative,
Expand Down Expand Up @@ -72,15 +75,15 @@ describe("listInitiatives", () => {
after: "cursor-1",
includeArchived: true,
filter: { name: { eqIgnoreCase: "Growth" } },
orderBy: { createdAt: "Asc" },
orderBy: PaginationOrderBy.CreatedAt,
});

expect(client.request).toHaveBeenCalledWith(expect.anything(), {
first: 10,
after: "cursor-1",
includeArchived: true,
filter: { name: { eqIgnoreCase: "Growth" } },
orderBy: { createdAt: "Asc" },
orderBy: PaginationOrderBy.CreatedAt,
sort: undefined,
});
});
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/services/issue-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ describe("getIssueByIdentifierWithComments", () => {
});
const result = await getIssueByIdentifierWithComments(client, "ENG", 42);

expect(result.comments.nodes[0].user.displayName).toBe("Ada");
expect(result.comments.nodes).toHaveLength(1);
expect(result.comments.nodes[0]?.user?.displayName).toBe("Ada");
expect(client.request).toHaveBeenCalledWith(
GetIssueByIdentifierWithCommentsDocument,
{
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
"exclude": [
"node_modules",
"dist",
// Tests excluded from TypeScript compilation to prevent them from
// being compiled into dist/. Tests are type-checked and validated
// by Vitest at runtime, which provides sufficient type safety.
// Tests are excluded from the production build config because
// tsconfig.test.json handles test-only type-checking with no emit.
"tests",
"**/*.test.ts",
"**/*.spec.ts",
Expand Down
16 changes: 16 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"noEmit": true,
"types": ["node", "vitest/globals"]
},
"include": [
"src/**/*",
"tests/**/*",
"vitest.base.config.ts",
"vitest.config.ts",
"vitest.integration.config.ts"
],
"exclude": ["node_modules", "dist"]
}