|
| 1 | +--- |
| 2 | +name: igniteui-angular-testing |
| 3 | +description: "Quick-reference for running Ignite UI for Angular test suites. Covers the full test run (`test:lib`), grid-specific suites (grid, tree-grid, hierarchical-grid, pivot-grid), non-grid tests, watch mode, and auxiliary test suites (schematics, styles, i18n). Use when an agent needs to run, select, or understand the test infrastructure. Do NOT use for building — use igniteui-angular-build instead. Do NOT use for linting — use igniteui-angular-linting instead." |
| 4 | +user-invocable: true |
| 5 | +--- |
| 6 | + |
| 7 | +# Ignite UI for Angular — Testing |
| 8 | + |
| 9 | +Quick-reference card for the core test commands for the main igniteui-angular library plus schematics, styles, and i18n suites. |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +- Run `npm install` at the repo root. |
| 14 | +- Schematics tests normally run from source and do not require a build first. Only run `npm run build:schematics` and `npm run build:migrations` when you specifically want to validate the compiled schematics or migrations output. |
| 15 | +- For performance tests: run `npm run build:lib` first, or at minimum `npm run build:styles`, because `test:lib:perf` loads `dist/igniteui-angular/styles/igniteui-angular.css`. |
| 16 | + |
| 17 | +## Test Runner |
| 18 | + |
| 19 | +- **Karma + Jasmine** for all library unit tests. |
| 20 | +- Karma configs live in `projects/igniteui-angular/karma*.conf.js`. |
| 21 | +- Coverage reports are written to `coverage/`. |
| 22 | + |
| 23 | +## Choosing the Right Command |
| 24 | + |
| 25 | +| Scenario | Command | |
| 26 | +|---|---| |
| 27 | +| **All library tests** (slow — runs everything) | `npm run test:lib` | |
| 28 | +| **Flat grid tests** only | `npm run test:lib:grid` | |
| 29 | +| **Tree grid tests** only | `npm run test:lib:tgrid` | |
| 30 | +| **Hierarchical grid tests** only | `npm run test:lib:hgrid` | |
| 31 | +| **Pivot grid tests** only | `npm run test:lib:pgrid` | |
| 32 | +| **All non-grid tests** (components, directives, services) | `npm run test:lib:others` | |
| 33 | +| **Watch mode** (re-runs on file changes, for dev loop) | `npm run test:lib:watch` | |
| 34 | +| **Performance tests** | `npm run test:lib:perf` | |
| 35 | +| **Schematics + migrations** | `npm run test:schematics` | |
| 36 | +| **Sass/style logic** | `npm run test:styles` | |
| 37 | +| **i18n resource validation** | `npm run test:i18n` | |
| 38 | + |
| 39 | +### Decision Guide |
| 40 | + |
| 41 | +1. **Working on a grid component?** → Use the matching grid command (`test:lib:grid`, `test:lib:tgrid`, `test:lib:hgrid`, or `test:lib:pgrid`). |
| 42 | +2. **Working on a non-grid component or directive?** → Use `test:lib:others`. |
| 43 | +3. **Iterating quickly during development?** → Use `test:lib:watch`. |
| 44 | +4. **Edited a migration or schematic?** → Use `test:schematics`. Build first only if you also need to validate compiled output. |
| 45 | +5. **Running performance tests?** → Build first (`build:lib` or at least `build:styles`), then use `test:lib:perf`. |
| 46 | +6. **Changed Sass theme logic?** → Use `test:styles`. |
| 47 | +7. **Changed i18n resource strings?** → Use `test:i18n`. |
| 48 | +8. **Final verification before marking work complete?** → Use `test:lib` (full suite). |
| 49 | + |
| 50 | +## Karma Configs |
| 51 | + |
| 52 | +| Config file | Used by | |
| 53 | +|---|---| |
| 54 | +| `karma.conf.js` | `test:lib` (all tests) | |
| 55 | +| `karma.grid.conf.js` | `test:lib:grid` | |
| 56 | +| `karma.tree-grid.conf.js` | `test:lib:tgrid` | |
| 57 | +| `karma.hierarchical-grid.conf.js` | `test:lib:hgrid` | |
| 58 | +| `karma.pivot-grid.conf.js` | `test:lib:pgrid` | |
| 59 | +| `karma.non-grid.conf.js` | `test:lib:others` | |
| 60 | +| `karma.watch.conf.js` | `test:lib:watch` | |
| 61 | +| `karma.test-perf.conf.js` | `test:lib:perf` (performance) | |
| 62 | + |
| 63 | +All configs are in `projects/igniteui-angular/`. |
| 64 | + |
| 65 | +## Key Paths |
| 66 | + |
| 67 | +| Path | Purpose | |
| 68 | +|---|---| |
| 69 | +| `projects/igniteui-angular/test-utils/` | Shared test helpers and utilities | |
| 70 | +| `projects/igniteui-angular/src/test.ts` | Karma test entry point | |
| 71 | +| `coverage/` | Code coverage output | |
| 72 | + |
| 73 | +## Related Skills |
| 74 | + |
| 75 | +- [`igniteui-angular-build`](../igniteui-angular-build/SKILL.md) — Building the library |
| 76 | +- [`igniteui-angular-linting`](../igniteui-angular-linting/SKILL.md) — Linting code and styles |
0 commit comments