You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 2.x:
[Toolkit] Delay/hide the "Community Kits" feature, minor fixes
[Site] Fix port to 9044 and upgrade UX dependencies
[Docs] Fix `composer config` to avoid modifying `package.json` automatically
Refactor "test_package.sh" to its original purpose, add multiples checks for packages definition
Enhance PR template with deprecation and documentation fields
[Icons] explain svg colors and improve example configuration
[Docs] Add doc for E2E steps + minor modifications
[Site] Lock icons
peerDependencyVersion=$(jq -r --arg dep "$peerDependency" '.peerDependencies[$dep]' "$file")
116
+
importmapVersion=$(jq -r ".symfony.importmap.\"$peerDependency\" | if type == \"string\" then . else .version end" "$file")
117
+
118
+
if [ "$importmapVersion" == null ]; then
119
+
echo "File $file does not have the peerDependency '$peerDependency' in its symfony.importmap, skipping version check";
120
+
continue
121
+
fi
122
+
123
+
if [ "$peerDependencyVersion" != "$importmapVersion" ]; then
124
+
echo "File $file has a mismatch for $peerDependency: peerDependency version is '$peerDependencyVersion' but symfony.importmap version is '$importmapVersion'";
125
+
exit 1;
126
+
fi
127
+
done
128
+
done
129
+
22
130
coding-style-js:
23
131
name: JavaScript Coding Style
24
132
runs-on: ubuntu-latest
@@ -68,7 +176,7 @@ jobs:
68
176
69
177
# TODO: Only Turbo has PHPStan configuration, let's improve this later :)
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,18 +83,64 @@ To help you with assets, you can run the following commands in a specific packag
83
83
-`pnpm run watch`: watch for modifications and rebuild assets from the package,
84
84
-`pnpm run test`: run the tests from the package,
85
85
-`pnpm run test:unit`: run the Unit tests from the package,
86
-
-`pnpm run test:browser`: run the Browser tests from the package,
86
+
-`pnpm run test:browser`: run the Browser tests from the package, in a headless browser
87
+
-`pnpm run test:browser:ui`: run the Browser tests from the package in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
87
88
-`pnpm run check`: run the formatter, linter, and sort imports, and fails if any modifications
88
89
-`pnpm run check --write`: run the formatter, linter, imports sorting, and write modifications
89
90
90
91
Thanks to [PNPM Workspaces](https://pnpm.io/workspaces), you can also run these commands from the root directory of the project:
91
92
-`pnpm run build`: build (compile) assets from **all** packages,
92
93
-`pnpm run test`: run the tests from **all** packages,
93
94
-`pnpm run test:unit`: run the Unit tests from **all** packages,
94
-
-`pnpm run test:browser`: run the Browser tests from **all** packages,
95
+
-`pnpm run test:browser`: run the Browser tests from **all** packages, in a headless browser
95
96
-`pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
96
97
-`pnpm run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
97
98
99
+
#### Working with Unit tests
100
+
101
+
We use [Vitest](https://vitest.dev/) for unit testing of the assets,
102
+
and tests files are located in the `assets/test/unit/` directory of each UX package,
103
+
for example: `src/Vue/assets/test/unit/render_controller.test.ts`.
104
+
105
+
**Running tests:**
106
+
- At the project's root, you can run the following commands:
107
+
-`pnpm run test:unit`: runs the unit tests for **all** UX packages
108
+
- Inside the `assets/` directory of each UX package, you can run the following commands:
109
+
-`pnpm run test:unit`: runs the unit tests for the package
110
+
111
+
> [!IMPORTANT]
112
+
> The command `pnpm run test:unit` ensure that each possible combination of dependencies is tested
113
+
> (e.g., `"chart.js": "^3.4.1 || ^4.0"` for UX Chartjs).
114
+
> Thus it may take some time to run, and it may be not recommended to use watch mode.
115
+
116
+
#### Working with End-to-End (E2E) tests
117
+
118
+
> [!NOTE]
119
+
> E2E tests simulate real user interactions in a browser, to ensure that the
120
+
> UX packages work as expected in a real-world scenario.
121
+
122
+
Symfony UX use [Playwright](https://playwright.dev/) for browser automation and testing,
123
+
and a dedicated Symfony application located in the [`apps/e2e/`](./apps/e2e/) directory,
124
+
which contains many examples of Symfony UX packages usage.
125
+
126
+
Tests files are located in the `assets/test/browser/` directory of each UX package,
127
+
for example: `src/Vue/assets/test/browser/vue.test.ts`.
128
+
129
+
**Setup:**
130
+
1. Ensure to have followed the steps in the [Setting up the development environment](#setting-up-the-development-environment) section
131
+
2. Read and follow the instructions in the [`apps/e2e/README.md`](./apps/e2e/README.md) file,
132
+
133
+
**Running tests:**
134
+
- At the project's root, you can run the following commands:
135
+
-`pnpm run test:browser`: runs the browser tests for **all** UX packages, using a headless browser
136
+
- Inside the `assets/` directory of each UX package, you can run the following commands:
137
+
-`pnpm run test:browser`: runs browser tests for the package, using a headless browser
138
+
-`pnpm run test:browser:ui`: runs the browser tests in interactive mode, allowing you to see the tests running in a browser window and debug them if needed
139
+
140
+
> [!IMPORTANT]
141
+
> Due to their nature, E2E tests may be slower to run than unit tests.
142
+
> During the development, we recommend to run `pnpm run test:browser` or `pnpm run test:browser:ui` for a specific UX package.
143
+
98
144
### Working on documentation
99
145
100
146
Symfony UX documentation is written in ReStructuredText (`.rst`) and is located in the `docs/` directory
**Tip:** Your `package.json` file will be automatically modified by [Flex](https://github.com/symfony/flex) when installing or upgrading a PHP package. To prevent this behavior, ensure to **use at least Flex 1.22.0 or 2.5.0**, and run `composer config extra.symfony.flex.synchronize_package_json false`.
17
+
**Tip:** Your `package.json` file will be automatically modified by [Flex](https://github.com/symfony/flex) when installing or upgrading a PHP package. To prevent this behavior, ensure to **use at least Flex 1.22.0 or 2.5.0**, and run `composer config "extra.symfony/flex.synchronize_package_json" false`.
**Tip:** Your `package.json` file will be automatically modified by [Flex](https://github.com/symfony/flex) when installing or upgrading a PHP package. To prevent this behavior, ensure to **use at least Flex 1.22.0 or 2.5.0**, and run `composer config extra.symfony.flex.synchronize_package_json false`.
17
+
**Tip:** Your `package.json` file will be automatically modified by [Flex](https://github.com/symfony/flex) when installing or upgrading a PHP package. To prevent this behavior, ensure to **use at least Flex 1.22.0 or 2.5.0**, and run `composer config "extra.symfony/flex.synchronize_package_json" false`.
**Tip:** Your `package.json` file will be automatically modified by [Flex](https://github.com/symfony/flex) when installing or upgrading a PHP package. To prevent this behavior, ensure to **use at least Flex 1.22.0 or 2.5.0**, and run `composer config extra.symfony.flex.synchronize_package_json false`.
17
+
**Tip:** Your `package.json` file will be automatically modified by [Flex](https://github.com/symfony/flex) when installing or upgrading a PHP package. To prevent this behavior, ensure to **use at least Flex 1.22.0 or 2.5.0**, and run `composer config "extra.symfony/flex.synchronize_package_json" false`.
0 commit comments