Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Run vitest during frontend build (#9022)

Jonathanbe015a543485
diff --git a/Makefile b/Makefile
index 2e452c5cc0..ecf101f1d5 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ help:
@echo "update-config-docstring Update the app's config docstring so mkdocs can autogenerate it correctly."
@echo "frontend-install Install the pnpm modules needed for the frontend"
@echo "frontend-build Build the frontend for localhost:9090"
+ @echo "frontend-test Run the frontend test suite once"
@echo "frontend-dev Run the frontend in developer mode on localhost:5173"
@echo "frontend-typegen Generate types for the frontend from the OpenAPI schema"
@echo "frontend-lint Run frontend checks and fixable lint/format steps"
@@ -57,6 +58,10 @@ frontend-install:
frontend-build:
cd invokeai/frontend/web && pnpm build
+# Run the frontend test suite once
+frontend-test:
+ cd invokeai/frontend/web && pnpm run test:run
+
# Run the frontend in dev mode
frontend-dev:
cd invokeai/frontend/web && pnpm dev
diff --git a/invokeai/frontend/web/package.json b/invokeai/frontend/web/package.json
index da4e31142f..e9a896f1b4 100644
--- a/invokeai/frontend/web/package.json
+++ b/invokeai/frontend/web/package.json
@@ -21,7 +21,7 @@
"scripts": {
"dev": "vite dev",
"dev:host": "vite dev --host",
- "build": "pnpm run lint && vite build",
+ "build": "pnpm run lint && vitest run && vite build",
"typegen": "node scripts/typegen.js",
"preview": "vite preview",
"lint:knip": "knip --tags=-knipignore",
@@ -35,6 +35,7 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"test": "vitest",
+ "test:run": "vitest run",
"test:ui": "vitest --coverage --ui",
"test:no-watch": "vitest --no-watch"
},
diff --git a/invokeai/frontend/web/vite.config.mts b/invokeai/frontend/web/vite.config.mts
index d15c35d6bc..b3afe5fdeb 100644
--- a/invokeai/frontend/web/vite.config.mts
+++ b/invokeai/frontend/web/vite.config.mts
@@ -39,6 +39,7 @@ export default defineConfig(({ mode }) => {
host: '0.0.0.0',
},
test: {
+ reporters: [['default', { summary: false }]],
typecheck: {
enabled: true,
ignoreSourceErrors: true,