Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to angular 19.2 and add eslint #17

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
68e0de3
build(deps): update to angular 19
Jan 13, 2025
6152c61
build(storybook): update storybook to 8.4.7
Jan 13, 2025
29bf3e0
build(deps): upgrade vestjs
Jan 13, 2025
28163ba
build(deps): update dependencies
Jan 13, 2025
e7a0f2c
build(deps): remove karma
Jan 13, 2025
adea8a5
build(deps): update Jest setup and TypeScript configuration
Jan 13, 2025
58bd9db
build(deps): upgrade playwright to version 1.49.1
Jan 13, 2025
035988d
build(deps): upgrade husky to version 9.1.7
Jan 13, 2025
f21c75a
build(deps): add Prettier and organize imports plugin
Jan 13, 2025
ef71e35
build(deps): update peer dependencies for Angular and RxJS
Jan 13, 2025
3dd8e7b
fix(lint): add eslint and apply fixes
Jan 13, 2025
3280f49
fix(examples): replace app-root with sc-root in index.html
Jan 13, 2025
c24ca54
fix(forms): enhance error handling and retry logic in form directives…
Jan 13, 2025
87aa580
build(deps): add eslint-plugin-unicorn and apply auto fixes
Jan 13, 2025
4823aba
build(scripts): update start script and reorganize and rename npm scr…
Jan 13, 2025
0b81480
fix(directives): implement AfterViewInit lifecycle hook in FormDirective
Jan 13, 2025
a2ad589
build(deps): update angular to 19.1.x
Jan 27, 2025
a2f2ed3
build(deps): upgrade storybook to 8.5.2
Jan 27, 2025
0ae4725
build(deps): update eslint, jest-preset-angular, postcss, and typescr…
Jan 27, 2025
ea0b91a
build(deps): update playwright to version 1.50.0
Jan 27, 2025
7b13b8b
refactor(components): remove CommonModule from imports
Jan 27, 2025
5ae7da2
build(deps): add storybook scripts to package.json
Jan 28, 2025
cd860d3
style: apply formatting
Jan 30, 2025
db6cd2b
build(deps): update Angular dependencies to version 19.1.5
Feb 8, 2025
78ab4cc
build(deps): update Storybook dependencies to version 8.5.3
Feb 8, 2025
b19ee28
build(deps): update playwright to version 1.50.1
Feb 8, 2025
cbb2f1b
build(deps): update commitlint, eslint, and typescript-eslint to late…
Feb 8, 2025
a1c9f80
build(deps): update devDependencies
Feb 10, 2025
3b18a75
chore: update compodoc documentation.json
Feb 10, 2025
39c91a9
build(deps): add prettier-plugin-tailwindcss and vscode-tailwindcss e…
Feb 27, 2025
680d458
build(deps): update Angular and related packages to version 19.2.0
Feb 27, 2025
14b7c55
build(deps): update dependencies
Feb 27, 2025
ef593d1
build(deps): add prettier-plugin-tailwindcss and update styles in com…
Feb 27, 2025
95db2fd
build(deps): update Storybook and related packages to version 8.6.3
Mar 1, 2025
261b582
build(deps): update typescript to version 5.8.2
Mar 1, 2025
ba1b923
build(deps): update angular-eslint to version 19.2.0 and typescript-e…
Mar 3, 2025
d755d9f
build(deps): update Angular packages to version 19.2.1
Mar 10, 2025
e720f66
chore(vscode): add commit message guidelines for Copilot usage
Mar 10, 2025
f4472ae
build(deps): update Storybook packages to version 8.6.4
Mar 10, 2025
91616c9
build(deps): update Angular packages to version 19.2.3
Mar 23, 2025
da86d03
build(deps): update commitlint packages to version 19.8.0
Mar 23, 2025
9aef523
build(deps): update autoprefixer and prettier versions
Mar 23, 2025
278111d
build(deps): update playwright to version 1.51.1
Mar 23, 2025
5d3efb4
build(deps): update Storybook packages to version 8.6.8
Mar 23, 2025
05789b3
build(deps): update eslint and related packages to version 9.23.0
Mar 23, 2025
1463f79
build(deps): update Storybook packages to version 8.6.10
Mar 26, 2025
2907ea8
build(deps): update Angular CLI and related packages to 19.2.5
Mar 26, 2025
7dc04ff
chore(deps): update Angular and related dependencies to latest patch …
Apr 4, 2025
ea78ee8
chore: update Storybook dependencies to version 8.6.12
Apr 4, 2025
bcad014
chore(scripts): update start script to include examples
Apr 4, 2025
da2a289
build(deps): update Angular and related dependencies to latest versions
Apr 10, 2025
4ed13b8
build(vscode): add /improve copilot instructions
Apr 10, 2025
4462684
build(vscode): add comprehensive testing instructions for Playwright,…
Apr 10, 2025
6a4127e
build(vscode): add ms-playwright extension to recommendations
Apr 10, 2025
1df46e5
build(vscode): add workspace settings
Apr 10, 2025
9c3ee63
refactor: update ESLint to ESM
Apr 10, 2025
003c139
build(test): migrate from jest to vitest
Apr 10, 2025
13a9f0b
build(test): use vitest browser ui
Apr 10, 2025
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
9 changes: 0 additions & 9 deletions .commitlintrc.js

