Fix cultnet-ts test build for out-of-package contract location
REC-032 commit 1 follow-up, found during required verification: moving
the CultNet schemas out of packages/cultnet-ts/contracts into
CultLib/contracts/cultnet broke npm test for cultnet-ts. tsconfig.test.json
compiled with rootDir "." (to cover both src/ and test/ as siblings), and
TypeScript's resolveJsonModule copy-into-output behavior only mirrors
files that fall within the declared rootDir. The old contracts/ folder
was a sibling of src/ (inside rootDir), so it got copied into
dist-test/contracts and the "../contracts/x" import resolved. The new
contracts/cultnet is two directories above the package, outside any
possible rootDir short of the repo root, so nothing got copied and the
"../../../contracts/cultnet/x" import 404'd at runtime under dist-test
(the production "dist" build was unaffected, since dist/ and src/ sit at
the same depth under the package).
Fix: widen tsconfig.test.json's rootDir to the CultLib repo root so
resolveJsonModule can find and copy contracts/cultnet into dist-test,
update the "test"/"test:interop" npm scripts for the resulting deeper
dist-test/packages/cultnet-ts/... output path, and correct the two
__dirname-relative computations in test/interop/cultnet-interop.test.ts
and test/runtime-presence-health.test.ts that assumed the old shallower
depth.
Also fixes packages/cultmesh-ts/test/cultmesh.test.ts, which still
looked up the shard-catalog builtins by their old bare
cultnet.shard_catalog_{request,response}.v0 schemaId; CultNetSchemaCatalog
keys by $id, which D1 changed to the CultLib contracts URL, so the
lookup returned undefined.
REC-032, decision D1.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
fcc49cffa0
commit
fa00f3ffa2
5 changed files with 11 additions and 7 deletions
|
|
@ -2500,11 +2500,15 @@ test("CultMesh TS branded facade exposes schema and shard catalogs", () => {
|
||||||
|
|
||||||
const builtIns = CultMesh.createBuiltInSchemaCatalog();
|
const builtIns = CultMesh.createBuiltInSchemaCatalog();
|
||||||
assert.equal(
|
assert.equal(
|
||||||
builtIns.get("cultnet.shard_catalog_request.v0")?.schemaVersion,
|
builtIns.get(
|
||||||
|
"https://github.com/GameCult/CultLib/contracts/cultnet/cultnet.shard-catalog-request.schema.json",
|
||||||
|
)?.schemaVersion,
|
||||||
"cultnet.shard_catalog_request.v0",
|
"cultnet.shard_catalog_request.v0",
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
builtIns.get("cultnet.shard_catalog_response.v0")?.kind,
|
builtIns.get(
|
||||||
|
"https://github.com/GameCult/CultLib/contracts/cultnet/cultnet.shard-catalog-response.schema.json",
|
||||||
|
)?.kind,
|
||||||
"wire_message",
|
"wire_message",
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
"contracts:generate": "node tools/generate-swarm-contracts.mjs",
|
"contracts:generate": "node tools/generate-swarm-contracts.mjs",
|
||||||
"build": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
|
"build": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
|
||||||
"typecheck": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json --pretty false",
|
"typecheck": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json --pretty false",
|
||||||
"test": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json && node ../../node_modules/typescript/bin/tsc -p tsconfig.test.json && node --test dist-test/test/*.test.js",
|
"test": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json && node ../../node_modules/typescript/bin/tsc -p tsconfig.test.json && node --test dist-test/packages/cultnet-ts/test/*.test.js",
|
||||||
"test:interop": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json && node ../../node_modules/typescript/bin/tsc -p tsconfig.test.json && node --test --test-force-exit dist-test/test/interop/*.test.js"
|
"test:interop": "node tools/generate-swarm-contracts.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.json && node ../../node_modules/typescript/bin/tsc -p tsconfig.test.json && node --test --test-force-exit dist-test/packages/cultnet-ts/test/interop/*.test.js"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"messagepack",
|
"messagepack",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const execFileAsync = promisify(execFile);
|
||||||
const cargoCommand = process.env.CARGO ?? (process.platform === "win32" ? join(homedir(), ".cargo", "bin", "cargo.exe") : "cargo");
|
const cargoCommand = process.env.CARGO ?? (process.platform === "win32" ? join(homedir(), ".cargo", "bin", "cargo.exe") : "cargo");
|
||||||
const dotnetCommand = process.env.DOTNET ?? (process.platform === "win32" ? join("C:", "Program Files", "dotnet", "dotnet.exe") : "dotnet");
|
const dotnetCommand = process.env.DOTNET ?? (process.platform === "win32" ? join("C:", "Program Files", "dotnet", "dotnet.exe") : "dotnet");
|
||||||
const pythonCommand = process.env.PYTHON ?? resolvePythonCommand();
|
const pythonCommand = process.env.PYTHON ?? resolvePythonCommand();
|
||||||
const cultNetTsRoot = resolve(__dirname, "../../..");
|
const cultNetTsRoot = resolve(__dirname, "../../../../..");
|
||||||
const cultLibRoot = findAncestor(cultNetTsRoot, "CultLib.sln") ?? resolve(cultNetTsRoot, "..", "CultLib");
|
const cultLibRoot = findAncestor(cultNetTsRoot, "CultLib.sln") ?? resolve(cultNetTsRoot, "..", "CultLib");
|
||||||
const cultcachePyRoot = resolve(cultLibRoot, "packages", "cultcache-py");
|
const cultcachePyRoot = resolve(cultLibRoot, "packages", "cultcache-py");
|
||||||
const cultcachePySrc = ["cultcache-py", "cultnet-py", "cultmesh-py"]
|
const cultcachePySrc = ["cultcache-py", "cultnet-py", "cultmesh-py"]
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import {
|
||||||
// are generated output and must have exactly one home.
|
// are generated output and must have exactly one home.
|
||||||
const VECTORS = JSON.parse(
|
const VECTORS = JSON.parse(
|
||||||
readFileSync(
|
readFileSync(
|
||||||
join(__dirname, "..", "..", "test", "fixtures", "runtime-presence-vectors.json"),
|
join(__dirname, "..", "..", "..", "..", "test", "fixtures", "runtime-presence-vectors.json"),
|
||||||
"utf8",
|
"utf8",
|
||||||
),
|
),
|
||||||
) as { proof: string; signed: string };
|
) as { proof: string; signed: string };
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "../..",
|
||||||
"outDir": "dist-test",
|
"outDir": "dist-test",
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"declarationMap": false
|
"declarationMap": false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue