openobserve/web
Prabhat Sharma 1dbfbcd351 test(editor): fix the flaky CodeQueryEditor specs that dequeued the PR
Nine tests in this file failed about half the time — including on a clean
origin/main worktree, which is why main's own Unit tests workflow has been red
on most recent commits. They took the PR out of the merge queue.

The cause was a mock one function short of the component. setupEditor's promql
branch calls, in order:

  monaco.languages.register({ id: "promql" })
  monaco.languages.setMonarchTokensProvider("promql", ...)
  monaco.languages.setLanguageConfiguration("promql", ...)   <-- not mocked

so the "should support promql language" mount threw mid-setup. The vitest config
sets dangerouslyIgnoreUnhandledErrors, so nothing reported it; what showed
instead was later tests in the file hanging on vi.waitFor(addCommand) and timing
out at 5000ms. Whether they hung depended on how those aborted mounts
interleaved with live ones, which is what made it bimodal: ~52ms or never.

Adding setLanguageConfiguration takes it from roughly one run in two to 8/8
clean, and the full suite passes.

Also replaced the `vi.spyOn(document, "getElementById")` in three describes with
a real <div id="test-editor"> attached to the document. setupEditor retries that
lookup five times on a 100ms timer and then gives up WITHOUT reaching
addCommand, and the spy made "does this mount find its element" depend on mock
lifecycle across three describes while ~50 mounts from earlier describes were
still polling on their own timers. That alone did not fix the flake — measured,
2 of 5 runs still failed — but it removes a whole class of ordering dependency
from a file that had just demonstrated it has one.
2026-08-03 14:28:05 -07:00
..
cypress/e2e
public feat: service discovery (#9469) 2025-12-04 13:58:09 +05:30
scripts chore(editor): delete the PromQL term generator 2026-08-03 12:00:20 -07:00
src test(editor): fix the flaky CodeQueryEditor specs that dequeued the PR 2026-08-03 14:28:05 -07:00
test-results fix: logs correlation UI fixes (#9703) 2025-12-23 17:21:16 +05:30
tests/unit fix: remove quasar leftovers (#13180) 2026-07-14 11:35:46 +00:00
.gitignore fix: Data sources tab for AI integration (#12478) 2026-06-16 10:06:46 +00:00
.nvmrc build(web): add CI-parity verify script and pin Node version (#13393) 2026-07-23 06:21:39 +00:00
.prettierignore build: FE code format check for improved maintainability (#13351) 2026-07-24 07:11:39 +00:00
.prettierrc.json build: FE code format check for improved maintainability (#13351) 2026-07-24 07:11:39 +00:00
.stylelintrc.json refactor: design token migration + CI guards (#13173) 2026-07-20 18:06:21 +00:00
AGENTS.md feat: per-group and per-series alerting, and SLO measurement (#13547) 2026-07-31 07:23:22 +00:00
README.md
coverage.sh fix: Trace Details UI improvements (#10550) 2026-02-18 20:25:32 +05:30
cypress.config.ts chore: update copyright year to 2026 (#11166) 2026-04-07 09:57:53 +08:00
env.d.ts feat: ux improvement main (#11838) 2026-05-28 11:00:49 +00:00
eslint.config.js build: FE code format check for improved maintainability (#13351) 2026-07-24 07:11:39 +00:00
eslint.sh
index.html fix: change primary buttons text (#9189) 2025-11-21 11:02:46 +05:30
package-lock.json refactor(editor): drop the second editor runtime the PromQL grammar dragged in 2026-08-03 12:00:20 -07:00
package.json refactor(editor): drop the second editor runtime the PromQL grammar dragged in 2026-08-03 12:00:20 -07:00
postcss.config.js fix: Patterns UI change (#11711) 2026-05-11 07:09:10 +00:00
run_all.sh feat: simplify service discovery feature (#10946) 2026-03-30 13:47:40 +05:30
sbom.json chore: regenerate SBOMs (2026-07-20) (#13280) 2026-07-21 09:57:26 +08:00
serve.json fix: csp unsafe-eval fixes (#3118) 2024-04-03 12:49:25 +05:30
tsconfig.app.json build: add UI code quality checks and enhance linting processe (#13174) 2026-07-21 12:47:06 +00:00
tsconfig.config.json feat: Revamp metrics explorer (#13144) 2026-07-14 07:50:56 +00:00
tsconfig.json fix: automate update process of feature master list on about us page (#10010) 2026-01-17 18:06:23 +05:30
tsconfig.node.json fix: minor and patch version upgrade (#9741) 2025-12-25 15:51:10 +05:30
tsconfig.vitest.json feat: Revamp metrics explorer (#13144) 2026-07-14 07:50:56 +00:00
tsconfig.vitest.tsbuildinfo feat: Revamp metrics explorer (#13144) 2026-07-14 07:50:56 +00:00
vite.config.ts fix(editor): restore monaco's contributions, and the PromQL e2e that caught it 2026-08-03 12:00:21 -07:00
vitest.chat-history.config.ts feat: Ai metering for cloud (#10824) 2026-03-13 00:57:31 +05:30
vitest.config.ts fix: remove quasar leftovers (#13180) 2026-07-14 11:35:46 +00:00

README.md

web

This template should help get you started developing with Vue 3 in Vite.

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

For stand-alone UI development environment, create .env file and which contains below environment variable

VITE_OPENOBSERVE_ENDPOINT=http://localhost:5080/
npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Run End-to-End Tests with Cypress

npm run test:e2e:dev

This runs the end-to-end tests against the Vite development server. It is much faster than the production build.

But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):

npm run build
npm run test:e2e

Lint with ESLint

npm run lint