This file was deleted.

126 changes: 126 additions & 0 deletions .github/instructions/copilot-commit.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Copilot Commit Instructions

## Commit Messages

### 1. Adhere to the Conventional Commits Specification

#### a. Structure

- `<type>(<scope>): <description> [optional body] [optional footer]`

#### b. Types

- **feat**: New feature
- **fix**: Bug fix
- **docs**: Documentation changes
- **style**: Code style changes (formatting, whitespace, etc.)
- **refactor**: Code restructuring (no functional changes)
- **test**: Test-related changes (adding, modifying, or removing tests)
- **chore**: Miscellaneous tasks (build, dependencies, configuration changes)
- **build**: Changes related to the build system or dependencies (e.g., `package.json`, `Dockerfile`, `.vscode/*`)
- **ci**: Changes related to Continuous Integration/Continuous Deployment pipelines
- **perf**: Performance improvements
- **revert**: Revert a previous commit

#### c. Scope

- Context of the change. Use a concise, lowercase name related to the relevant part of the codebase. Preferably based on the project structure.
- **Examples**:
- `user-authentication`
- `product-page`
- `api`
- `vonnis/raadplegen`
- `ui/button`
- Use the `project.json` name or a small part of the domain/folder structure for consistency and easy searching.

#### d. Description (Summary)

- Concise and clear, under 80 characters.
- Written in the imperative mood (e.g., "Add login form", "Fix button alignment").
- Completes the sentence: "This commit will..." (e.g., "This commit will add disabled button styling").
- Use a single line for the summary. If you need to provide more details, use the body section.

#### e. Body

- Provide a more detailed explanation of the changes.
- Explain the "why" and "how."
- Use multiple paragraphs if needed.
- Can include code snippets or examples.
- Don't do this per file, but per functionality. For example, if you change the button and the input field, use `ui/button` as scope and describe both changes in the description.

#### f. Footer

- References to issues (e.g., `Closes #123`, `See #456 for more details`).
- Pull request links.
- Breaking changes (use `BREAKING CHANGE:` prefix followed by a clear description of the impact, e.g., `BREAKING CHANGE: API endpoint renamed from /users to /customers`).

---

### 2. Keep Commit Messages Concise

#### a. Summary

- Maximum 80 characters. Focus on the core change.

#### b. Body

- Use the body for any additional details that don't fit in the concise summary.

---

### 3. Use the Imperative Mood

#### a. Summary

- Always use the imperative mood (e.g., "Add feature", "Fix bug", "Refactor code").

#### b. Body

- While the imperative mood is generally preferred, the past tense can be used in the body to describe actions that have already been taken as part of the change. Maintain a consistent tone within the body.

---

### 4. Provide Context and Details

#### a. Scope

- Use scopes to clearly identify the affected area of the codebase. This helps with searching, filtering, and understanding the impact of changes.

#### b. Body

- Explain the reasoning behind the changes, any alternative solutions considered, and any trade-offs made.

#### c. Footer

- Link to relevant issues, pull requests, or related documentation.

---

### 5. Separate Subject and Body

- Always include a blank line between the summary (first line) and the body. This improves readability.

---

### 6. Format Messages for Readability

#### a. Line Length

- Keep lines under 72 characters (including in the body and footer) to avoid wrapping in terminals and other tools.

#### b. Lists/Bullet Points

- Use lists or bullet points in the body to organize multiple changes or points. This makes the body easier to scan and understand.

#### c. Paragraphs

- Separate paragraphs with blank lines for better readability, especially in longer commit messages.

---

### LLM-Specific Guidelines

- Generate commit messages based on the changes made in the code.
- Ensure the message is concise, clear, and follows the Conventional Commits format.
- Link to relevant issues or pull requests in the footer when applicable.
- Use the body to explain the "why" and "how" of the changes, especially for complex updates.
134 changes: 134 additions & 0 deletions .github/instructions/copilot-test.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Testing

## E2E - Playwright

<https://playwright.dev/docs/best-practices>

Core Expertise and Style

1. Domain Expertise: You are an expert in TypeScript, Frontend development, and Playwright end-to-end testing.

- Your code must reflect a deep understanding of Playwright’s APIs, configuration options, and recommended testing patterns.
- Always use strongly typed variables and parameters, leveraging TypeScript’s type system to provide robust and self-documenting code.

2. Code Quality and Precision:

- Write code that is concise, idiomatic, and maintainable.
- Ensure that your examples compile without errors and adhere to TypeScript strict mode.
- Do not add superfluous comments or explanations; the code should be self-explanatory and aligned with Playwright best practices.
- When asked to refactor tests, never remove existing tests and always make sure to test the same functionality as the original test.

3. Use of Locators and Selectors:

- Always prefer built-in and role-based locators (`getByRole`, `getByLabelText`, `getByPlaceholder`, etc.) over custom CSS selectors unless absolutely necessary.
- Ensure selectors are stable and maintainable, avoiding overly complex or brittle queries.

