Skip to content

Vitest upgrade#113

Open
dotnetprofessional wants to merge 148 commits intomasterfrom
vitest-upgrade
Open

Vitest upgrade#113
dotnetprofessional wants to merge 148 commits intomasterfrom
vitest-upgrade

Conversation

@dotnetprofessional
Copy link
Copy Markdown
Owner

Complete rewrite of the mocha version to vitest, also added xunit implementation + a viewer

garrm added 30 commits December 5, 2025 09:46
… with mocha. Currently doesn't support native describe/it in tracking. Tests are all passing.

Add LiveDoc xUnit framework for BDD-style testing

- Implemented ShoppingCart and CartItem classes for sample usage.
- Created custom attributes: ExampleAttribute, FeatureAttribute, ScenarioAttribute, and ScenarioOutlineAttribute for defining BDD scenarios.
- Developed discoverers for custom attributes to integrate with xUnit's test framework.
- Introduced LiveDocContext to manage test execution and output formatting.
- Added formatter for BDD-style output, including features, scenarios, and step results.
- Established base class LiveDocTest for writing tests with Given/When/Then syntax.
- Implemented support for example data in scenario outlines.
* All tests are ported and pass
* Native vitest tests not supported in reporting

livedoc-reporter
* A BDD style Living Documentation platform
* Early/Rough site
* Supported sockets for real-time updates
- Remove Lerna 2.0.0-beta.38, switch to pnpm workspaces
- Archive livedoc-mocha to _archive/ (deprecated in favor of Vitest)
- Archive livedoc-emoji-reporter to _archive/ (custom reporter example)
- Archive old Mocha-era README to _archive/docs/
- Delete empty livedoc placeholder package
- Move livedoc-sample to examples/vitest-sample (updated for Vitest)
- Create pnpm-workspace.yaml for workspace configuration
- Create tsconfig.base.json for shared TypeScript config
- Update root package.json with pnpm scripts
- Create new README.md focused on Vitest
- Fix livedoc-vscode broken file dependency

All 489 livedoc-vitest tests pass.
Phase 1 & 2 Migration:
- Replace Lerna with pnpm workspaces (pnpm-workspace.yaml)
- Add shared TypeScript config (tsconfig.base.json)
- Archive deprecated packages to _archive/ (livedoc-mocha, livedoc-emoji-reporter)

Package restructuring:
- Rename livedoc-vitest -> packages/vitest (@livedoc/vitest)
- Rename livedoc-viewer -> packages/viewer (@livedoc/viewer)
- Rename livedoc-vscode -> packages/vscode (@livedoc/vscode)
- Move livedoc-xunit -> dotnet/xunit
- Move livedoc-sample -> examples/vitest-sample (updated for Vitest)

Fixes:
- Add missing dependencies (strip-ansi, @vitest/runner) for pnpm strict mode
- Update VS Code settings to fix rg.exe symlink issues (search.followSymlinks: false)
- Add pnpm-specific entries to .gitignore

All 489 tests pass.
- Create examples/custom-reporter/ with Emoji Reporter demo
  - Shows how to implement a custom Vitest reporter
  - Includes sample BDD tests and README with usage instructions

- Update VS Code extension README (@livedoc/vscode)
  - Add comprehensive local development instructions
  - Document debug and packaging workflow
  - Update for Vitest-only support

- Update vitest package README (@livedoc/vitest)
  - Change all references from livedoc-vitest to @livedoc/vitest
  - Fix reporter import examples
  - Add links to related packages

- Update MIGRATION_PLAN.md
  - Add completion status section at top
  - Mark all Phase 1-3 tasks as complete
  - Document final project structure

Phase 3 complete. Migration from Lerna to pnpm workspaces finished.
fixed incompat code for extension
added debug settings for easy debugging
- Convert global singletons to per-feature Maps for proper isolation:
  - afterBackgroundFnMap: Map<Feature, Function>
  - backgroundStepsMap: Map<Feature, Array<{func, stepDefinition}>>
  - backgroundItExecutedMap: Map<Feature, boolean>
