Skip to content

Conversation

@kuhe
Copy link
Contributor

@kuhe kuhe commented Nov 25, 2025

This adds a smithy-build config option called generateIndexTests: boolean, default false.

When set, it generates the index-types.spec and index-objects.spec files which can be run in the client script test:index only needing tsc and node.

This allows us to opt into running an API surface test when modifying things like how package components are exported, in the future updates where some exports are turned into types-only, or changes in what gets generated.

Example:

types test:

// smithy-typescript generated code
export type {
  XYZServiceClient,
  XYZService,
  GetNumbersCommand,
  TradeEventStreamCommand,
  Alpha,
  GetNumbersRequest,
  GetNumbersResponse,
  TradeEvents,
  TradeEventStreamRequest,
  TradeEventStreamResponse,
  Unit,
  XYZServiceServiceException,
} from "../dist-types/index.d";

runtime test:

import {
  GetNumbersCommand,
  TradeEventStreamCommand,
  XYZService,
  XYZServiceClient,
  XYZServiceServiceException,
} from "../dist-cjs/index.js";
import assert from "node:assert";
// clients
assert(typeof XYZServiceClient === "function");
assert(typeof XYZService === "function");
// commands
assert(typeof GetNumbersCommand === "function");
assert(typeof TradeEventStreamCommand === "function");
// errors
assert(XYZServiceServiceException.prototype instanceof Error);
console.log(`XYZService index test passed.`);

@kuhe kuhe requested a review from a team as a code owner November 25, 2025 19:47
@kuhe kuhe merged commit 716bf8e into main Nov 26, 2025
13 checks passed
@kuhe kuhe deleted the test/client-api branch November 26, 2025 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants