rfellows opened a new pull request, #11087:
URL: https://github.com/apache/nifi/pull/11087

   # [NIFI-15706](https://issues.apache.org/jira/browse/NIFI-15706): Migrate 
NiFi frontend tests from Jest to Vitest
   
   ## Description
   
   Migrates the NiFi frontend monorepo (`nifi-frontend/src/main/frontend/`) 
from **Jest** to **Vitest**, using **`@analogjs/vitest-angular`** and 
**`happy-dom`**. The goal is a single, Nx-friendly test stack aligned with 
current Angular/Vitest ecosystem practice, cleaner configuration, and stable 
tests under the new runner.
   
   ## What's Changed
   
   ### Framework and Projects
   - Replaced Jest with Vitest across all **6** Nx frontend projects: `nifi`, 
`nifi-registry`, `standard-content-viewer`, `shared`, `update-attribute`, 
`nifi-jolt-transform-ui`
   - Removed Jest-specific setup (`jest.config.ts`, `jest.preset.js`, 
`setup-jest.ts`) in favor of `vitest.config.mts` per project and shared 
workspace defaults
   
   ### Configuration
   - Added **`vitest.shared.mts`** for shared Vitest/Angular test configuration
   - Added per-project **`vitest.config.mts`** files
   - Updated **`tsconfig.spec.json`** files for Vitest/Analog compatibility
   - Updated **`project.json`** test targets and **`nx.json`** for the new 
runner
   
   ### Dependencies
   - Removed Jest-related packages
   - Added Vitest stack (`vitest`, `@analogjs/vitest-angular`, `happy-dom`, 
etc.)
   
   ### Test Code (Mechanical + Behavioral)
   - Mechanical API renames: `jest.fn` → `vi.fn`, `jest.spyOn` → `vi.spyOn`, 
etc.
   - Converted `done()`-style async tests to Promises / async patterns
   - Fixed constructor / mock patterns that behaved differently under Vitest
   
   ### Test Quality Fixes
   - Addressed **~367 uncaught NgRx selector exceptions** by supplying correct 
mock store state
   - Fixed **standalone component** test setup (declarations vs imports)
   - Resolved **`ExpressionChangedAfterItHasBeenCheckedError`** in tests
   - Added missing **providers** where the new test environment surfaced DI gaps
   
   ### Build and Tooling
   - Updated **`pom.xml`** with Vitest-appropriate CLI arguments
   - Updated **`eslint.config.mjs`** for Vitest globals
   - Updated **`.gitignore`** for project-level `node_modules` (Vitest cache)
   - Coverage reporters trimmed to **Cobertura only**
   
   ## Verification
   
   - **335** test files, **1,777** tests: **0 failures, 0 errors, 0 warnings** 
across all 6 projects
   - **Lint** passes cleanly across all projects
   
   ## Key Technical Notes
   
   - `vitest.shared.mts` centralizes common options; each app/lib extends via 
its own `vitest.config.mts`
   - NgRx selector exception fixes are intentional — Vitest + stricter change 
detection exposes tests that never had enough mock store state for selectors to 
run safely
   - Maven POM changes keep `npm`/`npx` test invocation consistent with 
Vitest's CLI
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to