Skip to content

Commit

Permalink
fix(jest): Handle process.version undefined (#64)
Browse files Browse the repository at this point in the history
In the event that `process.version` is undefined then return "es2018" as
expected.
  • Loading branch information
JasonFyfe authored Oct 22, 2024
1 parent 9d40060 commit eca4f6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/good-lobsters-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@swc/jest": patch
---

Return es2018 in the event that process.version is undefined.
2 changes: 1 addition & 1 deletion packages/jest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
}
Expand Down

0 comments on commit eca4f6b

Please sign in to comment.