Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into ffmpeg-autoinstall

Jonny Burger4b9ed63b16cb
diff --cc packages/example/src/test/stills.test.ts
index 982a1d53cb,f9c470ff39..dac525ee53
--- a/packages/example/src/test/stills.test.ts
+++ b/packages/example/src/test/stills.test.ts
@@@ -11,74 -11,80 +11,81 @@@ import {TCompMetadata} from 'remotion'
import {expect, test} from 'vitest';
import {webpackOverride} from '../webpack-override';
- test('Can render a still using Node.JS APIs', async () => {
- const bundled = await bundle({
- entryPoint: path.join(process.cwd(), 'src/index.tsx'),
- webpackOverride,
- });
+ test(
+ 'Can render a still using Node.JS APIs',
+ async () => {
+ const bundled = await bundle({
+ entryPoint: path.join(process.cwd(), 'src/index.tsx'),
+ webpackOverride,
+ });
- const compositions = await getCompositions(bundled);
+ const compositions = await getCompositions(bundled);
- const composition = compositions.find(
- (c) => c.id === 'react-svg'
- ) as TCompMetadata;
+ const composition = compositions.find(
+ (c) => c.id === 'react-svg'
+ ) as TCompMetadata;
- const testOut = path.join(tmpdir(), 'path/to/still.png');
+ const testOut = path.join(tmpdir(), 'path/to/still.png');
- const {port, close} = await RenderInternals.serveStatic(bundled, {
- onDownload: () => undefined,
- port: null,
- onError: (err) => {
- throw err;
- },
- ffmpegExecutable: null,
- ffprobeExecutable: null,
- downloadMap: RenderInternals.makeDownloadMap(),
- remotionRoot: process.cwd(),
- });
+ const {port, close} = await RenderInternals.serveStatic(bundled, {
+ onDownload: () => undefined,
+ port: null,
+ onError: (err) => {
+ throw err;
+ },
+ ffmpegExecutable: null,
+ ffprobeExecutable: null,
+ downloadMap: RenderInternals.makeDownloadMap(),
++ remotionRoot: process.cwd(),
+ });
- const serveUrl = `http://localhost:${port}`;
- const fileOSRoot = path.parse(__dirname).root;
+ const serveUrl = `http://localhost:${port}`;
+ const fileOSRoot = path.parse(__dirname).root;
- expect(() =>
- renderStill({
- composition,
- output: testOut,
- serveUrl,
- frame: 500,
- })
- ).rejects.toThrow(
- /Cannot use frame 500: Duration of composition is 300, therefore the highest frame that can be rendered is 299/
- );
+ expect(() =>
+ renderStill({
+ composition,
+ output: testOut,
+ serveUrl,
+ frame: 500,
+ })
+ ).rejects.toThrow(
+ /Cannot use frame 500: Duration of composition is 300, therefore the highest frame that can be rendered is 299/
+ );
- expect(() =>
- renderStill({
- composition,
- output: process.platform === 'win32' ? fileOSRoot : '/var',
- serveUrl,
- })
- ).rejects.toThrow(/already exists, but is not a file/);
+ expect(() =>
+ renderStill({
+ composition,
+ output: process.platform === 'win32' ? fileOSRoot : '/var',
+ serveUrl,
+ })
+ ).rejects.toThrow(/already exists, but is not a file/);
+
+ expect(() =>
+ renderStill({
+ composition,
+ output: 'src/index.tsx',
+ serveUrl,
+ overwrite: false,
+ })
+ ).rejects.toThrow(
+ /Cannot render still - "overwrite" option was set to false, but the output/
+ );
- expect(() =>
- renderStill({
+ await renderStill({
composition,
- output: 'src/index.tsx',
+ output: testOut,
serveUrl,
- overwrite: false,
- })
- ).rejects.toThrow(
- /Cannot render still - "overwrite" option was set to false, but the output/
- );
-
- await renderStill({
- composition,
- output: testOut,
- serveUrl,
- frame: 100,
- });
+ frame: 100,
+ });
- expect(existsSync(testOut)).toBe(true);
- unlinkSync(testOut);
+ expect(existsSync(testOut)).toBe(true);
+ unlinkSync(testOut);
- await close();
- }, 90000);
+ await close();
+ },
+ {
+ retry: 3,
+ timeout: 90000,
+ }
+ );