Skip to content

Migrate tests from Karma to Vite + Vitest - #199

Open
v-aidaba wants to merge 1 commit into
microsoft:mainfrom
v-aidaba:test/migrate-karma-to-vitest
Open

Migrate tests from Karma to Vite + Vitest#199
v-aidaba wants to merge 1 commit into
microsoft:mainfrom
v-aidaba:test/migrate-karma-to-vitest

Conversation

@v-aidaba

@v-aidaba v-aidaba commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Karma and its Webpack test bundle are replaced by Vitest running in browser
mode on Playwright/Chromium, so the specs execute in a real browser without a
second build pipeline.

Testing

  • Add vitest.config.mts and specs/tsconfig.json; delete karma.conf.ts and
    test.webpack.config.js
  • Stub powerbi-visuals-api in specs/powerbiApiStub.ts so the ambient const
    enums survive the esbuild transform, and fail loudly on unstubbed members
  • Replace Jasmine done callbacks with async/await built on the new
    TestWrapper.render() helper
  • Swap Istanbul coverage for V8 coverage
  • Remove obsolete specs for per-metric stale data settings, which the
    formatting model no longer supports

Scripts

  • Add test:watch, test:coverage and test:typecheck
  • Type check the specs before every test run
  • Download Chromium from a dedicated browsers script (browsers:ci adds the
    Linux system packages) instead of a pretest hook, so test runs stay
    offline-friendly

CI

  • Provision the browser in its own workflow step before running the tests
  • Scope the audit to shipped dependencies (npm audit --audit-level=high
    --omit=dev)
  • Update the GitHub actions to v6

Dependencies

  • Drop the direct @typescript-eslint/parser and @typescript-eslint/eslint-plugin
    entries, which typescript-eslint already provides
  • Move linting packages to devDependencies and drop the unused
    regenerator-runtime
  • Update ESLint to v10, powerbi-visuals-tools to 7.2.1, powerbi-visuals-api to
    5.11.1 and the visual utils to their 7.x releases

No production code changed. Verified with lint, package, npm audit --omit=dev
and test:coverage (63/63 passing).

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.

1 participant