@jterrazz/test 15.3.0 → 16.1.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/README.md +120 -427
- package/dist/appium.adapter.js +71 -15
- package/dist/artifacts.js +25 -1735
- package/dist/browser/index.js +304 -233
- package/dist/checker.d.ts +1 -1
- package/dist/checker.js +1103 -97
- package/dist/fixtures.js +110 -0
- package/dist/index.d.ts +956 -971
- package/dist/index.js +2159 -2281
- package/dist/literate.js +1747 -0
- package/dist/match.js +625 -84
- package/dist/oxlint.cjs +3585 -1480
- package/dist/oxlint.d.cts +60 -48
- package/dist/oxlint.d.ts +60 -48
- package/dist/oxlint.js +3585 -1480
- package/dist/playwright.adapter.js +51 -8
- package/dist/{intercept.js → server.js} +2 -2
- package/dist/stream.js +6 -6
- package/dist/{ambiguity.js → substring-warning.js} +106 -7
- package/dist/vitest.d.ts +67 -48
- package/dist/vitest.js +229 -93
- package/docs/01-architecture.md +95 -0
- package/docs/02-developing.md +351 -0
- package/docs/03-testing.md +495 -0
- package/docs/04-operating.md +101 -0
- package/docs/05-module-tests.md +152 -0
- package/docs/06-integration.md +180 -0
- package/docs/07-component.md +246 -0
- package/docs/08-website.md +404 -0
- package/docs/09-mobile.md +270 -0
- package/docs/10-api.md +264 -0
- package/docs/11-jobs.md +157 -0
- package/docs/12-cli.md +677 -0
- package/docs/13-elements.md +242 -0
- package/docs/14-assertions.md +314 -0
- package/docs/15-tokens.md +253 -0
- package/docs/16-contracts.md +438 -0
- package/docs/17-services.md +188 -0
- package/docs/18-conventions.md +305 -0
- package/docs/19-linting.md +510 -0
- package/docs/README.md +36 -0
- package/docs/decisions/001-v9-conventions-on-three-channels.md +50 -0
- package/docs/decisions/002-the-statique-channel-holds-only-what-upstream-does-not.md +49 -0
- package/docs/decisions/003-a-rendered-component-is-a-facet-on-vitest-browser-mode.md +84 -0
- package/docs/decisions/004-a-module-against-real-services-or-a-golden-is-the-integration-facet.md +81 -0
- package/docs/decisions/005-the-doubles-ladder-is-closed.md +86 -0
- package/docs/decisions/006-the-catalogue-reaches-a-file-by-its-role.md +245 -0
- package/docs/decisions/007-compose-mode-leaves-the-package.md +53 -0
- package/docs/decisions/008-vitest-5-node-24-and-the-native-seams-as-optional-peers.md +75 -0
- package/docs/decisions/_template.md +22 -0
- package/docs/reference/classes/Matcher.md +120 -0
- package/docs/reference/classes/ProcessHandle.md +368 -0
- package/docs/reference/functions/defineContract.md +39 -0
- package/docs/reference/functions/defineContracts.md +36 -0
- package/docs/reference/functions/disabled.md +28 -0
- package/docs/reference/functions/enabled.md +20 -0
- package/docs/reference/functions/focused.md +26 -0
- package/docs/reference/functions/mockOf.md +79 -0
- package/docs/reference/functions/postgres.md +31 -0
- package/docs/reference/functions/process.md +33 -0
- package/docs/reference/functions/redis.md +28 -0
- package/docs/reference/functions/required.md +41 -0
- package/docs/reference/functions/selected.md +26 -0
- package/docs/reference/functions/sqlite.md +33 -0
- package/docs/reference/functions/testId.md +20 -0
- package/docs/reference/functions/text.md +40 -0
- package/docs/reference/functions/valued.md +28 -0
- package/docs/reference/functions/waitUntil.md +46 -0
- package/docs/reference/functions/within.md +29 -0
- package/docs/reference/index.md +196 -0
- package/docs/reference/interfaces/BaseResult.md +87 -0
- package/docs/reference/interfaces/CallResult.md +160 -0
- package/docs/reference/interfaces/CaptureScope.md +82 -0
- package/docs/reference/interfaces/CliResult.md +253 -0
- package/docs/reference/interfaces/ContainerAccessor.md +166 -0
- package/docs/reference/interfaces/DirectoryAccessor.md +33 -0
- package/docs/reference/interfaces/FetchResult.md +180 -0
- package/docs/reference/interfaces/FilesystemAccessor.md +46 -0
- package/docs/reference/interfaces/HttpResult.md +126 -0
- package/docs/reference/interfaces/JsonAccessor.md +46 -0
- package/docs/reference/interfaces/PageResult.md +356 -0
- package/docs/reference/interfaces/RenderResult.md +72 -0
- package/docs/reference/interfaces/RenderedText.md +110 -0
- package/docs/reference/interfaces/ResponseAccessor.md +47 -0
- package/docs/reference/interfaces/ScreenResult.md +128 -0
- package/docs/reference/interfaces/TableAccessor.md +26 -0
- package/docs/reference/interfaces/TextAccessor.md +96 -0
- package/docs/reference/type-aliases/ApiHandle.md +68 -0
- package/docs/reference/type-aliases/ApiSpecification.md +213 -0
- package/docs/reference/type-aliases/ApiSpecificationOptions.md +68 -0
- package/docs/reference/type-aliases/BrowserConsoleMessage.md +30 -0
- package/docs/reference/type-aliases/BrowserLinkElement.md +50 -0
- package/docs/reference/type-aliases/BrowserMetaElement.md +40 -0
- package/docs/reference/type-aliases/BrowserOpenOptions.md +87 -0
- package/docs/reference/type-aliases/BrowserPage.md +132 -0
- package/docs/reference/type-aliases/BrowserPort.md +51 -0
- package/docs/reference/type-aliases/CliEnv.md +11 -0
- package/docs/reference/type-aliases/CliHandle.md +80 -0
- package/docs/reference/type-aliases/CliInput.md +36 -0
- package/docs/reference/type-aliases/CliOutput.md +46 -0
- package/docs/reference/type-aliases/CliPort.md +58 -0
- package/docs/reference/type-aliases/CliSpecification.md +144 -0
- package/docs/reference/type-aliases/CliSpecificationOptions.md +134 -0
- package/docs/reference/type-aliases/ComponentChain.md +156 -0
- package/docs/reference/type-aliases/ComponentScenario.md +20 -0
- package/docs/reference/type-aliases/ComponentUi.md +47 -0
- package/docs/reference/type-aliases/ComponentVisitor.md +10 -0
- package/docs/reference/type-aliases/ContainerPort.md +113 -0
- package/docs/reference/type-aliases/Contract.md +68 -0
- package/docs/reference/type-aliases/ContractInput.md +13 -0
- package/docs/reference/type-aliases/ContractRequest.md +95 -0
- package/docs/reference/type-aliases/ContractResponder.md +23 -0
- package/docs/reference/type-aliases/ContractResponse.md +78 -0
- package/docs/reference/type-aliases/ContractResponseValue.md +13 -0
- package/docs/reference/type-aliases/Contracts.md +48 -0
- package/docs/reference/type-aliases/DatabaseKeys.md +16 -0
- package/docs/reference/type-aliases/DatabasePort.md +72 -0
- package/docs/reference/type-aliases/DeviceOpenOptions.md +46 -0
- package/docs/reference/type-aliases/DevicePort.md +51 -0
- package/docs/reference/type-aliases/DeviceScreen.md +32 -0
- package/docs/reference/type-aliases/DeviceTimeouts.md +39 -0
- package/docs/reference/type-aliases/DockerSpecConfig.md +43 -0
- package/docs/reference/type-aliases/DomMount.md +21 -0
- package/docs/reference/type-aliases/ElementKind.md +27 -0
- package/docs/reference/type-aliases/ElementMatch.md +74 -0
- package/docs/reference/type-aliases/ElementOptions.md +29 -0
- package/docs/reference/type-aliases/ElementRef.md +128 -0
- package/docs/reference/type-aliases/ExecOptions.md +37 -0
- package/docs/reference/type-aliases/FileAccessor.md +54 -0
- package/docs/reference/type-aliases/HonoApp.md +31 -0
- package/docs/reference/type-aliases/HttpContractFilter.md +49 -0
- package/docs/reference/type-aliases/HttpResponseInit.md +46 -0
- package/docs/reference/type-aliases/HttpStreamInit.md +58 -0
- package/docs/reference/type-aliases/IntegrationHandle.md +46 -0
- package/docs/reference/type-aliases/IntegrationSpecification.md +111 -0
- package/docs/reference/type-aliases/IntegrationSpecificationOptions.md +42 -0
- package/docs/reference/type-aliases/Intercept.md +19 -0
- package/docs/reference/type-aliases/InterceptOptions.md +28 -0
- package/docs/reference/type-aliases/InterceptScope.md +11 -0
- package/docs/reference/type-aliases/IsolationStrategy.md +75 -0
- package/docs/reference/type-aliases/JobHandle.md +34 -0
- package/docs/reference/type-aliases/JobsHandle.md +57 -0
- package/docs/reference/type-aliases/JobsResult.md +16 -0
- package/docs/reference/type-aliases/JobsSpecification.md +94 -0
- package/docs/reference/type-aliases/JobsSpecificationOptions.md +56 -0
- package/docs/reference/type-aliases/LandmarkKind.md +20 -0
- package/docs/reference/type-aliases/LiterateRunFlags.md +27 -0
- package/docs/reference/type-aliases/LiterateServeRegistration.md +70 -0
- package/docs/reference/type-aliases/MatchFixtureOptions.md +27 -0
- package/docs/reference/type-aliases/MatchableRequest.md +61 -0
- package/docs/reference/type-aliases/MatcherKind.md +34 -0
- package/docs/reference/type-aliases/MobileBackendOptions.md +28 -0
- package/docs/reference/type-aliases/MobileElementKind.md +14 -0
- package/docs/reference/type-aliases/MobileElementMatch.md +60 -0
- package/docs/reference/type-aliases/MobileElementRef.md +20 -0
- package/docs/reference/type-aliases/MobileHandle.md +65 -0
- package/docs/reference/type-aliases/MobileScenario.md +20 -0
- package/docs/reference/type-aliases/MobileSpecification.md +51 -0
- package/docs/reference/type-aliases/MobileSpecificationOptions.md +126 -0
- package/docs/reference/type-aliases/MobileVisitor.md +81 -0
- package/docs/reference/type-aliases/MockOfOptions.md +26 -0
- package/docs/reference/type-aliases/MockPort.md +10 -0
- package/docs/reference/type-aliases/PinnedClock.md +10 -0
- package/docs/reference/type-aliases/PostgresOptions.md +32 -0
- package/docs/reference/type-aliases/ProcessOptions.md +112 -0
- package/docs/reference/type-aliases/RedisOptions.md +20 -0
- package/docs/reference/type-aliases/RenderSubject.md +12 -0
- package/docs/reference/type-aliases/ScreenNode.md +67 -0
- package/docs/reference/type-aliases/ServerPort.md +36 -0
- package/docs/reference/type-aliases/ServerResponse.md +46 -0
- package/docs/reference/type-aliases/ServerSpec.md +21 -0
- package/docs/reference/type-aliases/ServiceHandle.md +216 -0
- package/docs/reference/type-aliases/ServiceRecord.md +12 -0
- package/docs/reference/type-aliases/SpecDocument.md +84 -0
- package/docs/reference/type-aliases/SpecEnvToken.md +21 -0
- package/docs/reference/type-aliases/SpecFileAssertion.md +27 -0
- package/docs/reference/type-aliases/SpecFixture.md +30 -0
- package/docs/reference/type-aliases/SpecKind.md +8 -0
- package/docs/reference/type-aliases/SpecRun.md +108 -0
- package/docs/reference/type-aliases/SpecServeEntry.md +40 -0
- package/docs/reference/type-aliases/SpecStream.md +32 -0
- package/docs/reference/type-aliases/SpecificationConfig.md +290 -0
- package/docs/reference/type-aliases/SqliteOptions.md +36 -0
- package/docs/reference/type-aliases/SseEvent.md +58 -0
- package/docs/reference/type-aliases/StreamBody.md +61 -0
- package/docs/reference/type-aliases/TextFilter.md +22 -0
- package/docs/reference/type-aliases/VisitScenario.md +20 -0
- package/docs/reference/type-aliases/Visitor.md +215 -0
- package/docs/reference/type-aliases/WaitUntilOptions.md +46 -0
- package/docs/reference/type-aliases/WebsiteBackendOptions.md +37 -0
- package/docs/reference/type-aliases/WebsiteHandle.md +51 -0
- package/docs/reference/type-aliases/WebsiteSpecification.md +118 -0
- package/docs/reference/type-aliases/WebsiteSpecificationOptions.md +40 -0
- package/docs/reference/variables/anthropic.md +19 -0
- package/docs/reference/variables/banner.md +10 -0
- package/docs/reference/variables/button.md +10 -0
- package/docs/reference/variables/clock.md +16 -0
- package/docs/reference/variables/complementary.md +10 -0
- package/docs/reference/variables/component.md +10 -0
- package/docs/reference/variables/content.md +10 -0
- package/docs/reference/variables/contentinfo.md +10 -0
- package/docs/reference/variables/dialog.md +10 -0
- package/docs/reference/variables/field.md +10 -0
- package/docs/reference/variables/form.md +10 -0
- package/docs/reference/variables/heading.md +10 -0
- package/docs/reference/variables/http.md +40 -0
- package/docs/reference/variables/intercept.md +11 -0
- package/docs/reference/variables/link.md +10 -0
- package/docs/reference/variables/listitem.md +10 -0
- package/docs/reference/variables/main.md +10 -0
- package/docs/reference/variables/match.md +8 -0
- package/docs/reference/variables/navigation.md +10 -0
- package/docs/reference/variables/openai.md +21 -0
- package/docs/reference/variables/option.md +17 -0
- package/docs/reference/variables/region.md +10 -0
- package/docs/reference/variables/row.md +10 -0
- package/docs/reference/variables/search.md +10 -0
- package/docs/reference/variables/specification.md +8 -0
- package/docs/reference/variables/status.md +10 -0
- package/docs/reference/variables/table.md +10 -0
- package/package.json +32 -11
- package/dist/spec-document.js +0 -651
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Class: ProcessHandle
|
|
3
|
+
|
|
4
|
+
Defined in: [src/model/chain/process.ts:21](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L21)
|
|
5
|
+
|
|
6
|
+
An external process, declared like any other service.
|
|
7
|
+
|
|
8
|
+
One shape for every one of them: a site's dev server, an API behind the
|
|
9
|
+
site, the bundler a simulator loads from. Without it each is declared
|
|
10
|
+
somewhere else — a facet option, a document's `serve:` entry, a `beforeAll`
|
|
11
|
+
spawning a child and an `afterAll` that sometimes forgets to kill it — and
|
|
12
|
+
the lifetime belongs to whoever remembered. Here it is the framework's.
|
|
13
|
+
|
|
14
|
+
It sits in a `services` record beside `postgres()`, `redis()` and
|
|
15
|
+
`sqlite()`, so it starts after them and can be handed their connection
|
|
16
|
+
strings through `env`, and it is stopped with the specification.
|
|
17
|
+
|
|
18
|
+
## Implements
|
|
19
|
+
|
|
20
|
+
- [`ServiceHandle`](../type-aliases/ServiceHandle.md)
|
|
21
|
+
|
|
22
|
+
## Constructors
|
|
23
|
+
|
|
24
|
+
### Constructor
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
new ProcessHandle(options): ProcessHandle;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Defined in: [src/model/chain/process.ts:35](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L35)
|
|
31
|
+
|
|
32
|
+
#### Parameters
|
|
33
|
+
|
|
34
|
+
| Parameter | Type |
|
|
35
|
+
| ------ | ------ |
|
|
36
|
+
| `options` | [`ProcessOptions`](../type-aliases/ProcessOptions.md) |
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`ProcessHandle`
|
|
41
|
+
|
|
42
|
+
## Properties
|
|
43
|
+
|
|
44
|
+
### connectionString
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
connectionString: string = '';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Defined in: [src/model/chain/process.ts:29](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L29)
|
|
51
|
+
|
|
52
|
+
Connection string — populated after start.
|
|
53
|
+
|
|
54
|
+
#### Implementation of
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
ServiceHandle.connectionString
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
***
|
|
61
|
+
|
|
62
|
+
### defaultImage
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
readonly defaultImage: "" = '';
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Defined in: [src/model/chain/process.ts:23](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L23)
|
|
69
|
+
|
|
70
|
+
Embedded: nothing to pull, nothing to run in a container.
|
|
71
|
+
|
|
72
|
+
#### Implementation of
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
ServiceHandle.defaultImage
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### defaultPort
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
readonly defaultPort: 0 = 0;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Defined in: [src/model/chain/process.ts:24](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L24)
|
|
87
|
+
|
|
88
|
+
Default container port for this service type.
|
|
89
|
+
|
|
90
|
+
#### Implementation of
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
ServiceHandle.defaultPort
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
***
|
|
97
|
+
|
|
98
|
+
### environment
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
readonly environment: Record<string, string> = {};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Defined in: [src/model/chain/process.ts:25](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L25)
|
|
105
|
+
|
|
106
|
+
Environment variables to pass to the container.
|
|
107
|
+
|
|
108
|
+
#### Implementation of
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
ServiceHandle.environment
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
***
|
|
115
|
+
|
|
116
|
+
### serviceName
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
serviceName: string | null = null;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Defined in: [src/model/chain/process.ts:28](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L28)
|
|
123
|
+
|
|
124
|
+
The name this handle is known by. Left `null` until the orchestrator
|
|
125
|
+
assigns it at start time: it is the kebab-case form of the RECORD KEY,
|
|
126
|
+
so `{ analyticsDb: postgres() }` reports as `analytics-db` and reads its
|
|
127
|
+
init script from `docker/analytics-db/`. The key is the only name a
|
|
128
|
+
specification writes; a handle carries no second one of its own.
|
|
129
|
+
|
|
130
|
+
#### Implementation of
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
ServiceHandle.serviceName
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
***
|
|
137
|
+
|
|
138
|
+
### started
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
started: boolean = false;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Defined in: [src/model/chain/process.ts:30](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L30)
|
|
145
|
+
|
|
146
|
+
Whether this service has been started.
|
|
147
|
+
|
|
148
|
+
#### Implementation of
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
ServiceHandle.started
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
***
|
|
155
|
+
|
|
156
|
+
### type
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
readonly type: "process" = 'process';
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Defined in: [src/model/chain/process.ts:26](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L26)
|
|
163
|
+
|
|
164
|
+
Service type identifier.
|
|
165
|
+
|
|
166
|
+
#### Implementation of
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
ServiceHandle.type
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Accessors
|
|
173
|
+
|
|
174
|
+
### spec
|
|
175
|
+
|
|
176
|
+
#### Get Signature
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
get spec(): ProcessOptions;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Defined in: [src/model/chain/process.ts:122](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L122)
|
|
183
|
+
|
|
184
|
+
What it was declared as — what a facet reads to start it in a slot of its own.
|
|
185
|
+
|
|
186
|
+
##### Returns
|
|
187
|
+
|
|
188
|
+
[`ProcessOptions`](../type-aliases/ProcessOptions.md)
|
|
189
|
+
|
|
190
|
+
***
|
|
191
|
+
|
|
192
|
+
### url
|
|
193
|
+
|
|
194
|
+
#### Get Signature
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
get url(): string;
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Defined in: [src/model/chain/process.ts:127](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L127)
|
|
201
|
+
|
|
202
|
+
The base URL it came up on — known only once it is started.
|
|
203
|
+
|
|
204
|
+
##### Returns
|
|
205
|
+
|
|
206
|
+
`string`
|
|
207
|
+
|
|
208
|
+
## Methods
|
|
209
|
+
|
|
210
|
+
### buildConnectionString()
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
buildConnectionString(host, port): string;
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Defined in: [src/model/chain/process.ts:39](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L39)
|
|
217
|
+
|
|
218
|
+
Build the connection string from host and port.
|
|
219
|
+
|
|
220
|
+
#### Parameters
|
|
221
|
+
|
|
222
|
+
| Parameter | Type |
|
|
223
|
+
| ------ | ------ |
|
|
224
|
+
| `host` | `string` |
|
|
225
|
+
| `port` | `number` |
|
|
226
|
+
|
|
227
|
+
#### Returns
|
|
228
|
+
|
|
229
|
+
`string`
|
|
230
|
+
|
|
231
|
+
#### Implementation of
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
ServiceHandle.buildConnectionString
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
***
|
|
238
|
+
|
|
239
|
+
### createDatabaseAdapter()
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
createDatabaseAdapter(): DatabasePort | null;
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Defined in: [src/model/chain/process.ts:43](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L43)
|
|
246
|
+
|
|
247
|
+
Create a DatabasePort adapter (if this is a database). Returns null otherwise.
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
[`DatabasePort`](../type-aliases/DatabasePort.md) \| `null`
|
|
252
|
+
|
|
253
|
+
#### Implementation of
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
ServiceHandle.createDatabaseAdapter
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
***
|
|
260
|
+
|
|
261
|
+
### healthcheck()
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
healthcheck(): Promise<void>;
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Defined in: [src/model/chain/process.ts:47](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L47)
|
|
268
|
+
|
|
269
|
+
Verify the service is ready and accepting connections. Throws with context if not.
|
|
270
|
+
|
|
271
|
+
#### Returns
|
|
272
|
+
|
|
273
|
+
`Promise`\<`void`\>
|
|
274
|
+
|
|
275
|
+
#### Implementation of
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
ServiceHandle.healthcheck
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
***
|
|
282
|
+
|
|
283
|
+
### initialize()
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
initialize(): Promise<void>;
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Defined in: [src/model/chain/process.ts:58](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L58)
|
|
290
|
+
|
|
291
|
+
A process is not a container, so the orchestrator never starts it: the
|
|
292
|
+
facet does, once its siblings are up and their connection strings are
|
|
293
|
+
readable (startProcessServices).
|
|
294
|
+
|
|
295
|
+
#### Returns
|
|
296
|
+
|
|
297
|
+
`Promise`\<`void`\>
|
|
298
|
+
|
|
299
|
+
#### Implementation of
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
ServiceHandle.initialize
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
***
|
|
306
|
+
|
|
307
|
+
### isolation()
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
isolation(): IsolationStrategy;
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Defined in: [src/model/chain/process.ts:70](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L70)
|
|
314
|
+
|
|
315
|
+
Isolation is the RUN's, not the worker's — and a run here is one
|
|
316
|
+
EVALUATION of the specification module. Under vitest's default
|
|
317
|
+
isolation that is once per test file, so two files that import the same
|
|
318
|
+
specification get a child each, with the id the facet minted for it.
|
|
319
|
+
Nothing is acquired or reset between tests: the id is what tells two
|
|
320
|
+
runs apart, never a label a spec samples.
|
|
321
|
+
|
|
322
|
+
#### Returns
|
|
323
|
+
|
|
324
|
+
[`IsolationStrategy`](../type-aliases/IsolationStrategy.md)
|
|
325
|
+
|
|
326
|
+
#### Implementation of
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
ServiceHandle.isolation
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
***
|
|
333
|
+
|
|
334
|
+
### reset()
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
reset(): Promise<void>;
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Defined in: [src/model/chain/process.ts:84](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L84)
|
|
341
|
+
|
|
342
|
+
Reset state between tests (truncate tables, flush cache, etc.)
|
|
343
|
+
|
|
344
|
+
#### Returns
|
|
345
|
+
|
|
346
|
+
`Promise`\<`void`\>
|
|
347
|
+
|
|
348
|
+
#### Implementation of
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
ServiceHandle.reset
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
***
|
|
355
|
+
|
|
356
|
+
### shutdown()
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
shutdown(): Promise<void>;
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Defined in: [src/model/chain/process.ts:115](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L115)
|
|
363
|
+
|
|
364
|
+
Terminate the process group. Idempotent.
|
|
365
|
+
|
|
366
|
+
#### Returns
|
|
367
|
+
|
|
368
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: defineContract()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function defineContract(contract): Contract;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/model/contracts/contract.ts:71](https://github.com/jterrazz/package-test/blob/main/src/model/contracts/contract.ts#L71)
|
|
9
|
+
|
|
10
|
+
Declare one contract. Identity function — its value is the enforced shape
|
|
11
|
+
and the naming convention:
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type |
|
|
16
|
+
| ------ | ------ |
|
|
17
|
+
| `contract` | [`Contract`](../type-aliases/Contract.md) |
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
[`Contract`](../type-aliases/Contract.md)
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// specs/api/reports/contracts/openai/classify-article.ts
|
|
27
|
+
import { defineContract, openai } from '@jterrazz/test';
|
|
28
|
+
|
|
29
|
+
export default defineContract({
|
|
30
|
+
request: openai.responses({ user: PROMPT, tools: ['classify'] }),
|
|
31
|
+
response: openai.reply({ categories: ['TECH'] }),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Dynamic — the response is computed from the observed request:
|
|
35
|
+
export default defineContract({
|
|
36
|
+
request: http.post('https://api.example.com/echo'),
|
|
37
|
+
response: (request) => http.json({ received: request.body }),
|
|
38
|
+
});
|
|
39
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: defineContracts()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function defineContracts(...items): Contracts;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/model/contracts/contract.ts:137](https://github.com/jterrazz/package-test/blob/main/src/model/contracts/contract.ts#L137)
|
|
9
|
+
|
|
10
|
+
Compose contracts into the artifact a test imports — it's contracts all the
|
|
11
|
+
way down: a composite may extend contracts, lists, and other composites,
|
|
12
|
+
recursively, order preserved.
|
|
13
|
+
|
|
14
|
+
`.with(...)` derives a scenario: contracts whose route the overrides claim
|
|
15
|
+
are removed from the base, and the overrides are prepended. Under
|
|
16
|
+
first-match selection a more specific override (`/articles/gone-1`) also
|
|
17
|
+
wins over a generic base route (`/articles/{{uuid}}`) it does not replace.
|
|
18
|
+
|
|
19
|
+
## Parameters
|
|
20
|
+
|
|
21
|
+
| Parameter | Type |
|
|
22
|
+
| ------ | ------ |
|
|
23
|
+
| ...`items` | [`ContractInput`](../type-aliases/ContractInput.md)[] |
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
[`Contracts`](../type-aliases/Contracts.md)
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
// contracts/newsroom.contracts.ts
|
|
33
|
+
export default defineContracts(events, articleById);
|
|
34
|
+
export const withArticleGone = (id: string) =>
|
|
35
|
+
newsroom.with(articleGone(id));
|
|
36
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: disabled()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function disabled(element): ElementRef;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/model/elements/elements.ts:175](https://github.com/jterrazz/package-test/blob/main/src/model/elements/elements.ts#L175)
|
|
9
|
+
|
|
10
|
+
Whether the element accepts input: `see(disabled(button('Delete')))` asserts
|
|
11
|
+
it refuses, `see(enabled(button('Delete')))` that it takes it.
|
|
12
|
+
|
|
13
|
+
Modifiers rather than descriptors, for the same reason as `focused`: being
|
|
14
|
+
disabled is a state of an element the vocabulary already names. Unlike focus,
|
|
15
|
+
the ARIA tree carries it, so a golden pins a whole outline's enablement and
|
|
16
|
+
these name the ONE control a test is about. They also buy the direction a
|
|
17
|
+
behavioural substitute cannot reach — clicking a disabled control is a
|
|
18
|
+
timeout, never an assertion.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Type |
|
|
23
|
+
| ------ | ------ |
|
|
24
|
+
| `element` | [`ElementRef`](../type-aliases/ElementRef.md) |
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
[`ElementRef`](../type-aliases/ElementRef.md)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: enabled()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function enabled(element): ElementRef;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/model/elements/elements.ts:178](https://github.com/jterrazz/package-test/blob/main/src/model/elements/elements.ts#L178)
|
|
9
|
+
|
|
10
|
+
The other direction of [disabled](disabled.md) — the element takes input.
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
|
|
14
|
+
| Parameter | Type |
|
|
15
|
+
| ------ | ------ |
|
|
16
|
+
| `element` | [`ElementRef`](../type-aliases/ElementRef.md) |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
[`ElementRef`](../type-aliases/ElementRef.md)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: focused()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function focused(element): ElementRef;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/model/elements/elements.ts:162](https://github.com/jterrazz/package-test/blob/main/src/model/elements/elements.ts#L162)
|
|
9
|
+
|
|
10
|
+
Where the keyboard is: `see(focused(button('Open')))` asserts the element has
|
|
11
|
+
focus, `gone(focused(x))` that it does not.
|
|
12
|
+
|
|
13
|
+
A modifier rather than a descriptor of its own, because focus is a STATE of
|
|
14
|
+
an element the vocabulary can already name. It is a verb's business and never
|
|
15
|
+
a golden's: the accessibility tree carries no focus, so a tree snapshot of a
|
|
16
|
+
dialog that took the keyboard and one that did not are byte-identical.
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type |
|
|
21
|
+
| ------ | ------ |
|
|
22
|
+
| `element` | [`ElementRef`](../type-aliases/ElementRef.md) |
|
|
23
|
+
|
|
24
|
+
## Returns
|
|
25
|
+
|
|
26
|
+
[`ElementRef`](../type-aliases/ElementRef.md)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: mockOf()
|
|
3
|
+
|
|
4
|
+
## Call Signature
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
function mockOf<T>(options): MockProxy<T>;
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Defined in: [src/model/doubles/mock-of.ts:28](https://github.com/jterrazz/package-test/blob/main/src/model/doubles/mock-of.ts#L28)
|
|
11
|
+
|
|
12
|
+
A typed double for an injected port — the fourth rung of the doubles ladder
|
|
13
|
+
(docs/18-conventions.md), and the only one a module test may build itself.
|
|
14
|
+
|
|
15
|
+
The type argument is the port: `T` is constrained to `object` and has no
|
|
16
|
+
default, so a double is always asked for something. A call with no argument
|
|
17
|
+
answers for `object`, which satisfies no port and fails where it is used.
|
|
18
|
+
|
|
19
|
+
### Type Parameters
|
|
20
|
+
|
|
21
|
+
| Type Parameter |
|
|
22
|
+
| ------ |
|
|
23
|
+
| `T` *extends* `object` |
|
|
24
|
+
|
|
25
|
+
### Parameters
|
|
26
|
+
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| ------ | ------ |
|
|
29
|
+
| `options` | \{ `deep`: `false`; \} |
|
|
30
|
+
| `options.deep` | `false` |
|
|
31
|
+
|
|
32
|
+
### Returns
|
|
33
|
+
|
|
34
|
+
`MockProxy`\<`T`\>
|
|
35
|
+
|
|
36
|
+
### Example
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
const gateway = mockOf<PaymentGateway>(); // deep
|
|
40
|
+
const clock = mockOf<ClockPort>({ deep: false }); // flat
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Call Signature
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
function mockOf<T>(options?): DeepMockProxy<T>;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Defined in: [src/model/doubles/mock-of.ts:29](https://github.com/jterrazz/package-test/blob/main/src/model/doubles/mock-of.ts#L29)
|
|
50
|
+
|
|
51
|
+
A typed double for an injected port — the fourth rung of the doubles ladder
|
|
52
|
+
(docs/18-conventions.md), and the only one a module test may build itself.
|
|
53
|
+
|
|
54
|
+
The type argument is the port: `T` is constrained to `object` and has no
|
|
55
|
+
default, so a double is always asked for something. A call with no argument
|
|
56
|
+
answers for `object`, which satisfies no port and fails where it is used.
|
|
57
|
+
|
|
58
|
+
### Type Parameters
|
|
59
|
+
|
|
60
|
+
| Type Parameter |
|
|
61
|
+
| ------ |
|
|
62
|
+
| `T` *extends* `object` |
|
|
63
|
+
|
|
64
|
+
### Parameters
|
|
65
|
+
|
|
66
|
+
| Parameter | Type |
|
|
67
|
+
| ------ | ------ |
|
|
68
|
+
| `options?` | [`MockOfOptions`](../type-aliases/MockOfOptions.md) |
|
|
69
|
+
|
|
70
|
+
### Returns
|
|
71
|
+
|
|
72
|
+
`DeepMockProxy`\<`T`\>
|
|
73
|
+
|
|
74
|
+
### Example
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
const gateway = mockOf<PaymentGateway>(); // deep
|
|
78
|
+
const clock = mockOf<ClockPort>({ deep: false }); // flat
|
|
79
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: postgres()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function postgres(options?): PostgresHandle;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/seams/postgres/postgres.ts:216](https://github.com/jterrazz/package-test/blob/main/src/seams/postgres/postgres.ts#L216)
|
|
9
|
+
|
|
10
|
+
Create a PostgreSQL service handle.
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
|
|
14
|
+
| Parameter | Type |
|
|
15
|
+
| ------ | ------ |
|
|
16
|
+
| `options` | [`PostgresOptions`](../type-aliases/PostgresOptions.md) |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
`PostgresHandle`
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// The record key is the name: it is the spec's `database` vocabulary, and
|
|
26
|
+
// Kebab-cased it is the folder the init script is read from.
|
|
27
|
+
// { db: postgres() } → docker/db/init.sql, then docker/postgres/init.sql
|
|
28
|
+
// { analyticsDb: postgres() } → docker/analytics-db/init.sql
|
|
29
|
+
const events = postgres();
|
|
30
|
+
// After start: events.connectionString is populated
|
|
31
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: process()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function process(options): ProcessHandle;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/model/chain/process.ts:151](https://github.com/jterrazz/package-test/blob/main/src/model/chain/process.ts#L151)
|
|
9
|
+
|
|
10
|
+
Declare an external process the framework owns for the life of the
|
|
11
|
+
specification.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type |
|
|
16
|
+
| ------ | ------ |
|
|
17
|
+
| `options` | [`ProcessOptions`](../type-aliases/ProcessOptions.md) |
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
[`ProcessHandle`](../classes/ProcessHandle.md)
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const { website, cleanup } = await specification.website({
|
|
27
|
+
services: { api: process({ command: 'bin/server web', ready: '/health' }) },
|
|
28
|
+
server: ({ api }) => process({
|
|
29
|
+
command: 'next dev',
|
|
30
|
+
env: { NEXT_PUBLIC_API_URL: api.connectionString },
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- GENERATED by `typescript docs` — DO NOT EDIT -->
|
|
2
|
+
# Function: redis()
|
|
3
|
+
|
|
4
|
+
```ts
|
|
5
|
+
function redis(options?): RedisHandle;
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defined in: [src/seams/redis/redis.ts:107](https://github.com/jterrazz/package-test/blob/main/src/seams/redis/redis.ts#L107)
|
|
9
|
+
|
|
10
|
+
Create a Redis service handle.
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
|
|
14
|
+
| Parameter | Type |
|
|
15
|
+
| ------ | ------ |
|
|
16
|
+
| `options` | [`RedisOptions`](../type-aliases/RedisOptions.md) |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
`RedisHandle`
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// The record key is the name it reports under: { cache: redis() } → "cache".
|
|
26
|
+
const cache = redis();
|
|
27
|
+
// After start: cache.connectionString is populated
|
|
28
|
+
```
|