Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .claude/agents/code-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ rules in section 6 are the easiest to miss — do not skip them.

Easy-to-miss invariants beyond the generic checks above:

* **Lint gate** ([CLAUDE.md](../../CLAUDE.md#commands)): `npm run lint` =
eslint + markdownlint + stylelint. It is not auto-run — remind the author to
run `npm run lint`, `npm run test:jest`, and `npm run test:playwright-ct:all`.
* **CI gate** ([CLAUDE.md](../../CLAUDE.md#commands)): CI runs `lint`,
`test:jest` and `test:playwright`
([.github/workflows/](../../.github/workflows/)). `npm run lint` covers
`lint:eslint`, `lint:stylelint`, `lint:markdownlint` and `lint:types`; the
tests run separately. `npm run lint:eslint` covers `src` and `tests`.
Remind the author to run them.
* **Component layout** ([frontend.md](../rules/frontend.md)): every component
folder has the `.tsx` + `.types.ts` + `index.ts` barrel + `*.module.scss` + `_settings`/
`_theme`/`_tools` SCSS partials + `README.md` + `__tests__/`. Props are
Expand Down Expand Up @@ -117,7 +120,7 @@ Group findings by severity. For each:
- [design] src/components/Foo/Foo.tsx:7 (frontend.md) — ref not forwarded to root element.

## Reminders
- Run `npm run lint`, `npm run test:jest`, and `npm run test:playwright-ct:all` before committing.
- Run `npm run lint`, `npm run test:jest` and `npm run test:playwright`.
```

End with a one-line verdict: APPROVE / APPROVE WITH NITS / REQUEST CHANGES.
2 changes: 1 addition & 1 deletion .claude/rules/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ paths:

## Commands

* Run `npm run markdownlint` after changes (add `-- --fix` to autofix).
* Run `npm run lint:markdownlint` after changes (add `-- --fix` to autofix).
* Run `mkdocs build` and `mkdocs serve` to build and serve the documentation
* To verify a rendered component or the docs previews in a real browser
(navigate, click, screenshot, inspect the running docs site), drive host
Expand Down
4 changes: 2 additions & 2 deletions .claude/rules/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ paths:
## Commands

* If dependencies change, run `npm ci`.
* Run `npm run eslint` after changes (add `-- --fix` to autofix) and
`npm run typecheck` (`tsc --noEmit`).
* Run `npm run lint:eslint` after changes (add `-- --fix` to autofix) and
`npm run lint:types` (`tsc --noEmit`).
* To verify a rendered component or the docs previews in a real browser
(navigate, click, screenshot, inspect the running docs site), drive host
Chrome through the `chrome-host` MCP. See
Expand Down
2 changes: 1 addition & 1 deletion .claude/rules/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ paths:

## Commands

Run `npm run stylelint` after changes (add `-- --fix` to autofix).
Run `npm run lint:stylelint` after changes (add `-- --fix` to autofix).

## Styling

Expand Down
9 changes: 5 additions & 4 deletions .claude/rules/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ paths:

* Run all Jest unit tests with `npm run test:jest`. For a single file:
`npm run test:jest -- <file>`.
* Run all Playwright component tests with `npm run test:playwright-ct:all`; for
one component, `npm run test:playwright-ct:all -- -- src/components/Button`.
* Update Playwright snapshots with `npm run test:playwright-ct:all-with-update`.
* Serve the report with `npm run test:playwright-ct:show-report`.
* Run all Playwright component tests with `npm run test:playwright`; for one
component, `npm run test:playwright -- src/components/Button`.
* Update Playwright snapshots with
`npm run test:playwright -- [<path>] --update-snapshots`.
* Serve the report with `npm run test:playwright:report`.

## Testing

Expand Down
15 changes: 5 additions & 10 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
"Bash(npm audit)",
"Bash(npm audit signatures)",
"Bash(npm ci)",
"Bash(npm run build:*)",
"Bash(npm run lint)",
"Bash(npm run eslint:*)",
"Bash(npm run stylelint:*)",
"Bash(npm run markdownlint:*)",
"Bash(npm start)",
"Bash(npm run start:*)",
"Bash(npm test)",
"Bash(npm run test:jest:*)",
"Bash(npm run test:playwright-ct:*)"
"Bash(npm run build*)",
"Bash(npm run lint*)",
"Bash(npm run start*)",
"Bash(npm run test*)",
"Bash(npm start*)"
]
},
"attribution": {
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/commit/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Before committing, check the following (see [Commands](../../../CLAUDE.md#comman
* `mkdocs build` passes
* `npm run lint` passes
* `npm run test:jest` passes
* `npm run test:playwright-ct:all` passes
* `npm run test:playwright` passes

Write a commit message for the staged changes following the project's git
conventions ([General Guidelines › Git Workflow](../../../src/docs/contribute/general-guidelines.md#git-workflow)):
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: npx playwright install --with-deps

- name: Run Playwright tests and generate test report
run: npm run test:playwright-ct:all
run: npm run test:playwright

- name: Install Playwright Browsers
run: npx playwright install --with-deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: npm run lint

- name: Test
run: npm test
run: npm run test:jest

- name: Build
run: npm run build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: npm ci

- name: Test and generate code coverage info
run: npm test
run: npm run test:jest

- name: Upload code coverage info to Coveralls
uses: coverallsapp/github-action@v2
38 changes: 23 additions & 15 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,32 @@ Run these inside the `devcontainer` (from the host, prefix with
`docker compose exec -T devcontainer`). For details, see the
[Contributing Guide](src/docs/contribute/general-guidelines.md).

| Task | Command |
|-----------------------------------|---------------------------------------------------------------------|
| Install JS | `npm ci` |
| Build library | `npm run build` |
| Build type declarations only | `npm run build:types` |
| Run static checks | `npm run lint` |
| Run type check | `npm run typecheck` |
| Run unit tests | `npm run test:jest` |
| Run a single unit test file | `npm run test:jest -- <file>` |
| Run component tests | `npm run test:playwright-ct:all` |
| Component tests for one component | `npm run test:playwright-ct:all -- -- src/components/Button` |
| Update component snapshots | `npm run test:playwright-ct:all-with-update` |
| Start build watcher | `npm start` |
| Build documentation | `mkdocs build` |
| Serve documentation | `mkdocs serve` |
| Task | Command |
|-----------------------------------|----------------------------------------------------------|
| Install JS | `npm ci` |
| Build library | `npm run build` |
| Build type declarations only | `npm run build:types` |
| Run static checks (incl. types) | `npm run lint` |
| Run ESLint | `npm run lint:eslint` |
| Run Stylelint | `npm run lint:stylelint` |
| Run Markdownlint | `npm run lint:markdownlint` |
| Run type check | `npm run lint:types` |
| Run unit tests | `npm run test:jest` |
| Run a single unit test file | `npm run test:jest -- <file>` |
| Run component tests | `npm run test:playwright` |
| Component tests for one component | `npm run test:playwright -- src/components/Button` |
| Update component snapshots | `npm run test:playwright -- [<path>] --update-snapshots` |
| Start build watcher | `npm start` |
| Build documentation | `mkdocs build` |
| Serve documentation | `mkdocs serve` |

Notes:

* `npm run lint` runs all linters (ESLint, Stylelint, Markdownlint, type check).
There is no `npm test` script.
* `npm run lint:eslint` lints `src` and `tests`.
* The lint / Jest / Playwright commands are the same gates CI runs
([.github/workflows/](.github/workflows/)).
* Commands like `npm`, `playwright` run in specific Docker containers.
Normally, when you run those commands, they are executed within dedicated
containers. If you need to communicate directly with specific Docker container,
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {

export default defineConfig([
globalIgnores(['**/*.js']),
// Only these directories are linted, so `eslint` can be run without a path
globalIgnores(['*', '!src/', '!tests/'], 'app/lint-scope'),
...configs.base.recommended,
...configs.react.recommended,
...configs.base.typescript,
Expand Down
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,20 @@
"copy": "npm run copy:css && npm run copy:js",
"copy:css": "cp src/docs/_assets/generated/react-ui.css dist && cp src/docs/_assets/generated/react-ui.development.css dist",
"copy:js": "cp src/docs/_assets/generated/react-ui.js dist && cp src/docs/_assets/generated/react-ui.development.js dist",
"eslint": "eslint src tests",
"lint": "npm run eslint && npm run markdownlint && npm run stylelint && npm run typecheck",
"markdownlint": "markdownlint-cli2 \"README.md\" \"src/**/*.md\"",
"lint": "npm run lint:stylelint && npm run lint:eslint && npm run lint:types && npm run lint:markdownlint",
"lint:eslint": "eslint",
"lint:markdownlint": "markdownlint-cli2 \"README.md\" \"src/**/*.md\"",
"lint:stylelint": "stylelint \"src/**/*.{css,scss}\" \"!src/docs/_assets/generated/**\" --config stylelint.config.mjs",
"lint:types": "node node_modules/@typescript/native/bin/tsc --noEmit",
"postbuild": "npm run copy && npm run build:types",
"postinstall": "sh scripts/write-lockfile-hash.sh",
"precopy": "rm -rf dist && mkdir dist",
"prepublishOnly": "npm run build",
"start": "webpack --watch --mode=development",
"start:chrome": "sh scripts/mcps/chrome-host/start-host-chrome.sh",
"stylelint": "stylelint \"src/**/*.{css,scss}\" \"!src/docs/_assets/generated/**\" --config stylelint.config.mjs",
"test": "npm run test:jest",
"test:jest": "jest --coverage",
"test:playwright-ct:all": "playwright test -c playwright-ct.config.ts",
"test:playwright-ct:all-with-update": "playwright test -c playwright-ct.config.ts --update-snapshots",
"test:playwright-ct:show-report": "playwright show-report --host=0.0.0.0 --port=9323",
"typecheck": "node node_modules/@typescript/native/bin/tsc --noEmit"
"test:playwright": "playwright test -c playwright-ct.config.ts",
"test:playwright:report": "playwright show-report --host=0.0.0.0"
},
"dependencies": {
"normalize.css": "^8.0.1"
Expand Down
29 changes: 18 additions & 11 deletions src/docs/contribute/testing-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Tools used to test the application:
* **Jest** (unit tests)
* **Playwright** (visual and functional component testing)

Generally, `npm test` and `npm run test:playwright-ct:all` should be run within
Generally, `npm run test:jest` and `npm run test:playwright` should be run within
their designated Docker containers before pushing changes to the repository.

## Tools

You can run all tests with a single command:

```bash
npm run lint && npm test && npm run test:playwright-ct:all
npm run lint && npm run test:jest && npm run test:playwright
```

### Linters (ESLint, Markdownlint, Stylelint)
### Linters (ESLint, Markdownlint, Stylelint, TypeScript)

Run linters either all together:

Expand All @@ -30,7 +30,7 @@ npm run lint
or run linters individually:

```bash
npm run <eslint|markdownlint|stylelint>
npm run lint:<eslint|markdownlint|stylelint|types>
```

### Jest
Expand All @@ -39,6 +39,12 @@ npm run <eslint|markdownlint|stylelint>
npm run test:jest
```

Run a single test file:

```bash
npm run test:jest -- <file>
```

### Playwright

#### Configuration
Expand All @@ -47,22 +53,23 @@ Test parameters can be tweaked by creating and tweaking `.env` file.

#### Running Tests

Run tests:
Run all component tests:

```bash
npm run test:playwright-ct:<all|all-with-update>
npm run test:playwright
```

You can also run specific tests by passing a path to the test files:
You can also run specific tests by passing a path, or pass any
[Playwright CLI argument][playwright-cli] to the test runner:

```bash
npm run test:playwright-ct:<all|all-with-update> -- -- <match_path>
npm run test:playwright -- <match_path_or_cli_argument>
```

You can also pass any [CLI command][playwright-cli] to the test runner:
Update snapshots by adding `--update-snapshots`, optionally limited to a path:

```bash
npm run test:playwright-ct:<all|all-with-update> -- -- <cli_argument>
npm run test:playwright -- [<path>] --update-snapshots
```

#### Writing Tests
Expand Down Expand Up @@ -212,7 +219,7 @@ After running Playwright tests, test report can be served by using
the following command:

```bash
npm run test:playwright-ct:show-report
npm run test:playwright:report
```

Then open the displayed URL (typically `http://localhost:9323`)
Expand Down
Loading