From 957332162651b299021d0f0a411b5e650b916da3 Mon Sep 17 00:00:00 2001 From: JasonFyfe <73648977+JasonFyfe@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:34:54 +0100 Subject: [PATCH 1/2] fix(jest): handle process.version undefined --- packages/jest/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest/index.ts b/packages/jest/index.ts index d9bf340..21684c2 100644 --- a/packages/jest/index.ts +++ b/packages/jest/index.ts @@ -144,7 +144,7 @@ function buildSwcTransformOpts( computedSwcOptions, "jsc.target", // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - nodeTargetDefaults.get(process.version.match(/v(\d+)/)![1]) || + nodeTargetDefaults.get(process.version?.match(/v(\d+)/)![1]) || "es2018" ); } From c2f2cefc1c760adfff3d2ec4feb7f634c541455c Mon Sep 17 00:00:00 2001 From: JasonFyfe <73648977+JasonFyfe@users.noreply.github.com> Date: Mon, 21 Oct 2024 21:51:17 +0000 Subject: [PATCH 2/2] docs(changeset): Return es2018 in the event that process.version is undefined. --- .changeset/good-lobsters-search.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/good-lobsters-search.md diff --git a/.changeset/good-lobsters-search.md b/.changeset/good-lobsters-search.md new file mode 100644 index 0000000..8d8bcc3 --- /dev/null +++ b/.changeset/good-lobsters-search.md @@ -0,0 +1,5 @@ +--- +"@swc/jest": patch +--- + +Return es2018 in the event that process.version is undefined.