Skip to content

Commit

Permalink
fix(checkpoint-validation): fix broken initial release (langchain-ai#618
Browse files Browse the repository at this point in the history
)
  • Loading branch information
benjamincburns authored Oct 22, 2024
1 parent 8b3296c commit 51250e1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
4 changes: 3 additions & 1 deletion libs/checkpoint-validation/bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node

import { register } from "node:module";
import { main } from "../dist/cli.js";

register("@swc-node/register/esm", import.meta.url);

await main();
4 changes: 1 addition & 3 deletions libs/checkpoint-validation/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { dirname, resolve as pathResolve } from "node:path";
import { fileURLToPath } from "node:url";
import { runCLI } from "@jest/core";

// make it so we can import/require .ts files
import "@swc-node/register/esm-register";
import { parseArgs } from "./parse_args.js";

export async function main() {
Expand All @@ -18,6 +16,6 @@ export async function main() {
$0: "",
runInBand: true,
},
[pathResolve(moduleDirname, "..", "bin", "jest.config.js")]
[pathResolve(moduleDirname, "runtime_jest_config.js")]
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
// For the Jest config for the tests in this project, see the `jest.config.cjs` in the root of the package workspace.
import path from "node:path";
import { fileURLToPath } from "node:url";
import { parseArgs } from "../dist/parse_args.js";
import type { JestConfigWithTsJest } from "ts-jest";
import { parseArgs } from "./parse_args.js";

const args = await parseArgs(process.argv.slice(2));

/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
const config: JestConfigWithTsJest = {
preset: "ts-jest/presets/default-esm",
rootDir: path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "dist"),
rootDir: path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"..",
"dist"
),
testEnvironment: "node",
testMatch: ["<rootDir>/runner.js"],
transform: {
"^.+\\.[jt]sx?$": ["@swc/jest"],
"^.+\\.[jt]sx?$": "@swc/jest",
},
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.[jt]sx?$": "$1",
},
globals: args,
};

export default config;
3 changes: 2 additions & 1 deletion libs/checkpoint-validation/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"src/cli.ts",
"src/import_utils.ts",
"src/runner.ts",
"src/parse_args.ts"
"src/parse_args.ts",
"src/runtime_jest_config.ts"
]
}
2 changes: 1 addition & 1 deletion libs/checkpoint-validation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"target": "ES2021",
"lib": ["ES2021", "ES2022.Object", "DOM"],
"types": ["node", "jest"],
"module": "ES2020",
"module": "ES2022",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"declaration": true,
Expand Down

0 comments on commit 51250e1

Please sign in to comment.