@thisisagile/easy-test-react 20.1.1 → 20.1.2
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 +11 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -280,3 +280,14 @@ The `@requires` decorator group also contains `@requires.labCoat()` this decorat
|
|
|
280
280
|
|
|
281
281
|
To use these decorators, the generic `security` middleware must be loaded first. In most cases, it should be added to the `pre` list of handlers of a service.
|
|
282
282
|
The security middleware takes an optional configuration object, which is documented [in code](packages/easy-express/src/express/SecurityHandler.ts).
|
|
283
|
+
|
|
284
|
+
## Side effects and tree shaking
|
|
285
|
+
Every package declares `sideEffects` in its `package.json`, so a bundler only keeps the modules a consumer actually uses. Contributors keep that declaration true by following these rules:
|
|
286
|
+
|
|
287
|
+
- **No module-level mutation of anything outside the module.** Do not patch globals, prototypes or imported objects when a module loads. If something must be configured, configure it in the module that needs it, so it is kept exactly when that module is used.
|
|
288
|
+
- **Catalogue values are pure factories.** Build enum and catalogue values with plain constructors or factory calls that only create objects, so an unused value can be dropped.
|
|
289
|
+
- **A module that must run for its effect on import is listed explicitly.** `easy-test` lists its index and matcher files because `import '@thisisagile/easy-test'` exists to call `expect.extend`. `easy-test-react` lists its index because importing it mocks the timezone. Runtime packages declare `false`.
|
|
290
|
+
- **`DateTime` and `Meta` are deliberately not listed.** `DateTime` extends Day.js and `Meta` loads `reflect-metadata` at module level, but only their own exports need that setup. Bundlers keep a module's top-level code whenever any of its exports are used, so they stay correct unlisted. Listing them would make every root import, such as `isDefined`, pay for Day.js and `reflect-metadata`.
|
|
291
|
+
- **No `emitDecoratorMetadata`.** Nothing in easy reads `design:` metadata; decorators store what they need under their own keys.
|
|
292
|
+
|
|
293
|
+
`test/bundle/workspaces.mjs` checks these rules against the packed packages.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-test-react",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.2",
|
|
4
4
|
"description": "Straightforward wrapper library for testing-library/react",
|
|
5
5
|
"author": "Sander Hoogendoorn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,10 @@
|
|
|
27
27
|
"test": "yarn g:jest --coverage",
|
|
28
28
|
"prepack": "yarn g:copy-readme"
|
|
29
29
|
},
|
|
30
|
-
"sideEffects":
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"./dist/index.js",
|
|
32
|
+
"./src/index.ts"
|
|
33
|
+
],
|
|
31
34
|
"files": [
|
|
32
35
|
"dist",
|
|
33
36
|
"src"
|
|
@@ -47,7 +50,7 @@
|
|
|
47
50
|
"@testing-library/dom": "^10.4.0",
|
|
48
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
52
|
"@testing-library/react": "^16.3.0",
|
|
50
|
-
"@thisisagile/easy": "^20.1.
|
|
53
|
+
"@thisisagile/easy": "^20.1.2",
|
|
51
54
|
"@types/react": "^18.3.18",
|
|
52
55
|
"react": "^18.3.1",
|
|
53
56
|
"react-dom": "^18.3.1"
|