@describe-me/react 0.5.1 → 0.5.3
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
|
@@ -19,7 +19,7 @@ pnpm add -D @describe-me/react
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
All describe-me packages must be on the same version
|
|
22
|
-
([
|
|
22
|
+
([One version for all packages](https://grzehub.github.io/describe-me/installation.html#lockstep)).
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ recording functions swapped in, so switching an existing test is one import.
|
|
|
29
29
|
`fireEvent` and `cleanup`: every `fireEvent` call records a frame, and
|
|
30
30
|
`cleanup` takes the closing frame before it unmounts. When the render frame is
|
|
31
31
|
taken follows the plugin's
|
|
32
|
-
[`renderFrame`](https://github.
|
|
32
|
+
[`renderFrame`](https://grzehub.github.io/describe-me/configuration.html#render-frame)
|
|
33
33
|
option.
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
@@ -51,5 +51,4 @@ the plugin redirects `vitest-browser-react` or `@testing-library/react` imports
|
|
|
51
51
|
to the matching entry point, including imports made from your own
|
|
52
52
|
`test-utils` wrapper, so tests record frames unchanged.
|
|
53
53
|
|
|
54
|
-
See the [
|
|
55
|
-
full picture.
|
|
54
|
+
See the [docs](https://grzehub.github.io/describe-me/) for the full picture.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leave a check on `globalThis` that holds while @testing-library/dom keeps the
|
|
3
|
+
* `asyncWrapper` @testing-library/react installed, so a user-event call drains
|
|
4
|
+
* a macrotask before it resolves. A global, because @describe-me/vitest reads it
|
|
5
|
+
* and does not depend on this package.
|
|
6
|
+
*/
|
|
7
|
+
export declare function publishTestingLibraryAct(): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getConfig } from '@testing-library/react';
|
|
2
|
+
// `testing-library-wraps-in-act.ts` in @describe-me/vitest reads this key.
|
|
3
|
+
const ACT_CHECK = Symbol.for('describe-me.testing-library-act');
|
|
4
|
+
/**
|
|
5
|
+
* Leave a check on `globalThis` that holds while @testing-library/dom keeps the
|
|
6
|
+
* `asyncWrapper` @testing-library/react installed, so a user-event call drains
|
|
7
|
+
* a macrotask before it resolves. A global, because @describe-me/vitest reads it
|
|
8
|
+
* and does not depend on this package.
|
|
9
|
+
*/
|
|
10
|
+
export function publishTestingLibraryAct() {
|
|
11
|
+
const installed = getConfig().asyncWrapper;
|
|
12
|
+
const host = globalThis;
|
|
13
|
+
host[ACT_CHECK] = () => getConfig().asyncWrapper === installed;
|
|
14
|
+
}
|
|
@@ -3,9 +3,11 @@ import { isValidElement } from 'react';
|
|
|
3
3
|
import { recorder } from '@describe-me/core';
|
|
4
4
|
import { describeRendered } from './describe-rendered.js';
|
|
5
5
|
import { labelFor } from './label-for.js';
|
|
6
|
+
import { publishTestingLibraryAct } from './publish-testing-library-act.js';
|
|
6
7
|
// On import rather than in `render()`, so a file that only calls `renderHook`
|
|
7
|
-
// is unmounted after each test too.
|
|
8
|
+
// is unmounted after each test too, and its user-event frames skip the settle.
|
|
8
9
|
recorder.onTeardown(unmountAll);
|
|
10
|
+
publishTestingLibraryAct();
|
|
9
11
|
/**
|
|
10
12
|
* Drop-in for `render` from @testing-library/react (jsdom and other DOM
|
|
11
13
|
* environments). Records a frame after mount and after every `rerender`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@describe-me/react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "React adapter for describe-me: drop-in render functions that record frames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vitest",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"./dist/render-testing-library.js"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@describe-me/core": "^0.5.
|
|
49
|
+
"@describe-me/core": "^0.5.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@testing-library/react": "^16.0.0",
|
|
53
53
|
"react": "^18.0.0 || ^19.0.0",
|
|
54
54
|
"vitest-browser-react": "^2.0.0",
|
|
55
|
-
"@describe-me/vitest": "^0.5.
|
|
55
|
+
"@describe-me/vitest": "^0.5.3"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@testing-library/react": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react-dom": "^19.3.0",
|
|
72
72
|
"vitest": "^5.0.1",
|
|
73
73
|
"vitest-browser-react": "^2.3.0",
|
|
74
|
-
"@describe-me/vitest": "^0.5.
|
|
74
|
+
"@describe-me/vitest": "^0.5.3"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "rimraf dist && tsc -p tsconfig.json"
|