@describe-me/core 0.5.0-next.2 → 0.5.0
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/dist/manifest-diagnostics.d.ts +2 -1
- package/dist/manifest-diagnostics.js +4 -1
- package/dist/recorder.d.ts +5 -1
- package/dist/recorder.js +9 -1
- package/dist/types.d.ts +37 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Manifest, type ManifestDiagnostics } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* List what the manifest could not document: anonymous components, named ones
|
|
4
|
-
* without props,
|
|
4
|
+
* without props, assets that will not load, font families that nothing loads
|
|
5
|
+
* and hosts that frames load stylesheets from. The reporter prints it after a
|
|
5
6
|
* run and the viewer shows it in the header, so both agree on what is missing.
|
|
6
7
|
*/
|
|
7
8
|
export declare function manifestDiagnostics(manifest: Manifest): ManifestDiagnostics;
|
|
@@ -5,7 +5,8 @@ function isHostElement(name) {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* List what the manifest could not document: anonymous components, named ones
|
|
8
|
-
* without props,
|
|
8
|
+
* without props, assets that will not load, font families that nothing loads
|
|
9
|
+
* and hosts that frames load stylesheets from. The reporter prints it after a
|
|
9
10
|
* run and the viewer shows it in the header, so both agree on what is missing.
|
|
10
11
|
*/
|
|
11
12
|
export function manifestDiagnostics(manifest) {
|
|
@@ -30,5 +31,7 @@ export function manifestDiagnostics(manifest) {
|
|
|
30
31
|
anonymous,
|
|
31
32
|
undocumented: Array.from(undocumented, ([name, tests]) => ({ name, tests })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
32
33
|
assetsMissing: manifest.assetsMissing ?? [],
|
|
34
|
+
fontsMissing: manifest.fontsMissing ?? [],
|
|
35
|
+
remoteStylesheets: manifest.remoteStylesheets ?? [],
|
|
33
36
|
};
|
|
34
37
|
}
|
package/dist/recorder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CaptureOptions, type ComponentInfo, type FrameKind, type RecorderOptions, type TestRecord } from './types.js';
|
|
2
2
|
type Teardown = () => void;
|
|
3
3
|
/**
|
|
4
4
|
* Test-side recorder, running wherever the tests run: the browser-mode iframe
|
|
@@ -31,6 +31,10 @@ declare class Recorder {
|
|
|
31
31
|
* selector throws.
|
|
32
32
|
*/
|
|
33
33
|
configure(options: RecorderOptions): void;
|
|
34
|
+
/**
|
|
35
|
+
* Name the component the test documents. The first name stays, unless it is
|
|
36
|
+
* `Anonymous` and `info` is not, or it has no `file` and `info` has one.
|
|
37
|
+
*/
|
|
34
38
|
setComponent(info: ComponentInfo): void;
|
|
35
39
|
capture(kind: FrameKind, label: string, meta?: Record<string, unknown>, options?: CaptureOptions): Promise<void>;
|
|
36
40
|
/**
|
package/dist/recorder.js
CHANGED
|
@@ -4,6 +4,7 @@ import { PendingRender } from './pending-render.js';
|
|
|
4
4
|
import { realTimers } from './real-timers.js';
|
|
5
5
|
import { serializeDocument } from './serialize-document.js';
|
|
6
6
|
import { settle } from './settle.js';
|
|
7
|
+
import { ANONYMOUS_COMPONENT, } from './types.js';
|
|
7
8
|
/** Fails in the setup file rather than in the first test that renders. */
|
|
8
9
|
function assertValidSelector(selector) {
|
|
9
10
|
if (typeof document === 'undefined') {
|
|
@@ -69,8 +70,15 @@ class Recorder {
|
|
|
69
70
|
}
|
|
70
71
|
this.renderFrame = renderFrame;
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Name the component the test documents. The first name stays, unless it is
|
|
75
|
+
* `Anonymous` and `info` is not, or it has no `file` and `info` has one.
|
|
76
|
+
*/
|
|
72
77
|
setComponent(info) {
|
|
73
|
-
|
|
78
|
+
const current = this.component;
|
|
79
|
+
const addsFile = current?.file === undefined && info.file !== undefined;
|
|
80
|
+
const namesAnonymous = current?.name === ANONYMOUS_COMPONENT && info.name !== ANONYMOUS_COMPONENT;
|
|
81
|
+
if (!current || namesAnonymous || addsFile) {
|
|
74
82
|
this.component = info;
|
|
75
83
|
}
|
|
76
84
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -105,7 +105,14 @@ export interface ManifestFrame {
|
|
|
105
105
|
snapshot: string;
|
|
106
106
|
}
|
|
107
107
|
export interface ManifestTest {
|
|
108
|
+
/**
|
|
109
|
+
* Stable across runs and machines: the first 12 hex characters of a SHA-1 of
|
|
110
|
+
* the module path, the suite path, the name and, for a repeated name, its
|
|
111
|
+
* occurrence. Before 0.5 it was Vitest's id.
|
|
112
|
+
*/
|
|
108
113
|
id: string;
|
|
114
|
+
/** Vitest's `TestCase.id` in the run that recorded the test. Absent in manifests written before 0.5. */
|
|
115
|
+
vitestId?: string;
|
|
109
116
|
name: string;
|
|
110
117
|
/** suite names from outermost to innermost */
|
|
111
118
|
path: string[];
|
|
@@ -169,6 +176,32 @@ export interface Manifest {
|
|
|
169
176
|
* Absent when `previewHead` is not set.
|
|
170
177
|
*/
|
|
171
178
|
head?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Font families that frames use but nothing loads, most tests first. Absent
|
|
181
|
+
* in manifests written before 0.5, which counts as empty.
|
|
182
|
+
*/
|
|
183
|
+
fontsMissing?: FontMissing[];
|
|
184
|
+
/**
|
|
185
|
+
* Hosts that frames load stylesheets from, most frames first. Absent in
|
|
186
|
+
* manifests written before 0.5, which counts as empty.
|
|
187
|
+
*/
|
|
188
|
+
remoteStylesheets?: RemoteStylesheet[];
|
|
189
|
+
}
|
|
190
|
+
/** A font family that the captured CSS uses but no `@font-face`, font stylesheet or preview head loads. */
|
|
191
|
+
export interface FontMissing {
|
|
192
|
+
/** The family as first spelled in manifest order. */
|
|
193
|
+
family: string;
|
|
194
|
+
/** Tests with at least one frame that misses it. */
|
|
195
|
+
tests: number;
|
|
196
|
+
/** `ManifestTest.id` of the first such test, in manifest order. */
|
|
197
|
+
testId: string;
|
|
198
|
+
}
|
|
199
|
+
/** A host that frames load stylesheets from, which the viewer fetches from the network. */
|
|
200
|
+
export interface RemoteStylesheet {
|
|
201
|
+
/** The URL's hostname. */
|
|
202
|
+
host: string;
|
|
203
|
+
/** Frames that link or import at least one stylesheet from it. */
|
|
204
|
+
frames: number;
|
|
172
205
|
}
|
|
173
206
|
/** The name adapters fall back to when a component has no usable name. */
|
|
174
207
|
export declare const ANONYMOUS_COMPONENT: "Anonymous";
|
|
@@ -186,4 +219,8 @@ export interface ManifestDiagnostics {
|
|
|
186
219
|
}[];
|
|
187
220
|
/** Asset paths that will not load in the viewer, root-relative or in the `/@fs/` form. */
|
|
188
221
|
assetsMissing: string[];
|
|
222
|
+
/** Font families that frames use but nothing loads. */
|
|
223
|
+
fontsMissing: FontMissing[];
|
|
224
|
+
/** Hosts that frames load stylesheets from. */
|
|
225
|
+
remoteStylesheets: RemoteStylesheet[];
|
|
189
226
|
}
|