🧪 Add Vitest testing framework with basic composition test

Set up testing infrastructure using Vitest and React Testing Library.
Add test verifying empty MyComposition renders without errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
HolgerHatGarKeineNode
2026-01-24 12:48:10 +01:00
parent 4022fbde83
commit b7740a9750
6 changed files with 2680 additions and 4 deletions

2644
videos/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -20,18 +20,25 @@
}, },
"devDependencies": { "devDependencies": {
"@remotion/eslint-config-flat": "4.0.409", "@remotion/eslint-config-flat": "4.0.409",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/react": "19.2.7", "@types/react": "19.2.7",
"@types/three": "^0.182.0", "@types/three": "^0.182.0",
"@types/web": "0.0.166", "@types/web": "0.0.166",
"@vitejs/plugin-react": "^5.1.2",
"eslint": "9.19.0", "eslint": "9.19.0",
"jsdom": "^27.4.0",
"prettier": "3.6.0", "prettier": "3.6.0",
"typescript": "5.9.3" "typescript": "5.9.3",
"vitest": "^4.0.18"
}, },
"scripts": { "scripts": {
"dev": "remotion studio", "dev": "remotion studio",
"build": "remotion bundle", "build": "remotion bundle",
"upgrade": "remotion upgrade", "upgrade": "remotion upgrade",
"lint": "eslint src && tsc" "lint": "eslint src && tsc",
"test": "vitest run",
"test:watch": "vitest"
}, },
"sideEffects": [ "sideEffects": [
"*.css" "*.css"

View File

@@ -0,0 +1,15 @@
import { describe, it, expect } from "vitest";
import { render } from "@testing-library/react";
import { MyComposition } from "./Composition";
describe("MyComposition", () => {
it("renders without errors", () => {
const { container } = render(<MyComposition />);
expect(container).toBeInTheDocument();
});
it("returns null (empty composition)", () => {
const { container } = render(<MyComposition />);
expect(container.firstChild).toBeNull();
});
});

1
videos/src/test/setup.ts Normal file
View File

@@ -0,0 +1 @@
import "@testing-library/jest-dom/vitest";

View File

@@ -11,5 +11,5 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noUnusedLocals": true "noUnusedLocals": true
}, },
"exclude": ["remotion.config.ts"] "exclude": ["remotion.config.ts", "vitest.config.ts"]
} }

11
videos/vitest.config.ts Normal file
View File

@@ -0,0 +1,11 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
test: {
environment: "jsdom",
setupFiles: ["./src/test/setup.ts"],
include: ["src/**/*.test.{ts,tsx}"],
},
});