Skip to content

🎥 Make videos programmatically with React

Update rendering.test.ts

Jonny Burgerb388df12d244
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index 7419852fe7..e38a308c54 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -2,10 +2,22 @@ import { RenderInternals } from "@remotion/renderer";
import execa from "execa";
import fs from "fs";
import path from "path";
-import { beforeEach, expect, test } from "vitest";
+import { beforeAll, beforeEach, expect, test } from "vitest";
const outputPath = path.join(process.cwd(), "packages/example/out.mp4");
+beforeAll(async () => {
+ /**
+ * Before running any of these tests, we should bundle the example project. In the CI, this is already done.
+ */
+ if (process.env.CI) {
+ return;
+ }
+ await execa("pnpm", ["exec", "remotion", "bundle"], {
+ cwd: path.join(process.cwd(), "..", "example"),
+ });
+});
+
beforeEach(() => {
if (fs.existsSync(outputPath)) {
fs.unlinkSync(outputPath);
@@ -19,6 +31,7 @@ test("Should be able to render video with custom port", async () => {
"exec",
"remotion",
"render",
+ "build",
"ten-frame-tester",
"--codec",
"h264",
@@ -59,6 +72,8 @@ test("Should fail to render out of range CRF", async () => {
"exec",
"remotion",
"render",
+ "build",
+
"ten-frame-tester",
"--codec",
"vp8",
@@ -85,6 +100,8 @@ test("Should fail to render out of range frame when range is a number", async ()
"exec",
"remotion",
"render",
+ "build",
+
"ten-frame-tester",
"--sequence",
"--frames=10",
@@ -108,6 +125,8 @@ test("Should fail to render out of range frame when range is a string", async ()
"exec",
"remotion",
"render",
+ "build",
+
"ten-frame-tester",
"--frames=2-10",
outputPath,
@@ -129,6 +148,7 @@ test("Should render a ProRes video", async () => {
"exec",
"remotion",
"render",
+ "build",
"ten-frame-tester",
"--prores-profile=4444",
out,
@@ -163,7 +183,15 @@ test("Should render a still image if single frame specified", async () => {
const outImg = path.join(outDir, "element-2.png");
const task = await execa(
"pnpm",
- ["exec", "remotion", "render", "ten-frame-tester", "--frames=2", outDir],
+ [
+ "exec",
+ "remotion",
+ "render",
+ "build",
+ "ten-frame-tester",
+ "--frames=2",
+ outDir,
+ ],
{
cwd: path.join(process.cwd(), "..", "example"),
reject: false,
@@ -191,7 +219,7 @@ test("Should be able to render a WAV audio file", async () => {
const out = outputPath.replace("mp4", "wav");
const task = execa(
"pnpm",
- ["exec", "remotion", "render", "audio-testing", out],
+ ["exec", "remotion", "render", "build", "audio-testing", out],
{
cwd: path.join(process.cwd(), "..", "example"),
}
@@ -223,7 +251,7 @@ test("Should be able to render a MP3 audio file", async () => {
const out = outputPath.replace("mp4", "mp3");
const task = execa(
"pnpm",
- ["exec", "remotion", "render", "audio-testing", out],
+ ["exec", "remotion", "render", "build", "audio-testing", out],
{
cwd: path.join(process.cwd(), "..", "example"),
}
@@ -255,7 +283,7 @@ test("Should be able to render a AAC audio file", async () => {
const out = outputPath.replace("mp4", "aac");
const task = execa(
"pnpm",
- ["exec", "remotion", "render", "audio-testing", out],
+ ["exec", "remotion", "render", "build", "audio-testing", out],
{
cwd: path.join(process.cwd(), "..", "example"),
}
@@ -286,7 +314,7 @@ test("Should be able to render a AAC audio file", async () => {
test("Should render a video with GIFs", async () => {
const task = await execa(
"pnpm",
- ["exec", "remotion", "render", "gif", "--frames=0-47", outputPath],
+ ["exec", "remotion", "render", "build", "gif", "--frames=0-47", outputPath],
{
cwd: path.join(process.cwd(), "..", "example"),
}
@@ -315,7 +343,7 @@ test("Should render a video with Offline Audio-context", async () => {
const task = await execa(
"pnpm",
- ["exec", "remotion", "render", "offline-audio-buffer", out],
+ ["exec", "remotion", "render", "build", "offline-audio-buffer", out],
{
cwd: path.join(process.cwd(), "..", "example"),
}
@@ -341,7 +369,7 @@ test("Should succeed to render an audio file that doesn't have any audio inputs"
const out = outputPath.replace(".mp4", ".mp3");
const task = await execa(
"pnpm",
- ["exec", "remotion", "render", "ten-frame-tester", out],
+ ["exec", "remotion", "render", "build", "ten-frame-tester", out],
{
cwd: path.join(process.cwd(), "..", "example"),
}
@@ -369,6 +397,7 @@ test("Should render a still that uses the staticFile() API and should apply prop
"exec",
"remotion",
"still",
+ "build",
"static-demo",
out,
"--log=verbose",
@@ -392,7 +421,7 @@ test("Dynamic duration should work and audio separation", async () => {
"exec",
"remotion",
"render",
- "src/index.ts",
+ "build",
"dynamic-duration",
`--props`,
`{"duration": ${randomDuration}}`,
@@ -467,6 +496,7 @@ test("Should be able to render if remotion.config.ts is not provided", async ()
"packages/cli/remotion-cli.js",
"render",
"packages/example/src/ts-entry.tsx",
+
"framer",
"--public-dir=packages/example/public",
outputPath,
@@ -487,6 +517,7 @@ test("Should be able to render a huge payload that gets serialized", async () =>
"exec",
"remotion",
"still",
+ "build",
"huge-payload",
outputPath.replace(".mp4", ".png"),
],
@@ -502,7 +533,15 @@ test("Should be able to render a huge payload that gets serialized", async () =>
test("If timeout, the error should be shown", async () => {
const task = await execa(
"pnpm",
- ["exec", "remotion", "render", "Timeout", outputPath, "--timeout=7000"],
+ [
+ "exec",
+ "remotion",
+ "render",
+ "build",
+ "Timeout",
+ outputPath,
+ "--timeout=7000",
+ ],
{
cwd: path.join(process.cwd(), "..", "example"),
reject: false,