test: name contract vitest projects

This commit is contained in:
Peter Steinberger
2026-04-23 21:49:38 +01:00
parent e1f5494636
commit 11e95a49d0
7 changed files with 58 additions and 5 deletions

View File

@@ -6,6 +6,11 @@ import bundledConfig from "./vitest/vitest.bundled.config.ts";
import { createCommandsLightVitestConfig } from "./vitest/vitest.commands-light.config.ts";
import { createCommandsVitestConfig } from "./vitest/vitest.commands.config.ts";
import baseConfig, { rootVitestProjects } from "./vitest/vitest.config.ts";
import contractChannelConfigConfig from "./vitest/vitest.contracts-channel-config.config.ts";
import contractChannelRegistryConfig from "./vitest/vitest.contracts-channel-registry.config.ts";
import contractChannelSessionConfig from "./vitest/vitest.contracts-channel-session.config.ts";
import contractChannelSurfaceConfig from "./vitest/vitest.contracts-channel-surface.config.ts";
import contractPluginConfig from "./vitest/vitest.contracts-plugin.config.ts";
import {
createContractsVitestConfig,
pluginContractPatterns,
@@ -87,6 +92,22 @@ describe("projects vitest config", () => {
expect(normalizeConfigPath(config.test.runner)).toBe("test/non-isolated-runner.ts");
});
it("gives contract project configs unique names", () => {
expect([
contractChannelSurfaceConfig.test?.name,
contractChannelConfigConfig.test?.name,
contractChannelRegistryConfig.test?.name,
contractChannelSessionConfig.test?.name,
contractPluginConfig.test?.name,
]).toEqual([
"contracts-channel-surface",
"contracts-channel-config",
"contracts-channel-registry",
"contracts-channel-session",
"contracts-plugin",
]);
});
it("narrows the contracts lane to targeted contract files", () => {
const config = createContractsVitestConfig(pluginContractPatterns, {}, [
"node",

View File

@@ -3,4 +3,11 @@ import {
createContractsVitestConfig,
} from "./vitest.contracts-shared.ts";
export default createContractsVitestConfig(channelConfigContractPatterns);
export default createContractsVitestConfig(
channelConfigContractPatterns,
process.env,
process.argv,
{
name: "contracts-channel-config",
},
);

View File

@@ -3,4 +3,11 @@ import {
createContractsVitestConfig,
} from "./vitest.contracts-shared.ts";
export default createContractsVitestConfig(channelRegistryContractPatterns);
export default createContractsVitestConfig(
channelRegistryContractPatterns,
process.env,
process.argv,
{
name: "contracts-channel-registry",
},
);

View File

@@ -3,4 +3,11 @@ import {
createContractsVitestConfig,
} from "./vitest.contracts-shared.ts";
export default createContractsVitestConfig(channelSessionContractPatterns);
export default createContractsVitestConfig(
channelSessionContractPatterns,
process.env,
process.argv,
{
name: "contracts-channel-session",
},
);

View File

@@ -3,4 +3,11 @@ import {
createContractsVitestConfig,
} from "./vitest.contracts-shared.ts";
export default createContractsVitestConfig(channelSurfaceContractPatterns);
export default createContractsVitestConfig(
channelSurfaceContractPatterns,
process.env,
process.argv,
{
name: "contracts-channel-surface",
},
);

View File

@@ -1,3 +1,5 @@
import { createContractsVitestConfig, pluginContractPatterns } from "./vitest.contracts-shared.ts";
export default createContractsVitestConfig(pluginContractPatterns);
export default createContractsVitestConfig(pluginContractPatterns, process.env, process.argv, {
name: "contracts-plugin",
});

View File

@@ -70,6 +70,7 @@ export function createContractsVitestConfig(
includePatterns: string[],
env: Record<string, string | undefined> = process.env,
argv: string[] = process.argv,
options: { name?: string } = {},
) {
const cliIncludePatterns = narrowIncludePatternsForCli(includePatterns, argv);
const envIncludePatterns = narrowContractIncludePatterns(
@@ -80,6 +81,7 @@ export function createContractsVitestConfig(
...base,
test: {
...baseTest,
name: options.name ?? "contracts",
isolate: false,
// Contract shards intentionally run non-isolated and load broad registries.
// Use forks so full-suite parallel runs do not hit worker-thread heap limits.