Socket
Socket
Sign inDemoInstall

@swc/jest

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/jest - npm Package Compare versions

Comparing version 0.2.17 to 0.2.18

15

index.js

@@ -37,2 +37,3 @@ "use strict";

var path = __importStar(require("path"));
var process = __importStar(require("process"));
var vm = __importStar(require("vm"));

@@ -84,3 +85,12 @@ var create_cache_key_function_1 = __importDefault(require("@jest/create-cache-key-function"));

}
var nodeTargetDefaults = new Map([
['12', 'es2018'],
['13', 'es2019'],
['14', 'es2020'],
['15', 'es2021'],
['16', 'es2021'],
['17', 'es2022'],
]);
function buildSwcTransformOpts(swcOptions) {
var _a;
var computedSwcOptions = swcOptions || getOptionsFromSwrc();

@@ -90,2 +100,7 @@ if (!supportsEsm) {

}
if (!((_a = computedSwcOptions.jsc) === null || _a === void 0 ? void 0 : _a.target)) {
set(computedSwcOptions, 'jsc.target',
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
nodeTargetDefaults.get(process.version.match(/v(\d+)/)[1]) || 'es2018');
}
set(computedSwcOptions, 'jsc.transform.hidden.jest', true);

@@ -92,0 +107,0 @@ return computedSwcOptions;

2

package.json
{
"name": "@swc/jest",
"version": "0.2.17",
"version": "0.2.18",
"description": "swc integration for jest",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -42,3 +42,3 @@ # @swc/jest

**Q: Jest use CommonJS in default. But I want to use ESM.**
### Q: Jest use CommonJS in default. But I want to use ESM.

@@ -74,2 +74,32 @@ A: Setup Jest following this [Guide](https://jestjs.io/docs/ecmascript-modules).

### Q: What ECMAScript target is set by `jsc.target`?
A: By default, the version supported by your Node runtime.
| Node version | Default `jsc.target` |
|--------------|----------------------|
| 12 | 'es2018' |
| 13 | 'es2019' |
| 14 | 'es2020' |
| 15 | 'es2021' |
| 16 | 'es2021' |
| 17 | 'es2022' |
You can customize this by setting an explicit version in your config:
```js
module.exports = {
transform: {
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
jsc: {
target: "es2021",
},
},
],
},
}
```
## License

@@ -76,0 +106,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc