Skip to content

Use Vitest for library schematics tests#24788

Merged
sumeyyeKurtulus merged 1 commit intodevfrom
feat/migrate-libs-vitest-on-schematics
Feb 3, 2026
Merged

Use Vitest for library schematics tests#24788
sumeyyeKurtulus merged 1 commit intodevfrom
feat/migrate-libs-vitest-on-schematics

Conversation

@fahrigedik
Copy link
Member

Description

Migrate library schematic test setup from Karma/Jasmine to Vitest and Angular standalone testing. Removed Karma config and legacy test.ts templates, added src/test-setup.ts templates that initialize Angular testing with zone.js/testing and BrowserTestingModule. Updated tsconfig.lib.json to exclude src/test-setup.ts and tsconfig.spec.json to use "vitest/globals" types and simplified include/files. Adjusted generate-lib to use a UnitTest builder with a vitest runner and buildTarget instead of Karma-specific options, and added UnitTest to Builders enum.

Resolves #24714 (write the related issue number if available)

How to test it?

How to test it?

  1. Build the schematics package:

    • Go to abp/npm/ng-packs
    • Run:
      npm run build:schematics
  2. Link the built schematics package locally:

    • Go to abp/npm/ng-packs/dist/packages/schematics
    • Run:
      npm link
  3. Link @abp/ng.schematics into the template project:

    • Go to volo/abp/templates/module/angular
    • Run:
      npm link @abp/ng.schematics
  4. Run the generator:

    • Still in volo/abp/templates/module/angular, run:
      ng generate @abp/ng.schematics:create-lib
  5. When prompted, use the following options:

    • Package name: test-full-lib
    • Is secondary entrypoint: No (false)
    • Template type: standalone
  6. Run the tests:

    • In volo/abp/templates/module/angular, run:
      yarn test

Migrate library schematic test setup from Karma/Jasmine to Vitest and Angular standalone testing. Removed Karma config and legacy test.ts templates, added src/test-setup.ts templates that initialize Angular testing with zone.js/testing and BrowserTestingModule. Updated tsconfig.lib.json to exclude src/test-setup.ts and tsconfig.spec.json to use "vitest/globals" types and simplified include/files. Adjusted generate-lib to use a UnitTest builder with a vitest runner and buildTarget instead of Karma-specific options, and added UnitTest to Builders enum.
@fahrigedik fahrigedik added this to the 10.2-preview milestone Feb 2, 2026
@fahrigedik fahrigedik requested review from Copilot and sumeyyeKurtulus and removed request for Copilot February 2, 2026 18:49
@sumeyyeKurtulus sumeyyeKurtulus merged commit a0bec19 into dev Feb 3, 2026
8 checks passed
@sumeyyeKurtulus sumeyyeKurtulus deleted the feat/migrate-libs-vitest-on-schematics branch February 3, 2026 06:12
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.

Migrate ABP templates to Vitest as the default testing framework

2 participants