4. Web-First Assertions and Waiting:

- Use Playwright’s built-in web-first assertions (`expect(locator).toHaveText()`, `expect(locator).toBeVisible()`, etc.) wherever possible to ensure reliable tests without arbitrary `waitFor` or hardcoded timeouts.
- Avoid using `page.waitForTimeout()` or other explicit delays unless there is no alternative. If a delay is needed, first consider other synchronization techniques recommended by Playwright.

5. Configuration and Devices:

- Utilize Playwright’s built-in configuration options and presets (e.g., devices) to ensure consistent and cross-browser coverage.
- Always store and reuse configuration details in a central configuration file (`playwright.config.ts`) or well-structured fixture setups.

6. Page Object Models (POM) and Reusability:

- For Page Object Models, encapsulate selectors and actions in dedicated classes, ensuring they provide a clear, intuitive API for tests.
- Reuse Playwright locators by storing them in variables or class fields, preventing duplication and increasing maintainability.
- Keep POM methods small and focused, handling a single action or query at a time.

7. Fixtures and Test Setup:

- Implement fixtures to provide consistent environment setup and teardown, minimizing repetition across tests.
- Use `test.beforeEach` and `test.afterEach` hooks to maintain a clean, isolated testing environment for each test run.

8. No Unnecessary Comments or Logs:

- Avoid commenting the Playwright code, unless absolutely required for clarifying complex logic. The code should be inherently understandable through clear naming and structure.
- Do not include extraneous `console.log()` statements or debugging code.

9. Follow Official Best Practices:

- Adhere to the official Playwright documentation and recommendations found at <https://playwright.dev>.
- Reflect the current recommended Playwright patterns for stable, reliable end-to-end testing.

10. Testing Style and Structure:
- Organize test files logically and use descriptive test names.
- Each test should focus on a single piece of functionality or user flow scenario.
- Make use of `test.describe` blocks to group related tests, and `test.step` calls where appropriate for structured test reporting.

- Target high code coverage for e2e flows by covering critical paths.

In summary: Write TypeScript-based Playwright tests, page objects, fixtures, and configurations that are concise, type-safe, and follow official best practices. Use recommended selectors and web-first assertions, employ reusable locators, leverage built-in devices and configuration options, and produce consistent, maintainable, and reliable code without unnecessary comments.

## Integration / Component testing - Storybook

<https://storybook.js.org/docs/6/writing-tests/interaction-testing>

- Use Storybook interaction tests
- Write clear and concise Tests:
- Avoid overly complex test setups and assertions.
- Use clear and concise test descriptions to explain the purpose of each test.
- Use Storybook's interaction testing features to simulate user interactions.
- Prefer the getByRole() selectors etc over the getByTestId() selectors to interact with components and assert their state
- do not use `@storybook/jest` but use the new default: `@storyook/test`
- keep accessibility in mind while writing tests
- Isolate Component Behavior
- Test individual components in isolation to ensure they function correctly.
- Focus on User Interactions:
- Test how users interact with components, such as clicking buttons, filling out forms, and triggering events.
- Prefer `userEvent` over `fireEven()` to simulate user interactions accurately
- Use @testing-library/angular:
- Leverage @testing-library/angular for testing Angular components within Storybook.

- Aim for thorough coverage in integration tests to catch cross-component issues.

## Unit testing - Vitest & Testing Library for Angular

### Core Technologies

- Vitest: <https://vitest.dev/guide/>
- Testing Library for Angular: <https://testing-library.com/docs/angular-testing-library/intro/>

### Test Structure & Style

- Write focused, single-behavior tests following the Arrange-Act-Assert pattern
- Group related tests in descriptive `describe` blocks with clearly named test cases
- Use TypeScript strict mode for all test files
- Render and interact with Angular components using @testing-library/angular

### Component Testing

- Inject mock signals when testing components with Angular Signals
- Prefer role-based selectors (`getByRole`) for accessibility and stability
- Test critical paths and edge cases to achieve high coverage
- Mock external dependencies using Vitest's mocking capabilities or MSW

### Browser-Specific Testing

Use Vitest Browser mode with these features:

1. **Configuration**
- Set `browser.enabled: true` in Vitest config
- Use `playwright` or `webdriverio` as provider

2. **Browser Context API**
- Manage isolated test environments
- Reference: <https://main.vitest.dev/guide/browser/context.html>

3. **Interactivity API**
- Simulate user interactions (clicks, typing, scrolling)
- Reference: <https://main.vitest.dev/guide/browser/interactivity-api.html>

4. **Locator API**
- Prefer role-based locators for accessibility alignment
- Use `getByTestId` only when other locators are insufficient
- Chain locators with filters for precise targeting
- Reference: <https://main.vitest.dev/guide/browser/locators.html>

5. **Assertion API**
- Use `expect.element` for retry-ability to reduce flakiness
- Validate DOM states, accessibility attributes, and form validity
- Reference: <https://main.vitest.dev/guide/browser/assertion-api.html>
Loading
Loading