Skip to content

Commit 51250e1

Browse files
fix(checkpoint-validation): fix broken initial release (#618)
1 parent 8b3296c commit 51250e1

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env node
2-
2+
import { register } from "node:module";
33
import { main } from "../dist/cli.js";
44

5+
register("@swc-node/register/esm", import.meta.url);
6+
57
await main();

libs/checkpoint-validation/src/cli.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { dirname, resolve as pathResolve } from "node:path";
22
import { fileURLToPath } from "node:url";
33
import { runCLI } from "@jest/core";
44

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

97
export async function main() {
@@ -18,6 +16,6 @@ export async function main() {
1816
$0: "",
1917
runInBand: true,
2018
},
21-
[pathResolve(moduleDirname, "..", "bin", "jest.config.js")]
19+
[pathResolve(moduleDirname, "runtime_jest_config.js")]
2220
);
2321
}

libs/checkpoint-validation/bin/jest.config.js renamed to libs/checkpoint-validation/src/runtime_jest_config.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22
// For the Jest config for the tests in this project, see the `jest.config.cjs` in the root of the package workspace.
33
import path from "node:path";
44
import { fileURLToPath } from "node:url";
5-
import { parseArgs } from "../dist/parse_args.js";
5+
import type { JestConfigWithTsJest } from "ts-jest";
6+
import { parseArgs } from "./parse_args.js";
67

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

9-
/** @type {import('ts-jest').JestConfigWithTsJest} */
10-
export default {
10+
const config: JestConfigWithTsJest = {
1111
preset: "ts-jest/presets/default-esm",
12-
rootDir: path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "dist"),
12+
rootDir: path.resolve(
13+
path.dirname(fileURLToPath(import.meta.url)),
14+
"..",
15+
"dist"
16+
),
1317
testEnvironment: "node",
1418
testMatch: ["<rootDir>/runner.js"],
1519
transform: {
16-
"^.+\\.[jt]sx?$": ["@swc/jest"],
20+
"^.+\\.[jt]sx?$": "@swc/jest",
1721
},
1822
moduleNameMapper: {
1923
"^(\\.{1,2}/.*)\\.[jt]sx?$": "$1",
2024
},
2125
globals: args,
2226
};
27+
28+
export default config;

libs/checkpoint-validation/tsconfig.cjs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"src/cli.ts",
1414
"src/import_utils.ts",
1515
"src/runner.ts",
16-
"src/parse_args.ts"
16+
"src/parse_args.ts",
17+
"src/runtime_jest_config.ts"
1718
]
1819
}

libs/checkpoint-validation/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"target": "ES2021",
77
"lib": ["ES2021", "ES2022.Object", "DOM"],
88
"types": ["node", "jest"],
9-
"module": "ES2020",
9+
"module": "ES2022",
1010
"moduleResolution": "NodeNext",
1111
"esModuleInterop": true,
1212
"declaration": true,

0 commit comments

Comments
 (0)