Skip to content

Commit a7bb49b

Browse files
Nick Ficanoclaude
andcommitted
test: wire vitest workspace aliases so tests consume source, not dist
Adds a shared vitest.aliases.ts that maps every @arcp/* import to the package's src/ entrypoint, and references it from each package's vitest.config.ts. Lets the stdio transport integration test (and any future cross-package test) stay correct even when dist is stale or absent. Adjusts the test to pass cwd and TSX_TSCONFIG_PATH so the spawned tsx subprocess resolves the workspace tsconfig. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a59dd94 commit a7bb49b

12 files changed

Lines changed: 153 additions & 3 deletions

File tree

packages/client/vitest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { defineConfig } from "vitest/config";
22

3+
import { arcpWorkspaceAliases } from "../../vitest.aliases.js";
4+
35
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
49
test: {
510
include: ["test/**/*.test.ts"],
611
environment: "node",

packages/core/vitest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { defineConfig } from "vitest/config";
22

3+
import { arcpWorkspaceAliases } from "../../vitest.aliases.js";
4+
35
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
49
test: {
510
include: ["test/**/*.test.ts"],
611
environment: "node",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
import { arcpWorkspaceAliases } from "../../../vitest.aliases.js";
4+
5+
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
9+
test: {
10+
include: ["test/**/*.test.ts"],
11+
environment: "node",
12+
},
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
import { arcpWorkspaceAliases } from "../../../vitest.aliases.js";
4+
5+
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
9+
test: {
10+
include: ["test/**/*.test.ts"],
11+
environment: "node",
12+
},
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
import { arcpWorkspaceAliases } from "../../../vitest.aliases.js";
4+
5+
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
9+
test: {
10+
include: ["test/**/*.test.ts"],
11+
environment: "node",
12+
},
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
import { arcpWorkspaceAliases } from "../../../vitest.aliases.js";
4+
5+
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
9+
test: {
10+
include: ["test/**/*.test.ts"],
11+
environment: "node",
12+
},
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
import { arcpWorkspaceAliases } from "../../../vitest.aliases.js";
4+
5+
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
9+
test: {
10+
include: ["test/**/*.test.ts"],
11+
environment: "node",
12+
},
13+
});

packages/middleware/otel/vitest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { defineConfig } from "vitest/config";
22

3+
import { arcpWorkspaceAliases } from "../../../vitest.aliases.js";
4+
35
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
49
test: {
510
include: ["test/**/*.test.ts"],
611
environment: "node",

packages/runtime/vitest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { defineConfig } from "vitest/config";
22

3+
import { arcpWorkspaceAliases } from "../../vitest.aliases.js";
4+
35
export default defineConfig({
6+
resolve: {
7+
alias: arcpWorkspaceAliases,
8+
},
49
test: {
510
include: ["test/**/*.test.ts"],
611
environment: "node",

packages/sdk/test/integration/transports.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
} from "@arcp/sdk";
1818

1919
const here = path.dirname(fileURLToPath(import.meta.url));
20+
const sdkRoot = path.resolve(here, "..", "..");
21+
const workspaceRoot = path.resolve(sdkRoot, "..", "..");
2022

2123
interface TransportFixture {
2224
name: string;
@@ -75,9 +77,7 @@ const fixtures: TransportFixture[] = [
7577
name: "stdio",
7678
async setup() {
7779
const tsxBin = path.resolve(
78-
here,
79-
"..",
80-
"..",
80+
sdkRoot,
8181
"node_modules",
8282
".bin",
8383
"tsx",
@@ -92,6 +92,11 @@ const fixtures: TransportFixture[] = [
9292
tsxBin,
9393
[runtimeScript, ":memory:"],
9494
{
95+
cwd: sdkRoot,
96+
env: {
97+
...process.env,
98+
TSX_TSCONFIG_PATH: path.join(workspaceRoot, "tsconfig.base.json"),
99+
},
95100
stdio: ["pipe", "pipe", "pipe"],
96101
},
97102
);

0 commit comments

Comments
 (0)