From 11e2f2ca804d7d2d2cf22ece23298be94bc46456 Mon Sep 17 00:00:00 2001 From: naiba Date: Tue, 26 May 2026 05:27:46 +0000 Subject: [PATCH] ci(e2e): make backend stubs embeddable and keep vitest scoped The dashboard embed pattern ignores hidden-only dist directories, so the CI backend stub must create visible index.html files. Keep the README in sync and exclude Playwright specs from Vitest so npm run test remains a unit-test command. Co-authored-by: naiba/CloudCode Co-authored-by: cloudcode --- .github/workflows/e2e.yml | 3 ++- README.md | 3 ++- vitest.config.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b96230c..3a93e47 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -71,7 +71,8 @@ jobs: working-directory: nezha run: | mkdir -p cmd/dashboard/admin-dist cmd/dashboard/user-dist - touch cmd/dashboard/admin-dist/.gitkeep cmd/dashboard/user-dist/.gitkeep + printf 'admin e2e\n' > cmd/dashboard/admin-dist/index.html + printf 'user e2e\n' > cmd/dashboard/user-dist/index.html go install github.com/swaggo/swag/cmd/swag@latest "$(go env GOPATH)/bin/swag" init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs diff --git a/README.md b/README.md index 536b3fd..eddfd3d 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ Then start the backend separately. The shape the CI workflow uses is: ```bash # in a checkout of nezhahq/nezha mkdir -p cmd/dashboard/admin-dist cmd/dashboard/user-dist -touch cmd/dashboard/admin-dist/.gitkeep cmd/dashboard/user-dist/.gitkeep +printf 'admin e2e\n' > cmd/dashboard/admin-dist/index.html +printf 'user e2e\n' > cmd/dashboard/user-dist/index.html go install github.com/swaggo/swag/cmd/swag@latest "$(go env GOPATH)/bin/swag" init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs diff --git a/vitest.config.ts b/vitest.config.ts index 212b7b0..9974b93 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -7,6 +7,7 @@ export default mergeConfig( defineConfig({ test: { environment: "jsdom", + exclude: ["tests/e2e/**", "node_modules/**", "dist/**"], globals: true, setupFiles: ["./src/test/setup.ts"], },