fix: resolve workspace source dependencies in tests

This commit is contained in:
Armin Ronacher 2026-09-01 17:50:33 +02:00
parent c30cda1d43
commit 6ee906d3d2
5 changed files with 18 additions and 10 deletions

View file

@ -2,6 +2,11 @@ import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
export const workspaceSourcePaths = {
chordIndex: fileURLToPath(new URL("./packages/chord/src/index.ts", import.meta.url)),
chordContext: fileURLToPath(new URL("./packages/chord/src/context/index.ts", import.meta.url)),
chordDelta: fileURLToPath(new URL("./packages/chord/src/delta/index.ts", import.meta.url)),
chordBundler: fileURLToPath(new URL("./packages/chord/src/bundler.ts", import.meta.url)),
chordNode: fileURLToPath(new URL("./packages/chord/src/node.ts", import.meta.url)),
telemetryIndex: fileURLToPath(new URL("./packages/telemetry/src/index.ts", import.meta.url)),
telemetryTesting: fileURLToPath(new URL("./packages/telemetry/src/testing/index.ts", import.meta.url)),
aiIndex: fileURLToPath(new URL("./packages/ai/src/index.ts", import.meta.url)),
@ -21,8 +26,12 @@ export const workspaceSourcePaths = {
export default defineConfig({
resolve: {
conditions: ["source"],
alias: [
{ find: /^@earendil-works\/chord$/, replacement: workspaceSourcePaths.chordIndex },
{ find: /^@earendil-works\/chord\/context$/, replacement: workspaceSourcePaths.chordContext },
{ find: /^@earendil-works\/chord\/delta$/, replacement: workspaceSourcePaths.chordDelta },
{ find: /^@earendil-works\/chord\/bundler$/, replacement: workspaceSourcePaths.chordBundler },
{ find: /^@earendil-works\/chord\/node$/, replacement: workspaceSourcePaths.chordNode },
{ find: /^@earendil-works\/pi-telemetry$/, replacement: workspaceSourcePaths.telemetryIndex },
{ find: /^@earendil-works\/pi-telemetry\/testing$/, replacement: workspaceSourcePaths.telemetryTesting },
{ find: /^@earendil-works\/pi-ai$/, replacement: workspaceSourcePaths.aiIndex },
@ -42,5 +51,4 @@ export default defineConfig({
{ find: /^@earendil-works\/pi-tui$/, replacement: workspaceSourcePaths.tuiIndex },
],
},
ssr: { resolve: { conditions: ["source"] } },
});