@umijs/test 4.0.86 → 4.0.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -69,6 +69,10 @@ function createConfig(opts) {
69
69
  "^.+\\.(t|j)sx?$": getJSTransformer(
70
70
  (opts == null ? void 0 : opts.jsTransformer) || "esbuild",
71
71
  opts == null ? void 0 : opts.jsTransformerOpts
72
+ ),
73
+ "^.+\\.mjs$": getJSTransformer(
74
+ (opts == null ? void 0 : opts.jsTransformer) || "esbuild",
75
+ opts == null ? void 0 : opts.jsTransformerOpts
72
76
  )
73
77
  },
74
78
  moduleNameMapper: {
@@ -41,7 +41,7 @@ var THIS_FILE = import_fs.default.readFileSync(__filename);
41
41
  var TS_TSX_REGEX = /\.tsx?$/;
42
42
  var JS_JSX_REGEX = /\.jsx?$/;
43
43
  function isTarget(path) {
44
- return JS_JSX_REGEX.test(path) || TS_TSX_REGEX.test(path);
44
+ return JS_JSX_REGEX.test(path) || TS_TSX_REGEX.test(path) || path.endsWith(".mjs");
45
45
  }
46
46
  var createTransformer = (userOptions = {}) => {
47
47
  const options = (0, import_options.resolveOptions)(userOptions);
@@ -68,7 +68,7 @@ var createTransformer = (userOptions = {}) => {
68
68
  const result = (0, import_esbuild.transformSync)(rawCode, {
69
69
  ...options,
70
70
  ...config.globals["jest-esbuild"],
71
- loader: userOptions.loader || (0, import_path.extname)(path).slice(1),
71
+ loader: userOptions.loader || ext2Loader((0, import_path.extname)(path)),
72
72
  sourcefile: path,
73
73
  sourcesContent: false
74
74
  });
@@ -87,8 +87,16 @@ var createTransformer = (userOptions = {}) => {
87
87
  }
88
88
  };
89
89
  };
90
+ var EXT_MAP = {
91
+ ".js": "js",
92
+ ".jsx": "jsx",
93
+ ".ts": "ts",
94
+ ".tsx": "tsx",
95
+ ".mjs": "js"
96
+ };
97
+ function ext2Loader(ext) {
98
+ return EXT_MAP[ext] || "js";
99
+ }
90
100
  var esbuild_default = {
91
101
  createTransformer
92
102
  };
93
- // Annotate the CommonJS export names for ESM import in node:
94
- 0 && (module.exports = {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/test",
3
- "version": "4.0.86",
3
+ "version": "4.0.88",
4
4
  "description": "@umijs/test",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/testing#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -16,17 +16,17 @@
16
16
  "setupFiles"
17
17
  ],
18
18
  "dependencies": {
19
- "@babel/plugin-transform-modules-commonjs": "7.21.2",
19
+ "@babel/plugin-transform-modules-commonjs": "7.23.0",
20
20
  "@jest/types": "27.5.1",
21
21
  "babel-jest": "^29.4.3",
22
22
  "esbuild": "0.17.19",
23
23
  "identity-obj-proxy": "3.0.0",
24
24
  "isomorphic-unfetch": "4.0.2",
25
- "@umijs/bundler-utils": "4.0.86",
26
- "@umijs/utils": "4.0.86"
25
+ "@umijs/bundler-utils": "4.0.88",
26
+ "@umijs/utils": "4.0.88"
27
27
  },
28
28
  "devDependencies": {
29
- "@babel/core": "^7.21.0",
29
+ "@babel/core": "^7.23.2",
30
30
  "@jest/transform": "^28.1.3",
31
31
  "jest": "^29.4.3"
32
32
  },