- Fix ScenarioOutline parent path (example.parent is the Feature directly)
- Add vitest.config.ts for VS Code Vitest explorer compatibility
- Add isolation test: Background_afterBackground_isolation.Spec.ts

This fixes a bug where multiple features in the same file would share
background state, causing afterBackground cleanup to only run for the
last registered feature.
- Create new @livedoc/server package with standalone REST API
- Move store, schema, and websocket modules from viewer to server
- Add comprehensive BDD tests for server API (98 tests)
  - Health and discovery endpoints
  - Run management (start, get, delete)
  - BDD data streaming (features, scenarios, steps)
  - Batch mode for CI/CD integration
- Viewer now imports from @livedoc/server
- Server supports both programmatic and CLI usage
- Change step exports to lowercase: given, when, and, but
- Keep Then uppercase due to ESM thenable detection issue (exporting
  'then' causes Node.js to treat module as Promise during dynamic import)
- Register lowercase 'then' via globalThis for globals mode
- Use import aliasing pattern: import { Then as then } for direct imports
- Update dynamic test template imports in executeDynamicTestAsync
- Update all test files to use Then as then aliasing pattern
- Update expected uniqueId hashes in Suites_and_Steps_have_uniqueIds.Spec.ts

This provides idiomatic lowercase JavaScript while working around the
ESM thenable quirk where modules with a 'then' export are treated as
thenables by Node.js during await import().
- Added Specification class to serve as a top-level container for the Specification pattern.
- Introduced Rule and RuleOutline classes for defining simple assertions and data-driven rules respectively.
- Enhanced ExecutionResults to include specifications alongside features and suites.
- Implemented context objects for accessing metadata within rules and specifications.
- Developed parser methods to create specifications and rules from test modules.
- Added detailed reporting for specifications, including execution summaries and individual rule statuses.
- Created comprehensive tests for the Specification pattern, covering various scenarios and error handling.
- Switch @livedoc/vitest build to use tsup for proper CJS/ESM bundling
- Add examples/local-consumer to verify packaged tarball installation
- Fix API usage in examples/vitest-sample
- Update spec-files instructions with pattern guidance
- Update pnpm-lock.yaml
- Introduced a new build-reporter.js script for building the reporter using esbuild.
- Updated package.json to include configuration options for the LiveDoc server.
- Enhanced ExecutionResultOutlineProvider to fetch data from the LiveDoc server.
- Implemented auto-refresh functionality for the tree view based on server events.
- Improved error handling and user feedback in the ReporterWebView.
- Updated various components to use the new @livedoc/vitest model.
- Added support for local and remote server configurations.
- Enhanced tree view item display with loading indicators and feature counts.
- Flattened tree structure for better organization of test results.
- Updated pnpm-lock.yaml to reflect new dependencies and workspace links.
Added docs for vitest
- Modify launch.json to use livedoc.vitest.ts for Vitest runs.
- Enhance server feature creation by adding optional path property.
- Update schema to include path for features and post requests.
- Refactor Breadcrumb, GroupView, and SummaryView components to format group display names.
- Improve LiveDocServerReporter to handle file paths and group features more effectively.
- Update LiveDocViewerReporter to include path context for features and specifications.
- Add new scenarios to Validate_step_rules.Spec.ts to test rule violations.
- Adjust Specification.Spec.ts to improve rule outline examples.
- Update livedoc.vitest.ts to reflect the correct configuration usage.
…c integration

- Moved scenario grouping logic to a new utility file `gherkin-utils.ts` for better organization and reusability.
- Updated `FeatureView`, `ScenarioOutlineView`, and `ScenarioView` components to utilize the new grouping function.
- Enhanced title rendering in `ScenarioOutlineCard` and `ScenarioView` to highlight example values.
- Improved `StepList` and `StepItem` components to support highlighting of example values in step titles.
- Added materialization of placeholders in `livedoc.ts` for better scenario title representation.
- Updated reporters (`LiveDocReporter`, `LiveDocServerReporter`, `LiveDocSpecReporter`, and `LiveDocViewerReporter`) to handle new title formats and example values.
…x for improved readability and data handling
docs(vitest): mark IMPLEMENTATION_STATUS.md and backlog.md as deprecated, reference new vitest-brd.md

