Skip to content

🎥 Make videos programmatically with React

`@remotion/lambda`: Disable Lambda leak detection in testing

Jonny Burgerebe6f6c1a3d0
diff --git a/packages/lambda/src/functions/helpers/__mocks__/leak-detection.ts b/packages/lambda/src/functions/helpers/__mocks__/leak-detection.ts
new file mode 100644
index 0000000000..cdc18e7150
--- /dev/null
+++ b/packages/lambda/src/functions/helpers/__mocks__/leak-detection.ts
@@ -0,0 +1,11 @@
+import type {
+ setCurrentRequestId as originalSetCurrentRequestId,
+ startLeakDetection as originalStartLeakDetection,
+ stopLeakDetection as originalStopLeakDetection,
+} from '../leak-detection';
+
+export const stopLeakDetection: typeof originalStopLeakDetection = () => {};
+
+export const setCurrentRequestId: typeof originalSetCurrentRequestId = () => {};
+
+export const startLeakDetection: typeof originalStartLeakDetection = () => {};
diff --git a/packages/lambda/src/test/setup.ts b/packages/lambda/src/test/setup.ts
index 44f0cede02..9247456a41 100644
--- a/packages/lambda/src/test/setup.ts
+++ b/packages/lambda/src/test/setup.ts
@@ -27,6 +27,9 @@ vi.mock('../functions/helpers/check-if-render-exists', () =>
vi.mock('../functions/helpers/get-files-in-folder', () =>
vi.importActual('../functions/helpers/__mocks__/get-files-in-folder'),
);
+vi.mock('../functions/helpers/leak-detection', () =>
+ vi.importActual('../functions/helpers/__mocks__/leak-detection'),
+);
vi.mock('../functions/helpers/get-chromium-executable-path', () =>
vi.importActual(
'../functions/helpers/__mocks__/get-chromium-executable-path',