mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
Jest now uses SWC to transpile the Node SDK tests, with the same ES2022 target and legacy decorator semantics as the SDK. The Node and Arrow compatibility jobs run the existing test TypeScript project through `tsc --noEmit` after building the SDK. Contributors can run that check with `pnpm run typecheck:tests`. Closes #2234. Measured on Windows x64 with Node 22.23.4, Jest 29.7, the default native features and one Jest process (`--runInBand --silent`). Both runs used the same 0.42.0-beta.26 Windows native binary. Times below are wall-clock seconds. | Workload | ts-jest | SWC | | --- | ---: | ---: | | Six suites, empty Jest cache (median of three) | 8.31 | 4.22 | | Same six suites, populated cache (median of three) | 4.45 | 3.52 | | Full default suite, empty Jest cache (one run each) | 50.10 | 38.55 | The six suites were `arrow`, `expr`, `materialized_view`, `package`, `registry` and `sanitize`. Each pair started with a fresh Jest cache directory and immediately reused it on the second run. The separate test type check took 3.39 s, bringing the full SWC run plus type checking to 41.94 s on this machine. Both full runs passed the same 1,882 tests with 28 skipped. The SDK TypeScript build, test type check, Biome checks and TypeDoc build also passed. --------- Co-authored-by: lipeih <lipeihan@eazytec.com>
29 lines
842 B
JavaScript
29 lines
842 B
JavaScript
const path = require("node:path");
|
|
|
|
// Set the real process environment before Jest creates its sandbox and workers.
|
|
// Assigning process.env inside a test does not reach Rust's std::env.
|
|
process.env.LANCEDB_OAUTH_BROWSER =
|
|
process.platform === "win32"
|
|
? path.join(__dirname, "__test__/fixtures/oauth_browser.cmd")
|
|
: "/usr/bin/true";
|
|
|
|
/** @type {import('jest').Config} */
|
|
module.exports = {
|
|
transform: {
|
|
"^.+\\.ts$": [
|
|
"@swc/jest",
|
|
{
|
|
jsc: {
|
|
target: "es2022",
|
|
parser: { syntax: "typescript", decorators: true },
|
|
transform: { legacyDecorator: true, decoratorMetadata: true },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
testEnvironment: "node",
|
|
moduleDirectories: ["node_modules", "./dist"],
|
|
moduleFileExtensions: ["js", "ts"],
|
|
modulePathIgnorePatterns: ["<rootDir>/examples/"],
|
|
};
|