Skip to content

🎥 Make videos programmatically with React

await test and don't write file

Jonny Burgerc330c04fc7d3
diff --git a/packages/example/src/test/stills.test.ts b/packages/example/src/test/stills.test.ts
index 94ce75a075..f6a12795d9 100644
--- a/packages/example/src/test/stills.test.ts
+++ b/packages/example/src/test/stills.test.ts
@@ -26,7 +26,8 @@ test(
(c) => c.id === 'react-svg'
) as TCompMetadata;
- const testOut = path.join(tmpdir(), 'path/to/still.png');
+ const folder = path.join(tmpdir(), 'path/to');
+ const testOut = path.join(folder, 'still.png');
const downloadMap = RenderInternals.makeDownloadMap();
const {port, close} = await RenderInternals.serveStatic(bundled, {
@@ -44,7 +45,7 @@ test(
const serveUrl = `http://localhost:${port}`;
const fileOSRoot = path.parse(__dirname).root;
- expect(() =>
+ await expect(() =>
renderStill({
composition,
output: testOut,
@@ -55,7 +56,9 @@ test(
/Cannot use frame 500: Duration of composition is 300, therefore the highest frame that can be rendered is 299/
);
- expect(() =>
+ RenderInternals.deleteDirectory(folder);
+
+ await expect(() =>
renderStill({
composition,
output: process.platform === 'win32' ? fileOSRoot : '/var',
@@ -63,7 +66,7 @@ test(
})
).rejects.toThrow(/already exists, but is not a file/);
- expect(() =>
+ await expect(() =>
renderStill({
composition,
output: 'src/index.ts',