Skip to content

Commit 94d5e4c

Browse files
committed
fix: correct ResourceLimits property names in tests
- Replace maxMemoryMB with maxMemoryBytes and convert to bytes - Replace maxModulesInCache with maxCachedModules - Remove invalid onWarning property from ResourceLimits options These property name mismatches were causing tests to use default limits and fail to properly configure resource limiters, leading to Jest not exiting due to unclosed intervals.
1 parent b22ca02 commit 94d5e4c

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

tests/production-failure-modes.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ describe('Production Failure Modes', () => {
192192
moduleSystem = new ModuleSystem({
193193
resolution: { baseUrl: testDir },
194194
resourceLimits: {
195-
maxMemoryMB: 500,
195+
maxMemoryBytes: 500 * 1024 * 1024,
196196
maxFileHandles: 200,
197-
maxModulesInCache: 150,
197+
maxCachedModules: 150,
198198
},
199199
});
200200

@@ -215,10 +215,9 @@ describe('Production Failure Modes', () => {
215215
moduleSystem = new ModuleSystem({
216216
resolution: { baseUrl: testDir },
217217
resourceLimits: {
218-
maxMemoryMB: 100, // Very low limit to trigger warning
218+
maxMemoryBytes: 100 * 1024 * 1024,
219219
maxFileHandles: 1000,
220-
maxModulesInCache: 10000,
221-
onWarning: warning => warnings.push(warning),
220+
maxCachedModules: 10000,
222221
},
223222
});
224223

tests/production-load-testing.test.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ describe('Production Load Testing', () => {
4646
moduleSystem = new ModuleSystem({
4747
resolution: { baseUrl: testDir },
4848
resourceLimits: {
49-
maxMemoryMB: 500,
49+
maxMemoryBytes: 500 * 1024 * 1024,
5050
maxFileHandles: 500,
51-
maxModulesInCache: 500,
51+
maxCachedModules: 500,
5252
},
5353
});
5454

@@ -102,9 +102,9 @@ describe('Production Load Testing', () => {
102102
moduleSystem = new ModuleSystem({
103103
resolution: { baseUrl: testDir },
104104
resourceLimits: {
105-
maxMemoryMB: 1000,
105+
maxMemoryBytes: 1000 * 1024 * 1024,
106106
maxFileHandles: 1000,
107-
maxModulesInCache: 1000,
107+
maxCachedModules: 1000,
108108
},
109109
});
110110

@@ -131,14 +131,9 @@ describe('Production Load Testing', () => {
131131
moduleSystem = new ModuleSystem({
132132
resolution: { baseUrl: testDir },
133133
resourceLimits: {
134-
maxMemoryMB: 500,
134+
maxMemoryBytes: 500 * 1024 * 1024,
135135
maxFileHandles: 500,
136-
maxModulesInCache: 500,
137-
onWarning: () => {
138-
// Record memory usage when warning is triggered
139-
const usage = process.memoryUsage();
140-
memoryReadings.push(usage.heapUsed / 1024 / 1024);
141-
},
136+
maxCachedModules: 500,
142137
},
143138
});
144139

@@ -293,9 +288,9 @@ describe('Production Load Testing', () => {
293288
moduleSystem = new ModuleSystem({
294289
resolution: { baseUrl: testDir },
295290
resourceLimits: {
296-
maxMemoryMB: 500,
291+
maxMemoryBytes: 500 * 1024 * 1024,
297292
maxFileHandles: 500,
298-
maxModulesInCache: 500,
293+
maxCachedModules: 500,
299294
},
300295
});
301296

0 commit comments

Comments
 (0)