Skip to content

🎥 Make videos programmatically with React

add test

Jonny Burger4772dd1ea1ea
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index 53d6c0312a..d447e4623f 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -56,6 +56,7 @@ import {WarpDemo2} from './WarpText/demo2';
import {Tailwind} from './Tailwind';
import {DynamicDuration, dynamicDurationSchema} from './DynamicDuration';
import {HugePayload, hugePayloadSchema} from './HugePayload';
+import {Timeout} from './Timeout';
if (alias !== 'alias') {
throw new Error('should support TS aliases');
@@ -359,6 +360,14 @@ export const Index: React.FC = () => {
fps={30}
durationInFrames={30}
/>
+ <Composition
+ id="Timeout"
+ component={Timeout}
+ width={1280}
+ height={720}
+ fps={30}
+ durationInFrames={100}
+ />
<Composition
id="error-on-frame-10"
component={ErrorOnFrame10}
@@ -474,10 +483,10 @@ export const Index: React.FC = () => {
<Composition
id="OffthreadRemoteVideo"
component={OffthreadRemoteVideo}
- width={1080}
- height={1080}
- fps={30}
- durationInFrames={100}
+ width={1920 * 2}
+ height={1080 * 2}
+ fps={60}
+ durationInFrames={20000}
/>
<Composition
id="video-testing-webm"
diff --git a/packages/example/src/Timeout.tsx b/packages/example/src/Timeout.tsx
new file mode 100644
index 0000000000..e32365c743
--- /dev/null
+++ b/packages/example/src/Timeout.tsx
@@ -0,0 +1,8 @@
+import React, {useState} from 'react';
+import {AbsoluteFill, delayRender} from 'remotion';
+
+export const Timeout: React.FC = () => {
+ useState(() => delayRender('This error should appear'));
+
+ return <AbsoluteFill>hi there</AbsoluteFill>;
+};
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index ee1e3feda2..acb294e0a2 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -409,3 +409,17 @@ test("Should be able to render a huge payload that gets serialized", async () =>
expect(task.exitCode).toBe(0);
fs.unlinkSync(outputPath.replace(".mp4", ".png"));
});
+
+test("If timeout, the error should be shown", async () => {
+ const task = await execa(
+ "pnpm",
+ ["exec", "remotion", "render", "Timeout", outputPath, "--timeout=7000"],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ reject: false,
+ }
+ );
+
+ expect(task.exitCode).toBe(1);
+ expect(task.stderr).toContain("This error should appear");
+});