Skip to content

Conversation

@fredvisser
Copy link
Contributor

Pull Request

🤨 Rationale

  • Research alternatives to karma #2698
  • Replaces Karma/Webpack/Jasmine with the Vitest browser runner so @ni/nimble-components tests execute faster, in more browsers, and with better tooling.
  • Modernizes the infrastructure to improve cross-platform development, the debug experience, etc.

👩‍💻 Implementation

  • Added the Vitest + Playwright toolchain, created vitest.config.ts, and wired up scripts for Chromium, Firefox, WebKit, coverage, and UI mode.
  • Ported the global Jasmine configuration to Vitest (setup-vitest.ts, async utilities, spy helpers, fake timers, etc.).
  • Migrated the entire nimble-components spec suite to Vitest expectations (spies, matchers, timers, custom helpers) and converted all components.
  • Ensured cross-browser parity by enabling @vitest/browser overrides, npm run test:vitest:firefox, and npm run test:vitest:webkit, then fixing the failing cases across the suite.
  • Updated CI pipelines to install Playwright browsers and run Vitest, removed Karma/Webpack/Jasmine dependencies and config files, renamed test:vitesttest, refreshed documentation, and generated the beachball change file.

🧪 Testing

  • npm run test
  • npm run test:vitest:firefox
  • npm run test:vitest:webkit
  • npm run test:vitest:coverage
  • npm run test:vitest:ui
  • Updated CI workflow (Playwright install + npm run test)
  • npm run lint

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@@ -0,0 +1,31 @@
# mac-test-reliability-fixes Development Guidelines
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning to remove all of the .github, .specify, and .vscode changes - so please ignore

This ensures that when Vitest is invoked via npm workspaces from the monorepo root, all file paths are resolved relative to the package directory instead of the monorepo root, preventing absolute filesystem URLs in the Vite dev server.
- Add 60s browser launch timeout to playwright provider
- Add hookTimeout configuration for better error handling
- Enable server warmup for test files to reduce connection failures
- Disable slowHijackESM to reduce iframe connection issues
- Add GitHub Actions artifact upload for Vitest failure screenshots
@@ -0,0 +1,31 @@
# mac-test-reliability-fixes Development Guidelines

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not planning to review this PR any time soon since it's enormous and the outcome isn't high priority, but please let me know if you think it should be.

- Add 30 minute timeout to build job to prevent hung tests
- Set base path to './' to fix absolute filesystem URLs in CI
- Allow parent directory access for node_modules resolution
Analysis shows we've been going in circles with path configurations.
Created vitest-ci-debugging-history.md to track all attempted fixes.

New approach:
- Remove 'base' config entirely - let Vite auto-detect
- Disable HMR in CI to prevent module resolution issues
- Keep process.chdir() for working directory consistency

This is a different angle - HMR can cause issues with module
resolution in headless browser environments.
Previous attempt with base: './' and no base both failed.
Testing if explicit base: '/' helps Vite construct proper URLs.

Updated debugging history with Attempt 8 and 9.
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.

3 participants