feat(vitest): add PublishOptions class and integrate publishing options into LiveDocOptions

feat(vitest): enhance LiveDocSpecReporter to support publishing options and connect to LiveDoc Viewer

feat(vitest): implement LiveDocViewerReporter for posting results to the LiveDoc server

chore(vitest): add new vitest-brd.md for comprehensive feature tracking and documentation

chore(vitest): add test:publish script to package.json for running publish tests

chore(vitest): create vitest.config.publish.ts for configuring publish-specific tests

chore(vscode): mark BACKLOG.md as deprecated, reference new vscode-brd.md

chore(vscode): create vscode-brd.md for updated feature tracking of the VS Code extension

chore(deps): update pnpm-lock.yaml with new dependencies and versions

fix(scripts): change default port in start-viewer.ps1 to avoid conflicts
- Changed default port from 3000 to 3100 in CLI options.
- Updated server discovery logic to handle new port configuration.
- Enhanced step and scenario components to include optional descriptions.
- Improved placeholder highlighting in step titles and descriptions.
- Fixed bugs related to background rendering and step descriptions.
- Updated VS Code extension to reflect new default port.
- Adjusted PowerShell scripts for starting the LiveDoc server and viewer.
- Added a test discovery script for server information retrieval.
…ture

- Introduced a comprehensive plan outlining the transition to the vNext Data Model.
- Defined core objectives including unified protocol, UI-ready data, and stability.
- Structured the implementation into five phases: Foundation, Server Evolution, SDK Mapping, Viewer Redesign, and VS Code Extension Integration.
- Established success criteria to measure the effectiveness of the implementation.
…for documents

feat(store): introduce audience mode and filter functionality in state management

fix(reporter): enhance LiveDocServerReporter and LiveDocSpecReporter to parse titles and tags correctly

test(reporter): add tests for tag parsing and node path inclusion in viewer reporter

chore(vscode): update VSIX package for latest changes
- Added fetchRunById function to retrieve run details by ID in useWebSocket hook.
- Updated fetchProjectHierarchy and runs fetching to use 'no-store' cache policy.
- Refactored run completion handling to utilize fetchRunById for better error handling.
- Improved LiveDocServerReporter to support streaming updates and manage task states.
- Enhanced LiveDocSpecReporter to stream task updates and avoid duplicate prints.
- Updated LiveDocViewerReporter to support starting run sessions and posting results.
- Added rule violation tracking in LiveDoc reporting for better error visibility.
- New xUnit CI/CD guide with journey test cross-platform gotchas,
  build config matching, and GitHub Pages deployment
- Vitest CI/CD guide: added allowOnly, fileParallelism, and
  dynamic test CI-specific configuration section
- Viewer CI/CD guide: added GitHub Pages static report deployment
  with environment setup instructions
- All guides include troubleshooting tables from real CI debugging

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All three guides (vitest, xUnit, viewer) now follow the same
clear pattern: run tests → export HTML → copy to destination.

Removed overengineered content (REST API polling, health checks,
viewer-as-a-service). Kept genuine CI gotchas (allowOnly,
fileParallelism, build config mismatch, cross-platform httpyac).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- xUnit: use logger parameter (ExportPath) not env var
- Package name: @swedevtools/livedoc-viewer (not livedoc-viewer)
- Remove duplicated CI examples (now in per-SDK CI/CD guides)
- Add 'Run in progress' fix to troubleshooting
- Link to CI/CD guides for full pipeline examples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… and RunProgressBanner fix

