@techsio/ui-kit 0.59.0 → 0.59.1
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.
package/README.md
CHANGED
|
@@ -167,7 +167,18 @@ and remove the duplicate bridge declarations. Do not edit generated
|
|
|
167
167
|
|
|
168
168
|
## Visual regression tests (Playwright + Docker)
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
Pick the smallest run that answers your question:
|
|
171
|
+
|
|
172
|
+
| Question | Command | Typical time |
|
|
173
|
+
| --- | --- | --- |
|
|
174
|
+
| Did my change move any pixels? | `pnpm -C libs/ui test:visual:local` (no Docker) | seconds to a few minutes |
|
|
175
|
+
| Do the stories my change can affect still match the committed baselines? | `VISUAL_CHANGED_SINCE=origin/master pnpm -C libs/ui test:components` | seconds to minutes |
|
|
176
|
+
| Does everything match? | `pnpm -C libs/ui test:components` | about 15 minutes of screenshots plus about 10 of behavior specs on an Apple Silicon Mac |
|
|
177
|
+
| The change is intended and I need new baselines | let CI fail, then `pnpm -C libs/ui baselines:pull --pr <number>` | one CI run |
|
|
178
|
+
|
|
179
|
+
CI renders the committed Linux baselines on `linux/amd64` and is the authority for them.
|
|
180
|
+
|
|
181
|
+
To keep screenshots stable across machines, comparisons against the committed baselines run inside Docker.
|
|
171
182
|
|
|
172
183
|
1. Run Playwright tests in a consistent Linux environment (builds Storybook static output by default):
|
|
173
184
|
|
|
@@ -182,7 +193,7 @@ pnpm -C libs/ui test:components:update
|
|
|
182
193
|
```
|
|
183
194
|
|
|
184
195
|
Docker image is defined in `docker/development/playwright/Dockerfile`.
|
|
185
|
-
|
|
196
|
+
Comparisons against the committed baselines are Docker-only; running them directly on the host is blocked to keep snapshots reproducible. The local check below runs on the host with its own baselines.
|
|
186
197
|
Make sure Storybook is served at `TEST_BASE_URL` (default `http://127.0.0.1:6006` inside the container).
|
|
187
198
|
You can run `pnpm -C libs/ui storybook` on the host and set `TEST_BASE_URL=http://host.docker.internal:6006`,
|
|
188
199
|
or let Playwright start its own static server inside Docker from `storybook-static`.
|
|
@@ -195,34 +206,60 @@ Run the focused replay contracts with `pnpm -C libs/ui test:visual-assets` after
|
|
|
195
206
|
|
|
196
207
|
Optional environment overrides:
|
|
197
208
|
- `TEST_BASE_URL` (default: `http://127.0.0.1:6006` inside the container)
|
|
198
|
-
- `PLAYWRIGHT_STORYBOOK_REBUILD` (
|
|
209
|
+
- `PLAYWRIGHT_STORYBOOK_REBUILD` (unset: rebuilds `storybook-static` only when its inputs changed; `1`: always rebuild; `0`: never rebuild)
|
|
199
210
|
- `VISUAL_STORYBOOK_STATIC_DIR` (absolute path to another Storybook build, e.g. one built from `master`, to test against the committed baselines; skips the rebuild)
|
|
200
211
|
- `VISUAL_BRANDS` (default: `business,akros,n1`; focused development only)
|
|
201
212
|
- `TEST_STORIES` (comma-separated Storybook story ids to run, e.g. `atoms-button--states,molecules-productcard--layout-variants`)
|
|
202
213
|
- `PLAYWRIGHT_WORKERS` (override worker count for parallel runs)
|
|
203
214
|
- `VISUAL_ASSET_HAR_PATH` (absolute path to an alternative HAR; its directory and attachments mount read-only)
|
|
204
|
-
- `PLAYWRIGHT_DOCKER_IMAGE` (default: `new-engine-ui-playwright:<Playwright version>-<Dockerfile hash
|
|
215
|
+
- `PLAYWRIGHT_DOCKER_IMAGE` (default: `new-engine-ui-playwright:<Playwright version>-<Dockerfile hash>`, with an `-arm64` suffix on `linux/arm64`)
|
|
216
|
+
- `PLAYWRIGHT_DOCKER_PLATFORM` (`linux/amd64` or `linux/arm64`; default: host architecture, or `linux/amd64` for snapshot updates and release runs)
|
|
205
217
|
- `PLAYWRIGHT_DOCKER_SHM_SIZE` (default: `2g`, improves Playwright stability in Docker)
|
|
206
218
|
- `PLAYWRIGHT_DOCKER_IPC` (default: `host`, improves Playwright stability in Docker)
|
|
207
219
|
- `PLAYWRIGHT_DOCKER_SEQUENTIAL` (default: `0`, runs projects in parallel; set to `1` to run one project at a time and reduce memory spikes)
|
|
220
|
+
- `VISUAL_CHANGED_SINCE` (git ref, e.g. `origin/master`; screenshots only the stories affected since the merge-base, or a full run when everything could be affected)
|
|
221
|
+
- `VISUAL_CHANGED_FILES` (comma-separated repo-relative paths; used instead of git, and wins over `VISUAL_CHANGED_SINCE` when both are set)
|
|
222
|
+
- `VISUAL_CHANGED_FILES_FROM` (path to a file with one repo-relative path per line, or NUL-separated as `git diff -z` writes it so names with newlines survive; the same as `VISUAL_CHANGED_FILES` for long lists, and it wins over both other changed-mode variables)
|
|
223
|
+
- `VISUAL_CHANGED_DRY_RUN` (set to `1` with a changed-mode variable to print the selection as JSON; needs an existing Storybook build and never builds or starts Docker)
|
|
224
|
+
- `PLAYWRIGHT_SHARD` (`index/total`, e.g. `2/8`; runs one shard of a non-release run, and a shard with no matching tests passes; cannot be combined with `PLAYWRIGHT_RELEASE_SHARD` or `VISUAL_RELEASE_READINESS=1`)
|
|
225
|
+
- `VISUAL_CHANGED_BEHAVIOR` (set to `1` to also run the component behavior specs in a changed subset; by default only screenshot specs run)
|
|
226
|
+
|
|
227
|
+
Example: `VISUAL_CHANGED_SINCE=origin/master pnpm -C libs/ui test:components`
|
|
208
228
|
|
|
209
229
|
Extra arguments are passed to `playwright test`, e.g. `pnpm -C libs/ui test:components -- --project=n1-mobile-light`.
|
|
210
|
-
|
|
230
|
+
Comparison runs use the host architecture (native arm64 on Apple Silicon); snapshot updates and release runs always use `linux/amd64`, matching the committed baselines. `PLAYWRIGHT_DOCKER_PLATFORM` overrides both. A full run must cover every story in every visual project; component behavior specs (`test/*.spec.ts`) run once in the `desktop` and `mobile` projects.
|
|
211
231
|
|
|
212
|
-
###
|
|
232
|
+
### Known differences on `linux/arm64`
|
|
213
233
|
|
|
214
|
-
|
|
215
|
-
browser memory. Override it depending on your machine or CI runner size.
|
|
216
|
-
- The test suite enables `fullyParallel` in Playwright config, so tests can run
|
|
217
|
-
concurrently across files and workers — ensure tests are isolated and use
|
|
218
|
-
unique snapshot names (the visual tests already include `story.id` in the
|
|
219
|
-
screenshot filename, which is good).
|
|
234
|
+
Comparison runs on Apple Silicon use `linux/arm64`. One result differs there from `linux/amd64` in every run and is not a regression: screenshot `molecules-colorselect--keyboard-navigation` on `akros-mobile-light` and `n1-mobile-light`, where 17 pixels differ against an allowance of 16.
|
|
220
235
|
|
|
221
|
-
|
|
236
|
+
Behavior specs can be timing-sensitive on a fast machine. `date-picker.behavior.spec.ts` ("portals the popup, moves through the grid, and restores trigger focus", `desktop`) failed in a full run under load and passed 6 of 6 on its own.
|
|
222
237
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
238
|
+
A failing native run prints the commands that confirm failed screenshot stories and behavior specs on `linux/amd64`.
|
|
239
|
+
|
|
240
|
+
### Workers
|
|
241
|
+
|
|
242
|
+
The Docker runner uses 4 workers unless `PLAYWRIGHT_WORKERS` is set. On a 6-CPU Docker VM 4 workers already use every core: 6 workers finished a 372-test sample in 153 seconds against 158. Raise the number only when the VM has more CPUs. The local check without Docker picks its own count from the host's cores.
|
|
243
|
+
|
|
244
|
+
### Local visual check without Docker
|
|
245
|
+
|
|
246
|
+
`pnpm -C libs/ui test:visual:local` answers one question: did your working tree change any pixels compared with the commit you branched from?
|
|
247
|
+
|
|
248
|
+
- It runs on your machine and needs no Docker.
|
|
249
|
+
- It renders the base commit (`--base`, default `origin/master`, compared at `git merge-base HEAD <ref>`) and compares your changes against it.
|
|
250
|
+
- The first run per base commit builds that commit in a temporary worktree (about 2 minutes) and needs 3 GiB free in the temporary directory.
|
|
251
|
+
- Base screenshots are captured with the test harness of the branch you run from. They are cached per machine, per base commit and per harness: the build is shared, the baselines are not. The harness is `libs/ui/test/visual.spec.ts`, `libs/ui/test/visual-*.mjs` (not `*.test.mjs`), `libs/ui/playwright.config.mts` and `libs/ui/test/fixtures/visual-assets`. When any of them changes, the baselines are re-captured automatically on the next run.
|
|
252
|
+
- Cache layout: `<root>/builds/<base>/storybook-static` and `<root>/<platform>-<arch>-pw<version>-h<harness>/<base>/snapshots`. The `<root>` is `VISUAL_LOCAL_CACHE` when set, otherwise `~/Library/Caches/techsio-ui-visual` on macOS and `~/.cache/techsio-ui-visual` elsewhere. Caches from the older single-key layout are ignored and can be deleted.
|
|
253
|
+
- Each cache level keeps the 5 most recently used base commits. `VISUAL_LOCAL_CACHE_KEEP=<n>` changes that number. Directories used by the current run and directories locked by a live run are never removed.
|
|
254
|
+
- Runs for the same base commit wait for each other, so a commit is never built or captured twice at once. A failed or killed capture leaves no baselines behind.
|
|
255
|
+
- Nothing is written to the committed Linux baselines. CI stays the authority for those.
|
|
256
|
+
- Flags: `--base <ref>`, `--all` (every visual story), `--stories <id,id>` (skips change detection), `--workers <n>`, `--rebuild-base` (rebuilds the base build and clears the baselines for the current harness), `--dry-run` (prints the plan as JSON and builds nothing).
|
|
257
|
+
- Install the browsers once: `pnpm -C libs/ui exec playwright install chromium webkit`. If a run reports missing browsers, it says so in the summary.
|
|
258
|
+
- The HTML report goes to `libs/ui/.visual-local/report`. Open it with `pnpm -C libs/ui exec playwright show-report .visual-local/report`.
|
|
259
|
+
|
|
260
|
+
### Baselines from CI
|
|
261
|
+
|
|
262
|
+
When a PR's screenshot check fails because the visual change is intended, run `pnpm -C libs/ui baselines:pull --pr <number>` to copy the screenshots that CI rendered into the committed Linux baselines. Use a run id or `--branch <name>` instead of `--pr` to pick another run, and `--out <dir>` or `--dry-run` to write elsewhere or only list the files. Review the images and `git status`, then commit.
|
|
226
263
|
|
|
227
264
|
### Release coverage versus focused development
|
|
228
265
|
|
package/dist/molecules/chart.js
CHANGED
|
@@ -161,7 +161,7 @@ function resolveBuild(config) {
|
|
|
161
161
|
};
|
|
162
162
|
const locale = validLocale(config.locale);
|
|
163
163
|
const numberFormat = locale ? new Intl.NumberFormat(locale) : void 0;
|
|
164
|
-
const dateFormat = new Intl.DateTimeFormat(locale, {
|
|
164
|
+
const dateFormat = new Intl.DateTimeFormat(locale ?? "en-US", {
|
|
165
165
|
dateStyle: "medium",
|
|
166
166
|
timeZone: "UTC"
|
|
167
167
|
});
|
|
@@ -49,11 +49,11 @@ export type ChartProps<TDatum> = {
|
|
|
49
49
|
* `yLabel`; the raw `y` field name is never shown. Multi-series rows use the `series` values.
|
|
50
50
|
*/
|
|
51
51
|
valueLabel?: string;
|
|
52
|
-
/** Formats the tooltip title from the category / x value.
|
|
52
|
+
/** Formats the tooltip title from the category / x value. Numbers are plain `String`; dates use a fixed `en-US` medium format unless `locale` is set. */
|
|
53
53
|
formatCategory?: (value: string | number | Date) => string;
|
|
54
54
|
/** Formats values in the tooltip. Defaults to `formatValue`, then locale number formatting. */
|
|
55
55
|
formatTooltipValue?: (value: number) => string;
|
|
56
|
-
/** BCP 47 locale for the default tooltip number and date formatting (e.g. "cs-CZ"). */
|
|
56
|
+
/** BCP 47 locale for the default tooltip number and date formatting (e.g. "cs-CZ"). Unset: numbers are plain `String` and dates use a fixed `en-US` medium format. */
|
|
57
57
|
locale?: string;
|
|
58
58
|
/** Fixed pixel height. When omitted, `aspectRatio` controls sizing. */
|
|
59
59
|
height?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/molecules/chart.tsx"],"names":[],"mappings":"AA8DA,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,+EAA+E;AAC/E,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,KAAK,GACL,gBAAgB,GAChB,SAAS,GACT,KAAK,GACL,OAAO,CAAA;AAEX,2EAA2E;AAC3E,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,MAAM,IACpC,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GACvB,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;AAE/B,MAAM,MAAM,UAAU,CAAC,MAAM,IAAI;IAC/B,sDAAsD;IACtD,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,gFAAgF;IAChF,IAAI,EAAE,SAAS,MAAM,EAAE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@@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techsio/ui-kit",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -84,6 +84,8 @@
|
|
|
84
84
|
"test:components": "node scripts/run-component-tests.mjs",
|
|
85
85
|
"test:components:release": "cross-env VISUAL_RELEASE_READINESS=1 node scripts/run-component-tests.mjs",
|
|
86
86
|
"test:components:update": "node scripts/run-component-tests.mjs --update-snapshots",
|
|
87
|
+
"test:visual:local": "node scripts/visual-local.mjs",
|
|
88
|
+
"baselines:pull": "node scripts/pull-ci-baselines.mjs",
|
|
87
89
|
"test:sidebar:ssr": "vitest run --config vitest.config.ts test/sidebar.ssr.bun.tsx",
|
|
88
90
|
"lint:tailwind": "eslint \"**/*.{js,jsx,ts,tsx}\" --config eslint.config.js",
|
|
89
91
|
"lint:tailwind:fix": "eslint \"**/*.{js,jsx,ts,tsx}\" --config eslint.config.js --fix",
|