jattac.libs.web.zest-button 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,529 +0,0 @@
1
- # AI Test Configuration
2
-
3
- ## Terminology
4
-
5
- The words MUST, MUST NOT, SHALL, SHALL NOT, SHOULD and MAY are to be interpreted as defined by RFC 2119.
6
-
7
- ---
8
-
9
- ## Purpose
10
-
11
- Every project MUST have test reporting configured.
12
-
13
- The LLM MUST verify configuration at the start of every session.
14
-
15
- If reporting is not configured, the FIRST task is to configure it.
16
-
17
- This document provides platform-specific setup instructions.
18
-
19
- ---
20
-
21
- ## Session Startup Procedure
22
-
23
- The LLM MUST follow this procedure at the start of every session, before ANY task.
24
-
25
- ### Step 1 — Identify project type
26
-
27
- Check for:
28
-
29
- • `*.csproj` or `*.sln` files → .NET project
30
-
31
- • `package.json` with `jest` → Node.js project
32
-
33
- • Both → Full-stack project (configure both)
34
-
35
- ### Step 2 — Check tools
36
-
37
- ```
38
- dotnet --version (if .NET)
39
- node --version (if Node.js)
40
- npx --version (if Node.js)
41
- ```
42
-
43
- If any tool is missing:
44
-
45
- STOP.
46
-
47
- Tell the user to install the missing tool.
48
-
49
- Do NOT auto-install system-level tools.
50
-
51
- Do NOT proceed until tools are available.
52
-
53
- ### Step 3 — Check packages
54
-
55
- ```
56
- # .NET: Check for coverlet
57
- dotnet list package | findstr coverlet
58
-
59
- # Node: Check jest.config.js declares json-summary coverage reporter
60
- findstr "json-summary" jest.config.js
61
- ```
62
-
63
- If missing:
64
-
65
- AUTO-INSTALL / AUTO-CONFIGURE:
66
-
67
- ```
68
- # .NET
69
- dotnet add package coverlet.collector
70
-
71
- # Node — jest ships with coverage built in, no package install needed.
72
- # Add coverageReporters: ['json-summary', 'text', 'lcov'] to jest.config.js instead.
73
- ```
74
-
75
- Do NOT ask permission. Packages and config are project-level.
76
-
77
- ### Step 4 — Check configuration files
78
-
79
- ```
80
- # .NET: Check for .runsettings
81
- Test-Path .runsettings
82
-
83
- # Node: Check for jest.config
84
- Test-Path jest.config.js
85
- Test-Path jest.config.ts
86
- ```
87
-
88
- If missing:
89
-
90
- AUTO-CREATE using templates from this document.
91
-
92
- Do NOT ask permission. Config files are project-level.
93
-
94
- ### Step 5 — Verify reporting works
95
-
96
- Run a single test to confirm reports are generated:
97
-
98
- ```
99
- # .NET
100
- dotnet test --filter "FullyQualifiedName~1" --logger "trx;LogFileName=verify-test.trx" --results-directory test-reports/trx-verify --collect:"XPlat Code Coverage" --results-directory test-reports/trx-verify
101
-
102
- # Node
103
- npx jest --coverage --coverageReporters=json-summary
104
- ```
105
-
106
- Verify expected output files exist and are non-empty:
107
-
108
- ```
109
- # .NET
110
- test-reports/trx-verify/verify-test.trx
111
- test-reports/trx-verify/coverage.cobertura.xml
112
-
113
- # Node
114
- coverage/coverage-summary.json
115
- ```
116
-
117
- ### Step 6 — Report status
118
-
119
- Tell the user:
120
-
121
- ```
122
- Test Reporting Status:
123
-
124
- Tools:
125
- dotnet: [version] ✓/✗
126
- node: [version] ✓/✗
127
- npx: [version] ✓/✗
128
-
129
- Packages:
130
- coverlet.collector: ✓ installed / ✗ installed
131
- @vitest/coverage-v8: ✓ installed / ✗ installed
132
-
133
- Configuration:
134
- .runsettings: ✓ exists / ✗ created
135
- jest.config.js: ✓ exists / ✗ created
136
-
137
- Verification:
138
- TRX output: ✓ generated / ✗ failed
139
- Coverage output: ✓ generated / ✗ failed
140
-
141
- Status: READY / NOT READY
142
- ```
143
-
144
- Only proceed to Step 1 (BRS) after status is READY.
145
-
146
- ### Step 7 — Load workflow triggers
147
-
148
- Read AI_WORKFLOW_TRIGGERS.md.
149
-
150
- This file contains semantic patterns that detect when a new work cycle should begin.
151
-
152
- The file is a LIVING DOCUMENT that adapts to the user's communication style.
153
-
154
- At session end, update the file if:
155
-
156
- • User corrected a trigger classification → remove or modify pattern
157
-
158
- • User introduced new trigger language → add pattern with `[Observed]` status
159
-
160
- • Pattern was never used → consider retiring after 10 sessions
161
-
162
- See AI_WORKFLOW_TRIGGERS.md for full learning rules.
163
-
164
- ---
165
-
166
- ## Platform: .NET
167
-
168
- ### Requirements
169
-
170
- | Requirement | Purpose |
171
- |-------------|---------|
172
- | coverlet.collector | Code coverage collection |
173
- | .runsettings | Coverage configuration |
174
- | [Category] attributes | Test filtering (unit vs integration) |
175
- | --logger trx | TRX output for test results |
176
-
177
- ### Installation
178
-
179
- ```bash
180
- dotnet add package coverlet.collector
181
- ```
182
-
183
- ### .runsettings Template
184
-
185
- Create at project root:
186
-
187
- ```xml
188
- <?xml version="1.0" encoding="utf-8"?>
189
- <RunSettings>
190
- <DataCollectionRunSettings>
191
- <DataCollectors>
192
- <DataCollector friendlyName="XPlat Code Coverage">
193
- <Configuration>
194
- <Format>cobertura</Format>
195
- <Exclude>[xunit.*]*</Exclude>
196
- <Include>[MyProject.*]*</Include>
197
- <UseSourceLink>true</UseSourceLink>
198
- </Configuration>
199
- </DataCollector>
200
- </DataCollectors>
201
- </DataCollectionRunSettings>
202
- </RunSettings>
203
- ```
204
-
205
- Replace `[MyProject.*]*` with the actual project namespace.
206
-
207
- ### Test Categorization
208
-
209
- Add categories to distinguish unit and integration tests:
210
-
211
- ```csharp
212
- // Unit test (no attribute needed, or use [Category("Unit")])
213
- [Fact]
214
- public void CalculateTotal_ReturnsSum() { }
215
-
216
- // Integration test
217
- [Fact]
218
- [Category("Integration")]
219
- public void Database_InsertOrder_CreatesRecord() { }
220
- ```
221
-
222
- ### Commands
223
-
224
- ```bash
225
- # Unit tests only
226
- dotnet test --filter "Category!=Integration"
227
-
228
- # Integration/E2E tests only
229
- dotnet test --filter "Category=Integration"
230
-
231
- # With TRX output
232
- dotnet test --logger "trx;LogFileName=unit-tests.trx"
233
-
234
- # With coverage
235
- dotnet test --collect:"XPlat Code Coverage"
236
-
237
- # With coverage + custom settings
238
- dotnet test --collect:"XPlat Code Coverage" --settings .runsettings
239
- ```
240
-
241
- ### Expected Output Files
242
-
243
- ```
244
- test-reports/trx-{timestamp}/
245
- unit-tests.trx ← Test results (XML)
246
- e2e-tests.trx ← E2E test results (XML)
247
- coverage.cobertura.xml ← Coverage data (XML)
248
- ```
249
-
250
- ### TRX File Format
251
-
252
- ```xml
253
- <TestRun>
254
- <ResultSummary>
255
- <Counters total="47" passed="45" failed="1" notExecuted="1" />
256
- </ResultSummary>
257
- <Results>
258
- <UnitTestResult testName="CalculateTotal_ReturnsSum" outcome="Passed" duration="00:00:00.123" />
259
- <UnitTestResult testName="Database_InsertOrder_CreatesRecord" outcome="Failed" duration="00:00:02.456" />
260
- <UnitTestResult testName="Api_GetPayment_Returns404" outcome="NotExecuted" />
261
- </Results>
262
- <TestDefinitions>
263
- <UnitTest id="1" name="CalculateTotal_ReturnsSum" />
264
- </TestDefinitions>
265
- </TestRun>
266
- ```
267
-
268
- ### Cobertura File Format
269
-
270
- ```xml
271
- <coverage line-rate="0.782" branch-rate="0.651">
272
- <packages>
273
- <package name="MyProject">
274
- <classes>
275
- <class name="PaymentService" filename="Services/PaymentService.cs">
276
- <lines>
277
- <line number="10" hits="5" />
278
- <line number="15" hits="0" />
279
- </lines>
280
- </class>
281
- </classes>
282
- </package>
283
- </packages>
284
- </coverage>
285
- ```
286
-
287
- ### Verification Command
288
-
289
- ```bash
290
- dotnet test --filter "FullyQualifiedName~1" --logger "trx;LogFileName=verify-test.trx" --collect:"XPlat Code Coverage" --settings .runsettings --results-directory test-reports/trx-verify
291
- ```
292
-
293
- ### Common Issues
294
-
295
- **TRX not generated:**
296
- - Check --logger flag is present
297
- - Check --results-directory exists
298
-
299
- **Coverage not generated:**
300
- - Check coverlet.collector is installed: `dotnet list package | findstr coverlet`
301
- - Check .runsettings has correct Format: `cobertura`
302
- - Check Include filter matches your project namespace
303
-
304
- **Coverage is 0%:**
305
- - Check Include filter in .runsettings matches your project
306
- - Check project is not excluded by default
307
-
308
- ---
309
-
310
- ## Platform: Node.js
311
-
312
- ### Requirements
313
-
314
- | Requirement | Purpose |
315
- |-------------|---------|
316
- | jest | Test runner (built-in coverage via V8/Istanbul) |
317
- | jest.config.js with `coverageReporters` including `json-summary` | Coverage output the verify scripts can parse |
318
- | TypeScript config | Type checking |
319
- | ESLint config | Linting |
320
-
321
- ### Installation
322
-
323
- Jest ships with coverage collection built in — no extra package is required.
324
-
325
- ```bash
326
- npm install -D jest jest-environment-jsdom @testing-library/react @testing-library/jest-dom
327
- ```
328
-
329
- ### jest.config.js Template
330
-
331
- Create at frontend root (this project uses `next/jest` to wrap it):
332
-
333
- ```javascript
334
- const nextJest = require('next/jest')
335
-
336
- const createJestConfig = nextJest({ dir: './' })
337
-
338
- /** @type {import('jest').Config} */
339
- const customJestConfig = {
340
- testEnvironment: 'jest-environment-jsdom',
341
- setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
342
- moduleNameMapper: {
343
- '^@/(.*)$': '<rootDir>/$1',
344
- },
345
- coverageReporters: ['json-summary', 'text', 'lcov'],
346
- }
347
-
348
- module.exports = createJestConfig(customJestConfig)
349
- ```
350
-
351
- The `coverageReporters` entry is the part the verify scripts depend on — without `json-summary`, `--coverage` still runs but never writes `coverage/coverage-summary.json`.
352
-
353
- ### Commands
354
-
355
- ```bash
356
- # Run tests
357
- npx jest
358
-
359
- # Watch mode
360
- npx jest --watch
361
-
362
- # Run tests with coverage
363
- npx jest --coverage
364
-
365
- # Type check
366
- npx tsc --noEmit
367
-
368
- # Lint
369
- npx eslint .
370
-
371
- # Full verification
372
- npx jest --coverage && npx tsc --noEmit && npx eslint .
373
- ```
374
-
375
- ### Expected Output Files
376
-
377
- ```
378
- coverage/
379
- coverage-summary.json ← Coverage summary (JSON)
380
- lcov.info ← Coverage detail (LCOV)
381
- ```
382
-
383
- ### Jest Coverage Summary JSON Format
384
-
385
- ```json
386
- {
387
- "total": {
388
- "lines": { "total": 500, "covered": 391, "skipped": 0, "pct": 78.2 },
389
- "statements": { "total": 500, "covered": 391, "skipped": 0, "pct": 78.2 },
390
- "functions": { "total": 50, "covered": 41, "skipped": 0, "pct": 82.0 },
391
- "branches": { "total": 120, "covered": 78, "skipped": 0, "pct": 65.0 }
392
- }
393
- }
394
- ```
395
-
396
- ### Verification Command
397
-
398
- ```bash
399
- npx jest --coverage --coverageReporters=json-summary
400
- ```
401
-
402
- ### Common Issues
403
-
404
- **Coverage not generated:**
405
- - Check `jest.config.js` has `coverageReporters` set, and that it includes `json-summary`
406
- - Check the command includes `--coverage`
407
-
408
- **Type check fails:**
409
- - Check tsconfig.json exists
410
- - Check noEmit is set in tsconfig.json or passed as flag
411
-
412
- **ESLint not found:**
413
- - Check eslint.config.* or .eslintrc.* exists
414
- - Check eslint is installed: `npm list eslint`
415
-
416
- ---
417
-
418
- ## Output Format Specification
419
-
420
- The verify scripts expect these exact file formats.
421
-
422
- ### TRX (Test Results XML)
423
-
424
- **Location:** `test-reports/trx-{timestamp}/*.trx`
425
-
426
- **Required fields:**
427
-
428
- | Path | Type | Values |
429
- |------|------|--------|
430
- | TestRun.ResultSummary.Counters.@total | int | Total test count |
431
- | TestRun.ResultSummary.Counters.@passed | int | Passed count |
432
- | TestRun.ResultSummary.Counters.@failed | int | Failed count |
433
- | TestRun.ResultSummary.Counters.@notExecuted | int | Skipped count |
434
- | TestRun.Results.UnitTestResult.@testName | string | Test name |
435
- | TestRun.Results.UnitTestResult.@outcome | string | Passed / Failed / NotExecuted |
436
- | TestRun.Results.UnitTestResult.@duration | string | TimeSpan format |
437
-
438
- ### Cobertura (Coverage XML)
439
-
440
- **Location:** `test-reports/trx-{timestamp}/coverage.cobertura.xml`
441
-
442
- **Required fields:**
443
-
444
- | Path | Type | Range |
445
- |------|------|-------|
446
- | coverage.@line-rate | double | 0.0 - 1.0 |
447
- | coverage.@branch-rate | double | 0.0 - 1.0 |
448
-
449
- ### Jest Coverage JSON
450
-
451
- **Location:** `coverage/coverage-summary.json`
452
-
453
- **Required fields:**
454
-
455
- | Path | Type | Range |
456
- |------|------|-------|
457
- | total.lines.pct | double | 0 - 100 |
458
- | total.branches.pct | double | 0 - 100 |
459
- | total.functions.pct | double | 0 - 100 |
460
-
461
- ---
462
-
463
- ## Coverage Regression
464
-
465
- ### Principle
466
-
467
- Coverage MUST NOT decrease from the previous build.
468
-
469
- This is not about hitting a target number.
470
-
471
- This is about preventing regressions.
472
-
473
- ### How It Works
474
-
475
- 1. First run: Create baseline with current coverage values
476
- 2. Subsequent runs: Compare current vs baseline
477
- 3. If current >= baseline: Update baseline, continue
478
- 4. If current < baseline: FAIL with regression message
479
-
480
- ### Baseline File
481
-
482
- **Location:** `test-reports/coverage-baseline.json`
483
-
484
- **Format:**
485
-
486
- ```json
487
- {
488
- "backend": {
489
- "line": 78.2,
490
- "branch": 65.1,
491
- "functions": 82.3,
492
- "testCount": 47,
493
- "timestamp": "2026-07-26T10:45:23Z"
494
- },
495
- "frontend": {
496
- "line": 82.1,
497
- "branch": 71.4,
498
- "functions": 88.9,
499
- "testCount": 23,
500
- "timestamp": "2026-07-26T10:45:23Z"
501
- }
502
- }
503
- ```
504
-
505
- ### Lifecycle
506
-
507
- • Created on first verify-post.ps1 run
508
-
509
- • Updated on every successful run
510
-
511
- • Never deleted (history preserved)
512
-
513
- • Committed to repo (shared across team)
514
-
515
- ---
516
-
517
- ## Purpose of Tests
518
-
519
- Tests are written to verify functionality and catch bugs.
520
-
521
- Tests are NOT written to hit coverage goals.
522
-
523
- High coverage with poor tests is worse than lower coverage with meaningful tests.
524
-
525
- Every test MUST verify a specific behaviour.
526
-
527
- Every test MUST assert specific expected values.
528
-
529
- Coverage is a side effect of good testing, not the goal.