- Add Playwright integration module (useBrowser, screenshot helpers, CI config)
- Add Playwright integration tests against the LiveDoc Viewer
- Add vitest AI skill installer CLI (npx livedoc-vitest-setup) mirroring xUnit UX
- Add AI skill setup docs for vitest and update getting-started for both SDKs
- Restructure skill files to hub-and-spoke progressive disclosure pattern:
  - SKILL.md is a ~200-line router with version check and resource pointers
  - Detailed content lives in resources/*.md (bdd-features, specifications,
    playwright, reporter-config) loaded on-demand to minimize context waste
  - Both vitest and xUnit follow the same pattern with sdk_version metadata
- Sync skill files between .github/skills/ and package tool dirs
- Fix RunProgressBanner bug: force-derive terminal status when run:v1:completed
  fires but server still returns status 'running'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Exclude Playwright tests from vitest.config.ci.ts (they require a running
  viewer and installed browser binaries not available in CI)
- Add live test result links to README, docs homepage, CI/CD guide, and
  viewer getting-started page pointing to
  https://dotnetprofessional.github.io/LiveDoc/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add 'Install Playwright browsers' step (chromium --with-deps) to CI workflow
- Add 'Start viewer for Playwright tests' step with health-check wait loop
- Remove Playwright exclusion from vitest.config.ci.ts — tests run in CI now
- Expand Playwright docs guide with comprehensive CI setup (3-step walkthrough,
  complete GitHub Actions example, headed vs headless tip)
- Add Playwright troubleshooting row to CI/CD guide

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
npx can't find playwright in a pnpm workspace — use pnpm exec with
working-directory to resolve from the correct package.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnetprofessional and others added 2 commits April 4, 2026 23:32
- @swedevtools/livedoc-schema: 1.0.0 → 1.1.0
- @swedevtools/livedoc-vitest: 0.1.6 → 0.1.7
- @swedevtools/livedoc-viewer: 0.0.8 → 0.0.9
- @swedevtools/livedoc-server: 1.0.0 → 1.1.0
- livedoc-vscode: 0.0.1 → 0.0.2
- SweDevTools.LiveDoc.xUnit: 0.1.8-beta4 → 0.1.8-beta5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Playwright browser install and viewer startup to livedoc-report.yml
  (same as ci.yml) so Playwright tests pass in the report generation workflow
- Add 'if: always()' to .NET test step so it runs even if vitest step fails

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnetprofessional and others added 2 commits April 4, 2026 23:53
Adds hotkey 'u' that finds the latest viewer .tgz in releases/
and installs it globally via npm install -g.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- calculateOverallStatus no longer returns 'running' when pending/skipped tests exist
- Add safety net in useStaticData to force-derive terminal status for static exports
- Static data always represents a completed run, so 'running' status is never valid

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
URL hash syncs with navigation state for shareable links:
- Feature links: #/feature-slug
- Scenario links: #/feature-slug/scenario-slug
- Group links: #/group/path
- Browser back/forward navigation supported
- Deferred resolution for async data loading (WebSocket mode)
- Skipped in embedded mode (VS Code controls navigation)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ExportConfig only captured output path, dropping project/environment from
the vitest reporter config. Now properly flows through to the TestRunV1 JSON.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnetprofessional and others added 2 commits April 5, 2026 10:11
Adds scripts/sync-skill-versions.ps1 that reads version from
package.json (vitest) and .csproj (xunit), then updates the
bundled SKILL.md files. Called automatically in Run-Build before
the pack steps.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses user feedback about Journey testing friction:

1. Code: JourneyFixtureBase now logs startup banner (port, URL, env) to
   stderr and includes UseUrls() troubleshooting hints in error messages.
   New Verbose config option enables full server output streaming.

2. Docs: Added prominent caution block about ASPNETCORE_URLS vs UseUrls()
   precedence with two concrete fixes (env gate and --urls flag).

3. Troubleshooting: Expanded table with server startup failure scenarios
   (port conflict, connection refused, timeout, no diagnostics).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the selected item's description from inline (below each item) to a
fixed position at the bottom. Eliminates layout reflow when navigating
between items of different description lengths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants