@bluelovers/jest-config 1.1.12 → 1.1.13

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/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.13](https://github.com/bluelovers/ws-jest/compare/@bluelovers/jest-config@1.1.12...@bluelovers/jest-config@1.1.13) (2026-09-14)
7
+
8
+
9
+
10
+ ### 🛠 Build System
11
+
12
+ * **dist:** update build ([2d4b41f](https://github.com/bluelovers/ws-jest/commit/2d4b41f19ddf1bf4b4acaa0e4adfb8ccc1fbac06))
13
+
14
+
15
+ ### ♻️ Chores
16
+
17
+ * **@bluelovers/jest-config:** 將 jest 設定檔排除於 .npmignore 之外 ([4f34655](https://github.com/bluelovers/ws-jest/commit/4f346554728adb182b55f65020631f1d9c0af8d4))
18
+
19
+
20
+
6
21
  ## [1.1.12](https://github.com/bluelovers/ws-jest/compare/@bluelovers/jest-config@1.1.11...@bluelovers/jest-config@1.1.12) (2026-09-12)
7
22
 
8
23
 
@@ -189,7 +189,7 @@ function fixJestConfig(jestConfig) {
189
189
  }
190
190
 
191
191
  var name = "@bluelovers/jest-config";
192
- var version = "1.1.12";
192
+ var version = "1.1.13";
193
193
 
194
194
  /**
195
195
  * 建立無邊框表格實例
@@ -74,7 +74,7 @@ function _newTableBorderless(e) {
74
74
  function printJestConfigInfo(e, s) {
75
75
  var o, n, l, i, u, a;
76
76
  const c = _newTableBorderless();
77
- null != s || (s = {}), null != e || (e = {}), c.push([ "@bluelovers/jest-config:", "1.1.12" ]),
77
+ null != s || (s = {}), null != e || (e = {}), c.push([ "@bluelovers/jest-config:", "1.1.13" ]),
78
78
  c.push([ "process.versions.node:", process.versions.node ]), c.push([ "cwd:", null !== (o = s.cwd) && void 0 !== o ? o : process.cwd() ]),
79
79
  (null === (n = s.file) || void 0 === n ? void 0 : n.length) && c.push([ "file:", s.file ]),
80
80
  (null === (l = e.cacheDirectory) || void 0 === l ? void 0 : l.length) && c.push([ "cacheDirectory:", e.cacheDirectory ]),
@@ -104,7 +104,7 @@ function _newTableBorderless(e) {
104
104
  function printJestConfigInfo(e, t) {
105
105
  var n, o, r, i, u, a;
106
106
  const f = _newTableBorderless();
107
- null != t || (t = {}), null != e || (e = {}), f.push([ "@bluelovers/jest-config:", "1.1.12" ]),
107
+ null != t || (t = {}), null != e || (e = {}), f.push([ "@bluelovers/jest-config:", "1.1.13" ]),
108
108
  f.push([ "process.versions.node:", process.versions.node ]), f.push([ "cwd:", null !== (n = t.cwd) && void 0 !== n ? n : process.cwd() ]),
109
109
  (null === (o = t.file) || void 0 === o ? void 0 : o.length) && f.push([ "file:", t.file ]),
110
110
  (null === (r = e.cacheDirectory) || void 0 === r ? void 0 : r.length) && f.push([ "cacheDirectory:", e.cacheDirectory ]),
@@ -183,7 +183,7 @@
183
183
  }
184
184
 
185
185
  var name = "@bluelovers/jest-config";
186
- var version = "1.1.12";
186
+ var version = "1.1.13";
187
187
 
188
188
  /**
189
189
  * 建立無邊框表格實例
@@ -63,7 +63,7 @@
63
63
  function printJestConfigInfo(e, t) {
64
64
  var n, o, l, i, u, a;
65
65
  const f = _newTableBorderless();
66
- null != t || (t = {}), null != e || (e = {}), f.push([ "@bluelovers/jest-config:", "1.1.12" ]),
66
+ null != t || (t = {}), null != e || (e = {}), f.push([ "@bluelovers/jest-config:", "1.1.13" ]),
67
67
  f.push([ "process.versions.node:", process.versions.node ]), f.push([ "cwd:", null !== (n = t.cwd) && void 0 !== n ? n : process.cwd() ]),
68
68
  (null === (o = t.file) || void 0 === o ? void 0 : o.length) && f.push([ "file:", t.file ]),
69
69
  (null === (l = e.cacheDirectory) || void 0 === l ? void 0 : l.length) && f.push([ "cacheDirectory:", e.cacheDirectory ]),
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Jest Preset (CommonJS) - Jest 預設配置(CommonJS 版本)
3
+ *
4
+ * 此檔案是發布模組時的必要檔案,用於支援 CommonJS 環境的 Jest 配置載入
5
+ * This file is required for npm publishing, used for Jest configuration loading in CommonJS environments
6
+ *
7
+ * 發布注意事項 / Publishing Notes:
8
+ * - 此檔案必須包含在 npm 發布中 / This file must be included in npm publish
9
+ * - 對應的 exports 配置: "./jest-preset": { "require": "./jest-preset.cjs", ... }
10
+ * - 請確保 .npmignore 中有 `!jest-preset.cjs` 以保留此檔案
11
+ * - Please ensure .npmignore has `!jest-preset.cjs` to keep this file
12
+ *
13
+ * @see https://jestjs.io/docs/configuration#preset-string
14
+ * @see package.json exports 配置 / package.json exports configuration
15
+ */
16
+
17
+ const { mixinJestConfig } = require('./dist/index.cjs.development.cjs');
18
+
19
+ /**
20
+ * 匯出預設的 Jest 配置物件
21
+ * Export default Jest configuration object
22
+ */
23
+ module.exports = mixinJestConfig();
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Jest Preset (ES Module) - Jest 預設配置(ES 模組版本)
3
+ *
4
+ * 此檔案是發布模組時的必要檔案,用於支援 ESM 環境的 Jest 配置載入
5
+ * This file is required for npm publishing, used for Jest configuration loading in ESM environments
6
+ *
7
+ * 發布注意事項 / Publishing Notes:
8
+ * - 此檔案必須包含在 npm 發布中 / This file must be included in npm publish
9
+ * - 對應的 exports 配置: "./jest-preset": { ..., "import": "./jest-preset.mjs" }
10
+ * - 請確保 .npmignore 中有 `!jest-preset.mjs` 以保留此檔案
11
+ * - Please ensure .npmignore has `!jest-preset.mjs` to keep this file
12
+ *
13
+ * 關於 jest-preset.js / About jest-preset.js:
14
+ * - jest-preset.js 不需要實際存在 / jest-preset.js does not need to physically exist
15
+ * - package.json exports 中已定義其映射關係至 .cjs 和 .mjs
16
+ * - The mapping is defined in package.json exports to .cjs and .mjs
17
+ *
18
+ * @see https://jestjs.io/docs/configuration#preset-string
19
+ * @see package.json exports 配置 / package.json exports configuration
20
+ */
21
+
22
+ import { mixinJestConfig } from './dist/index.esm.mjs';
23
+
24
+ /**
25
+ * 匯出預設的 Jest 配置物件
26
+ * Export default Jest configuration object
27
+ */
28
+ export default mixinJestConfig();
package/jest.config.js ADDED
@@ -0,0 +1,208 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * Jest 自動配置模組
5
+ * Jest Auto Configuration Module
6
+ *
7
+ * 此模組自動偵測並配置 Jest 測試環境,支援多層級配置解析
8
+ * This module automatically detects and configures Jest test environment with multi-level configuration resolution
9
+ */
10
+
11
+ const { basename, extname, dirname } = require('path');
12
+
13
+ /**
14
+ * Jest 配置物件
15
+ * Jest configuration object
16
+ *
17
+ * @type { import('ts-jest').JestConfigWithTsJest }
18
+ */
19
+ let jestConfig = {}
20
+
21
+ /**
22
+ * 嘗試使用 `@yarn-tool/require-resolve` 載入模組的工具函數
23
+ * Utility function for lazy loading modules
24
+ *
25
+ * @param {string} name - 模組名稱 Module name
26
+ * @param {string[]} [paths] - 搜尋路徑 Search paths
27
+ * @private
28
+ */
29
+ function _lazyRequire(name, paths)
30
+ {
31
+ let m;
32
+ try
33
+ {
34
+ /**
35
+ * 嘗試使用 require-resolve 工具載入模組
36
+ * Try to load module using require-resolve tool
37
+ */
38
+ m = require('@yarn-tool/require-resolve').requireExtra(name, {
39
+ includeCurrentDirectory: true,
40
+ includeGlobal: true,
41
+ paths,
42
+ });
43
+ }
44
+ catch (e)
45
+ {}
46
+
47
+ /**
48
+ * 如果失敗則使用標準 require
49
+ * If failed, use standard require
50
+ */
51
+ return typeof m === 'undefined' ? require(name) : m;
52
+ }
53
+
54
+ /**
55
+ * 嘗試使用 `@yarn-tool/require-resolve` 解析模組路徑的工具函數
56
+ * Utility function for resolving module paths
57
+ *
58
+ * @param {string} name - 模組名稱 Module name
59
+ * @returns {string} - 解析後的路徑 Resolved path
60
+ * @private
61
+ */
62
+ function _requireResolve(name)
63
+ {
64
+ let result;
65
+
66
+ try
67
+ {
68
+ /** @type {import('@yarn-tool/require-resolve')} */
69
+ const { requireResolveExtra, requireResolveCore } = _lazyRequire('@yarn-tool/require-resolve');
70
+
71
+ /**
72
+ * 嘗試從多個路徑解析 TSDX 相關模組
73
+ * Try to resolve TSDX related modules from multiple paths
74
+ */
75
+ const paths = [
76
+ requireResolveExtra('@bluelovers/tsdx').result,
77
+ requireResolveExtra('tsdx').result,
78
+ ].filter(Boolean);
79
+
80
+ result = requireResolveCore(name, {
81
+ includeGlobal: true,
82
+ includeCurrentDirectory: true,
83
+ paths,
84
+ })
85
+ }
86
+ catch (e)
87
+ {
88
+
89
+ }
90
+
91
+ /**
92
+ * 如果都失敗,使用標準 resolve
93
+ * If all failed, use standard resolve
94
+ */
95
+ result = result || require.resolve(name);
96
+
97
+ console.info('[require.resolve]', name, '=>', result)
98
+
99
+ return result
100
+ }
101
+
102
+ /**
103
+ * 配置解析狀態標誌
104
+ * Configuration resolution status flag
105
+ */
106
+ let _isNeedConfig = true;
107
+
108
+ try
109
+ {
110
+ /**
111
+ * 第一層:搜尋工作區中的配置檔案
112
+ * First level: Search for configuration files in workspace
113
+ */
114
+ if (!jestConfig.preset)
115
+ {
116
+ /** @type {import('@yarn-tool/ws-find-up-paths')} */
117
+ const { findUpPathsWorkspaces } = _lazyRequire('@yarn-tool/ws-find-up-paths');
118
+
119
+ /**
120
+ * 向上搜尋 jest-preset.js 和 jest.config.js
121
+ * Search upwards for jest-preset.js and jest.config.js
122
+ */
123
+ let result = findUpPathsWorkspaces([
124
+ 'jest-preset.js',
125
+ 'jest.config.js',
126
+ ], {
127
+ /** 忽略當前套件 / Ignore current package */
128
+ ignoreCurrentPackage: true,
129
+ /** 只搜尋檔案 / Only search for files */
130
+ onlyFiles: true,
131
+ }).result;
132
+
133
+ if (result)
134
+ {
135
+ let name = basename(result, extname(result))
136
+
137
+ switch (name)
138
+ {
139
+ /**
140
+ * 如果是 jest-preset.js,使用其目錄作為 preset
141
+ * If it's jest-preset.js, use its directory as preset
142
+ */
143
+ case 'jest-preset':
144
+ // @ts-ignore
145
+ // jestConfig.preset = dirname(result);
146
+ jestConfig.preset = result;
147
+ break;
148
+ /**
149
+ * 其他情況,載入配置檔案內容
150
+ * Otherwise, load the configuration file content
151
+ */
152
+ default:
153
+ jestConfig = {
154
+ ...require(result),
155
+ jestConfig,
156
+ };
157
+ break;
158
+ }
159
+
160
+ _isNeedConfig = false;
161
+ }
162
+ }
163
+ }
164
+ catch (e)
165
+ {
166
+
167
+ }
168
+
169
+ try
170
+ {
171
+ /**
172
+ * 第二層:嘗試解析 @bluelovers/jest-config
173
+ * Second level: Try to resolve @bluelovers/jest-config
174
+ */
175
+ if (_isNeedConfig && !jestConfig.preset)
176
+ {
177
+ let result = _requireResolve('@bluelovers/jest-config/package.json');
178
+ if (result)
179
+ {
180
+ // @ts-ignore
181
+ jestConfig.preset = dirname(result);
182
+ _isNeedConfig = false;
183
+ }
184
+ }
185
+ }
186
+ catch (e)
187
+ {
188
+
189
+ }
190
+
191
+ if (_isNeedConfig && !jestConfig.preset)
192
+ {
193
+ /**
194
+ * 第三層:使用預設的 @bluelovers/jest-config
195
+ * Third level: Use default @bluelovers/jest-config
196
+ */
197
+ // @ts-ignore
198
+ jestConfig.preset = '@bluelovers/jest-config';
199
+ _isNeedConfig = false;
200
+ }
201
+
202
+ /**
203
+ * 輸出最終的 preset 設定
204
+ * Output the final preset configuration
205
+ */
206
+ console.info(`jest.config.preset: ${jestConfig.preset}`);
207
+
208
+ module.exports = jestConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluelovers/jest-config",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "Jest configuration preset with TypeScript support, providing automatic ts-jest transform chain integration, cache management, and coverage settings / 具備 TypeScript 支援的 Jest 配置預設套件,提供自動 ts-jest 轉換鏈整合、快取管理和覆蓋率設定",
5
5
  "keywords": [
6
6
  "jest-preset",
@@ -105,5 +105,5 @@
105
105
  "publishConfig": {
106
106
  "access": "public"
107
107
  },
108
- "gitHead": "2d4b41f19ddf1bf4b4acaa0e4adfb8ccc1fbac06"
108
+ "gitHead": "aebbf6f90595ed291660067da304cfd9110d6314"
109
109
  }