@walkeros/config 4.1.0 → 4.1.1-next-1779822275564
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 +2 -0
- package/jest/index.mjs +28 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/jest/index.mjs
CHANGED
|
@@ -29,7 +29,10 @@ function getModuleMapper() {
|
|
|
29
29
|
if (existsSync(pkgJsonPath)) {
|
|
30
30
|
const pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (
|
|
33
|
+
pkg.name?.startsWith('@walkeros/') &&
|
|
34
|
+
existsSync(path.join(fullPath, 'src'))
|
|
35
|
+
) {
|
|
33
36
|
// Map root export: @walkeros/core → packages/core/src/
|
|
34
37
|
mapper[`^${escapeRegex(pkg.name)}$`] = path.join(fullPath, 'src/');
|
|
35
38
|
|
|
@@ -44,7 +47,8 @@ function getModuleMapper() {
|
|
|
44
47
|
existsSync(srcFile + '.tsx') ||
|
|
45
48
|
existsSync(path.join(srcFile, 'index.ts'))
|
|
46
49
|
) {
|
|
47
|
-
mapper[`^${escapeRegex(pkg.name)}/${escapeRegex(subName)}$`] =
|
|
50
|
+
mapper[`^${escapeRegex(pkg.name)}/${escapeRegex(subName)}$`] =
|
|
51
|
+
srcFile;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
}
|
|
@@ -61,11 +65,11 @@ function getModuleMapper() {
|
|
|
61
65
|
if (Object.keys(mapper).length === 0) {
|
|
62
66
|
throw new Error(
|
|
63
67
|
`[jest-config] moduleNameMapper is empty — no @walkeros/* packages found.\n` +
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
` packagesDir: ${packagesDir}\n` +
|
|
69
|
+
` scanDir: ${scanDir}\n` +
|
|
70
|
+
` scanDir exists: ${existsSync(scanDir)}\n` +
|
|
71
|
+
`This usually means a stale @walkeros/config copy was loaded from node_modules ` +
|
|
72
|
+
`instead of the workspace version. Run: npm dedupe @walkeros/config`,
|
|
69
73
|
);
|
|
70
74
|
}
|
|
71
75
|
|
|
@@ -80,7 +84,10 @@ function getGlobals() {
|
|
|
80
84
|
const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
81
85
|
version = pkg.version || '0.0.0';
|
|
82
86
|
} catch (error) {
|
|
83
|
-
console.warn(
|
|
87
|
+
console.warn(
|
|
88
|
+
'Could not read package.json for version injection in tests:',
|
|
89
|
+
error.message,
|
|
90
|
+
);
|
|
84
91
|
}
|
|
85
92
|
|
|
86
93
|
return {
|
|
@@ -110,17 +117,25 @@ const config = {
|
|
|
110
117
|
testMatch: ['<rootDir>/**/*.test.(ts|tsx|js|jsx)'],
|
|
111
118
|
moduleFileExtensions: ['js', 'ts', 'tsx', 'mjs', 'json'],
|
|
112
119
|
rootDir: '.',
|
|
113
|
-
moduleDirectories: [
|
|
120
|
+
moduleDirectories: [
|
|
121
|
+
'node_modules',
|
|
122
|
+
'src',
|
|
123
|
+
path.join(packagesDir, 'node_modules'),
|
|
124
|
+
],
|
|
114
125
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
115
126
|
moduleNameMapper: getModuleMapper(),
|
|
116
127
|
globals: getGlobals(),
|
|
117
|
-
|
|
118
|
-
//
|
|
119
|
-
|
|
128
|
+
|
|
129
|
+
// Adaptive worker count: 50% of host CPUs so it scales to the machine
|
|
130
|
+
// (8-core devcontainer -> 4 workers, 2-core CI runner -> 1 worker) instead of
|
|
131
|
+
// a hardcoded number that oversubscribes small CI runners. Memory-bounded so a
|
|
132
|
+
// bloated worker is recycled (~90MB/worker measured). CLI overrides to 3.
|
|
133
|
+
maxWorkers: '50%',
|
|
134
|
+
workerIdleMemoryLimit: '512MB',
|
|
120
135
|
testTimeout: 30000,
|
|
121
136
|
clearMocks: true,
|
|
122
137
|
restoreMocks: true,
|
|
123
|
-
|
|
138
|
+
|
|
124
139
|
// Exclude from module resolution (prevents Haste collisions with cached packages)
|
|
125
140
|
modulePathIgnorePatterns: ['<rootDir>/.tmp', '/dist/'],
|
|
126
141
|
|
package/package.json
CHANGED