Skip to content

🎥 Make videos programmatically with React

Merge branch 'esbuild-refactor' into lambda-testing

Jonny Burger78b7a731d54b
diff --cc tests/lambda/lambda-browser-bundle.test.ts
index a58d7b2af6,89a550d7c3..5ffe6a7ff2
--- a/tests/lambda/lambda-browser-bundle.test.ts
+++ b/tests/lambda/lambda-browser-bundle.test.ts
@@@ -14,38 -15,16 +15,38 @@@ test("Should not be able to bundle @rem
).rejects.toThrow(/Could not resolve "pnpapi"/);
});
-test("Should be able to bundle @remotion/lambda/client with ESBuild", async () => {
+describe("Should be able to bundle @remotion/lambda/client with ESBuild", () => {
const outfile = path.join(tmpdir(), "esbuild-test.js");
- const { errors } = await BundlerInternals.esbuild.build({
- platform: "node",
- target: "node14",
- bundle: true,
- logLevel: "silent",
- outfile,
- entryPoints: [require.resolve("@remotion/lambda/client")],
+
+ test("Should build without errors", async () => {
- const { errors } = await esbuild.build({
++ const { errors } = await BundlerInternals.esbuild.build({
+ platform: "node",
+ target: "node14",
+ bundle: true,
+ logLevel: "silent",
+ outfile,
+ entryPoints: [require.resolve("@remotion/lambda/client")],
+ });
+ expect(errors.length).toBe(0);
+ });
+
+ test("Bundle should be below 6MB", async () => {
+ const file = await fs.promises.readFile(outfile, "utf-8");
+ expect(file.length).toBeGreaterThan(10000);
+ expect(file.length).toBeLessThanOrEqual(6000000);
+ });
+
+ test("Bundle should not include core Remotion", async () => {
+ const file = await fs.promises.readFile(outfile, "utf-8");
+ expect(file).not.toContain("AbsoluteFill");
+ });
+
+ test("Bundle should not include Renderer", async () => {
+ const file = await fs.promises.readFile(outfile, "utf-8");
+ expect(file).not.toContain("@remotion/renderer");
+ });
+
+ test("Should be able to delete it", () => {
+ fs.unlinkSync(outfile);
});
- expect(errors.length).toBe(0);
- fs.unlinkSync(outfile);
});