@schwabyio/gta 0.14.0 → 0.14.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 CHANGED
@@ -243,6 +243,44 @@ test('a new user sees their dashboard', async ({ page, gta }) => {
243
243
 
244
244
  It needs `@playwright/test` 1.51 or later, which installing `gta` does not install.
245
245
 
246
+ **When the project is in another repository**, check it out beside the app's and read
247
+ its path from an environment variable, so a checkout anywhere else can say where it is:
248
+
249
+ ```ts
250
+ // playwright.config.ts
251
+ export default defineConfig<{}, GravityConfig>({
252
+ use: {
253
+ gravity: { project: process.env.GTA_PROJECT ?? '../api-tests' }
254
+ }
255
+ })
256
+ ```
257
+
258
+ `project` names the folder holding `collections/`. A project that `uses:` a global
259
+ project needs the repository checked out whole, since the global project is found from
260
+ it. In CI, check out both:
261
+
262
+ ```yaml
263
+ # .github/workflows/e2e.yml (steps)
264
+ - uses: actions/checkout@v4
265
+ with:
266
+ path: web
267
+ - uses: actions/checkout@v4
268
+ with:
269
+ repository: your-org/api-tests
270
+ path: api-tests
271
+ token: ${{ secrets.API_TESTS_TOKEN }} # when that repository is private
272
+ - uses: actions/setup-node@v4
273
+ with:
274
+ node-version: 22
275
+ - run: npm ci && npx playwright install --with-deps
276
+ working-directory: web
277
+ - run: npx playwright test
278
+ working-directory: web
279
+ env:
280
+ GTA_PROJECT: ${{ github.workspace }}/api-tests
281
+ apiKey: ${{ secrets.STAGING_API_KEY }}
282
+ ```
283
+
246
284
  ### Any other code
247
285
 
248
286
  ```js
@@ -272,7 +310,7 @@ since you name what runs, and a collection with `exclude: true` runs too. The op
272
310
  | `signal` | An `AbortSignal` that stops the run. |
273
311
  | `onResult` | `(result, step) => void`, called as each request finishes. |
274
312
 
275
- **`project.use(set, params, options)`** runs a request set as a `use:` step would:
313
+ **`project.use(name, params, options)`** runs reusable requests as a `use:` step would:
276
314
  `login` is `requests/login.yml`, in the project or its global project. `params` are what
277
315
  `with:` gives, and a param you leave out takes its default. The options are those of
278
316
  `run`, without `steps`.
@@ -288,8 +326,8 @@ Both resolve to the same outcome, however the steps fare:
288
326
  | `failures` | What went wrong, as `gta` prints it under Failures. Empty when the run passed. |
289
327
  | `error` | Why the run did not start or finish: a file that will not load, `timeoutCollection`, or a cancel. Otherwise `null`. |
290
328
 
291
- They reject only when a collection, step or request set doesn't exist, or a value isn't a
292
- string, number, boolean or null. Types ship with the package.
329
+ They reject only when a collection, step or reusable requests file doesn't exist, or a
330
+ value isn't a string, number, boolean or null. Types ship with the package.
293
331
 
294
332
  ## The file format
295
333
 
package/dist/FUNCTIONS.md CHANGED
@@ -49,7 +49,7 @@ goes, the order it runs in, and the other globals: `res`, `req`, `assert`, `para
49
49
  ## How calls behave
50
50
 
51
51
  - **Every `tests` script of a step feeds one list of checks**: the collection's, the
52
- step's, and those of an endpoint base, a base collection or a request set it runs
52
+ step's, and those of an endpoint base, a base collection or reusable requests it runs
53
53
  under (SPEC.md §2.5–§2.7). Strict validation counts them all together.
54
54
  - **A check that fails does not stop the script.** The checks after it still run, and
55
55
  the step fails.
package/dist/SPEC.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # The Gravity file format
2
2
 
3
- Version 0.14.0, the version of Gravity and `gta` that reads it: the two are released
3
+ Version 0.14.2, the version of Gravity and `gta` that reads it: the two are released
4
4
  together.
5
5
 
6
6
  This document specifies the YAML files that **Gravity**, the desktop app, and **`gta`**,
@@ -35,7 +35,7 @@ is a complete, valid project to start from.
35
35
  | `project.yml` | The project folder | Name, global project, variables, trust | §1.1 |
36
36
  | `settings.yml` | The project folder | How `gta` runs the project | §1.3 |
37
37
  | `rules.yml` | The project folder | How the project's files are written | §1.4 |
38
- | `requests/<id>.yml` | `requests/`, or one folder inside it | A request set, run by `use:` | §2.5 |
38
+ | `requests/<id>.yml` | `requests/`, or one folder inside it | Reusable requests, run by `use:` | §2.5 |
39
39
  | `endpoints/<id>.yml` | `endpoints/`, or one folder inside it | Defaults and checks per method and path | §2.6 |
40
40
  | `bases/<id>.yml` | `bases/`, or one folder inside it | A base collection, for `extends:` | §2.7 |
41
41
  | `checks/<name>.js` | `checks/` | Shared check functions | §5 |
@@ -101,7 +101,7 @@ payments/ a project
101
101
  ├── environments/
102
102
  │ ├── local.yml
103
103
  │ └── staging.yml
104
- ├── requests/ request sets (§2.5)
104
+ ├── requests/ reusable requests (§2.5)
105
105
  ├── endpoints/ endpoint bases (§2.6)
106
106
  ├── bases/ base collections (§2.7)
107
107
  ├── checks/ check files (§5)
@@ -177,8 +177,8 @@ variables, `environments/`, `requests/`, `endpoints/`, `bases/`, `checks/`,
177
177
  so does its `rules.yml` (§1.4).
178
178
  - A global project's own `collections/` is **not** shared: a project using it never
179
179
  sees or runs those collections. A global project needs none. It may have one for a
180
- single purpose: **testing what it shares**. A collection there can `use:` its request
181
- sets, `extends:` its bases and call its checks, against its own environments, so a
180
+ single purpose: **testing what it shares**. A collection there can `use:` its reusable
181
+ requests, `extends:` its bases and call its checks, against its own environments, so a
182
182
  broken shared piece fails in one place, before every project relying on it does.
183
183
  Those collections run only when the global project itself does, as a project in
184
184
  Gravity or with `gta` in its folder, such as its own CI job.
@@ -340,25 +340,25 @@ guide: |
340
340
  `gta lint` reports it, and a CI job running `gta lint` fails on it. Gravity marks it, and
341
341
  flags what `tests.only` does not allow as a script is typed.
342
342
 
343
- | Rule | Value | What it checks |
344
- | -------------------- | ---------------------- | ------------------------------------------------------------------------- |
345
- | `ids.collections` | style or pattern | Each collection's id, its file name (§2). |
346
- | `ids.requests` | style or pattern | Each request set's id (§2.5). |
347
- | `ids.bases` | style or pattern | Each base collection's id (§2.7). |
348
- | `ids.endpoints` | style or pattern | Each endpoints file's id (§2.6). |
349
- | `layout.folders` | `required` | Every collection sits in a folder of `collections/`, none at its top. |
350
- | `layout.folderNames` | list, style or pattern | Each folder of `collections/`: one of the list, or following the format. |
351
- | `layout.maxSteps` | integer ≥ 1 | The most steps a collection has in `steps`; `setup` and `teardown` aside. |
352
- | `steps.names` | `required` | Every step has a `name`, and no other step of its file has the same one. |
353
- | `steps.url` | pattern | Every request step's URL, as written, matches it (below). |
354
- | `docs.collections` | `required` | Every collection has `docs`. |
355
- | `docs.requests` | `required` | Every request set has `docs`. |
356
- | `docs.steps` | `required` | Every step of a collection or request set has `docs`, in every list. |
357
- | `tags.allowed` | list of tags | Every tag on a collection or a step is one of these. |
358
- | `tags.collections` | `required` | Every collection has `tags` of its own. |
359
- | `tests.only` | list (below) | What a `tests` script may call. |
360
- | `tests.everyStep` | `required` | Every step that sends a request or reads a connection is checked (below). |
361
- | `tests.statusCode` | `required` | Every request step's checks include its status code (below). |
343
+ | Rule | Value | What it checks |
344
+ | -------------------- | ---------------------- | ------------------------------------------------------------------------------- |
345
+ | `ids.collections` | style or pattern | Each collection's id, its file name (§2). |
346
+ | `ids.requests` | style or pattern | Each reusable requests file's id (§2.5). |
347
+ | `ids.bases` | style or pattern | Each base collection's id (§2.7). |
348
+ | `ids.endpoints` | style or pattern | Each endpoints file's id (§2.6). |
349
+ | `layout.folders` | `required` | Every collection sits in a folder of `collections/`, none at its top. |
350
+ | `layout.folderNames` | list, style or pattern | Each folder of `collections/`: one of the list, or following the format. |
351
+ | `layout.maxSteps` | integer ≥ 1 | The most steps a collection has in `steps`; `setup` and `teardown` aside. |
352
+ | `steps.names` | `required` | Every step has a `name`, and no other step of its file has the same one. |
353
+ | `steps.url` | pattern | Every request step's URL, as written, matches it (below). |
354
+ | `docs.collections` | `required` | Every collection has `docs`. |
355
+ | `docs.requests` | `required` | Every reusable requests file has `docs`. |
356
+ | `docs.steps` | `required` | Every step of a collection or reusable requests file has `docs`, in every list. |
357
+ | `tags.allowed` | list of tags | Every tag on a collection or a step is one of these. |
358
+ | `tags.collections` | `required` | Every collection has `tags` of its own. |
359
+ | `tests.only` | list (below) | What a `tests` script may call. |
360
+ | `tests.everyStep` | `required` | Every step that sends a request or reads a connection is checked (below). |
361
+ | `tests.statusCode` | `required` | Every request step's checks include its status code (below). |
362
362
 
363
363
  - Any other group or rule is an error, as is a value of the wrong type.
364
364
  - A rule that takes `required` also takes `optional`, which turns it off.
@@ -375,8 +375,8 @@ flags what `tests.only` does not allow as a script is typed.
375
375
  `endpoints/`. A global project's files follow the global project's `rules.yml`, checked
376
376
  when `gta lint` runs in its folder.
377
377
  - `steps.*`, `docs.steps`, `tests.everyStep` and `tests.statusCode` are about the steps of
378
- collections and request sets. An endpoint is a method and a path pattern, not a step
379
- that runs, so they leave endpoints files alone.
378
+ collections and reusable requests files. An endpoint is a method and a path pattern,
379
+ not a step that runs, so they leave endpoints files alone.
380
380
 
381
381
  **`steps.url`** is a JavaScript regular expression that each request step's URL, as
382
382
  written with its `{{variables}}`, must match. Unlike an id pattern it is not anchored:
@@ -387,9 +387,9 @@ out in a step. A use step and a step reading a connection have no URL of their o
387
387
  response, wherever it is written: the step's own `tests`, its file's, its base
388
388
  collection's (§2.7) and its endpoint's (§2.6), unless the step has `base: false`. With
389
389
  `tests.statusCode`, one of them calls `gta.expectResponseStatusCodeToBe`, in any branch,
390
- or calls a check function (§5) whose own code does. A use step is left to its request
391
- set, whose steps are checked there. A step reading a connection needs tests under
392
- `tests.everyStep`, but has no status code of its own to check.
390
+ or calls a check function (§5) whose own code does. A use step is left to its reusable
391
+ requests file, whose steps are checked there. A step reading a connection needs tests
392
+ under `tests.everyStep`, but has no status code of its own to check.
393
393
 
394
394
  **`tests.only`** lists what a `tests` script may call. It must list `gta`:
395
395
 
@@ -425,8 +425,8 @@ tests: |
425
425
  ```
426
426
 
427
427
  `tests.only` checks every `tests` script: a collection's own and each of its steps', and
428
- those of request sets, base collections and endpoints files. `before.script` is not
429
- checked.
428
+ those of reusable requests files, base collections and endpoints files.
429
+ `before.script` is not checked.
430
430
 
431
431
  **`guide`** is Markdown, for what no rule can check: how steps are named, which request
432
432
  set a login goes through, what a collection is for. `gta rules` prints it after the
@@ -496,24 +496,24 @@ steps:
496
496
 
497
497
  Any key not listed here is an error.
498
498
 
499
- | Key | Type | Required | Default | Meaning |
500
- | ---------- | ------------------- | -------- | ------- | ------------------------------------------------------------------------------ |
501
- | `id` | string | **yes** | | The file name without `.yml` (below). |
502
- | `steps` | list of steps | no | `[]` | The requests, in run order (§2.1). |
503
- | `setup` | list of steps | no | | Run once before `steps`; what it sets lasts the run (§2.10). |
504
- | `teardown` | list of steps | no | | Run once after the rest, even when a step failed (§2.10). |
505
- | `docs` | string | no | | Markdown. |
506
- | `tags` | list of tags | no | | Tags that select the whole collection (§2.4). |
507
- | `stepTags` | boolean | no | `false` | `true` lets steps carry their own tags (§2.4). |
508
- | `exclude` | boolean | no | `false` | `true` leaves it out of group runs (§2.4). |
509
- | `flags` | map | no | | Feature flags the whole collection needs (§2.9). |
510
- | `headers` | map | no | | Sent with every step; a step's own header of the same name wins (§2.3). |
511
- | `settings` | map | no | | Defaults for every step (§2.3). |
512
- | `vars` | map of plain values | no | | Collection variables (§4). |
513
- | `before` | map | no | | `script:` run before every step (§5). |
514
- | `tests` | string | no | | JavaScript run after every step, before the step's own (§5). |
515
- | `extends` | string | no | | A base collection to build on (§2.7). |
516
- | `params` | map | no | | The inputs it takes as a request set (§2.5). Only in `requests/`, in practice. |
499
+ | Key | Type | Required | Default | Meaning |
500
+ | ---------- | ------------------- | -------- | ------- | ----------------------------------------------------------------------------------------- |
501
+ | `id` | string | **yes** | | The file name without `.yml` (below). |
502
+ | `steps` | list of steps | no | `[]` | The requests, in run order (§2.1). |
503
+ | `setup` | list of steps | no | | Run once before `steps`; what it sets lasts the run (§2.10). |
504
+ | `teardown` | list of steps | no | | Run once after the rest, even when a step failed (§2.10). |
505
+ | `docs` | string | no | | Markdown. |
506
+ | `tags` | list of tags | no | | Tags that select the whole collection (§2.4). |
507
+ | `stepTags` | boolean | no | `false` | `true` lets steps carry their own tags (§2.4). |
508
+ | `exclude` | boolean | no | `false` | `true` leaves it out of group runs (§2.4). |
509
+ | `flags` | map | no | | Feature flags the whole collection needs (§2.9). |
510
+ | `headers` | map | no | | Sent with every step; a step's own header of the same name wins (§2.3). |
511
+ | `settings` | map | no | | Defaults for every step (§2.3). |
512
+ | `vars` | map of plain values | no | | Collection variables (§4). |
513
+ | `before` | map | no | | `script:` run before every step (§5). |
514
+ | `tests` | string | no | | JavaScript run after every step, before the step's own (§5). |
515
+ | `extends` | string | no | | A base collection to build on (§2.7). |
516
+ | `params` | map | no | | The inputs it takes as a reusable requests file (§2.5). Only in `requests/`, in practice. |
517
517
 
518
518
  A collection has no `name` key. Its `id` is its name, and a file with `name:` is
519
519
  rejected with a message saying so.
@@ -547,29 +547,29 @@ key**, in capitals, whose value is the URL as a string.
547
547
 
548
548
  Methods: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS`.
549
549
 
550
- | Key | Type | Required | Meaning |
551
- | ------------ | ------------ | -------- | ------------------------------------------------------------------------- |
552
- | `<METHOD>` | string | **yes** | The URL, query string included. |
553
- | `name` | string | no | Display name. Defaults to the method and URL. |
554
- | `headers` | map | no | Over the collection's headers (§2.3). |
555
- | `body` | map | no | Exactly one kind of body (§2.2). |
556
- | `settings` | map | no | Over the collection's settings (§2.3). |
557
- | `before` | map | no | `script:` run before the request (§5). |
558
- | `tests` | string | no | The checks, as JavaScript: calls on `gta` (§3) and any other code (§5). |
559
- | `tags` | list of tags | no | The step's own tags. Only with `stepTags: true` on the collection (§2.4). |
560
- | `flags` | map | no | Feature flags the step needs (§2.9). |
561
- | `forEach` | string | no | Send the request once for each item of a list (below). |
562
- | `useTests` | `true` | no | In a request set: the use step's `tests` check this response (§2.5). |
563
- | `connection` | string | no | Keep the event stream this request opens as a connection (§2.11). |
564
- | `base` | `false` | no | `false` leaves the step's endpoint base out (§2.6). |
565
- | `docs` | string | no | Markdown. |
550
+ | Key | Type | Required | Meaning |
551
+ | ------------ | ------------ | -------- | ------------------------------------------------------------------------------- |
552
+ | `<METHOD>` | string | **yes** | The URL, query string included. |
553
+ | `name` | string | no | Display name. Defaults to the method and URL. |
554
+ | `headers` | map | no | Over the collection's headers (§2.3). |
555
+ | `body` | map | no | Exactly one kind of body (§2.2). |
556
+ | `settings` | map | no | Over the collection's settings (§2.3). |
557
+ | `before` | map | no | `script:` run before the request (§5). |
558
+ | `tests` | string | no | The checks, as JavaScript: calls on `gta` (§3) and any other code (§5). |
559
+ | `tags` | list of tags | no | The step's own tags. Only with `stepTags: true` on the collection (§2.4). |
560
+ | `flags` | map | no | Feature flags the step needs (§2.9). |
561
+ | `forEach` | string | no | Send the request once for each item of a list (below). |
562
+ | `useTests` | `true` | no | In a reusable requests file: the use step's `tests` check this response (§2.5). |
563
+ | `connection` | string | no | Keep the event stream this request opens as a connection (§2.11). |
564
+ | `base` | `false` | no | `false` leaves the step's endpoint base out (§2.6). |
565
+ | `docs` | string | no | Markdown. |
566
566
 
567
567
  - A step with two method keys is an error, and so is a step with none, unless it is a
568
568
  use step or reads a connection.
569
569
  - **The URL is authoritative, query string included.** There is no separate block of
570
570
  query parameters. Editors show a parameter table as a view over the URL.
571
- - A step may instead run a request set with `use:` (§2.5). A use step has no method
572
- key.
571
+ - A step may instead run reusable requests with `use:` (§2.5). A use step has no
572
+ method key.
573
573
  - A step may also read a connection, an event stream an earlier step keeps open, with
574
574
  `connection:` and no method key (§2.11).
575
575
  - **Any other key is an error**, so a misspelled key such as `heders:` fails at once
@@ -663,13 +663,14 @@ declared multipart type without a boundary, such as `multipart/mixed`, gets one
663
663
  A declared boundary is used as written.
664
664
 
665
665
  **Files**, in `body.file` and a multipart part's `file`, are read from the folder of
666
- the project the step belongs to. For a step of a request set, that is the set's own
667
- project, which may be a global one. The path is the same wherever the collection sits
668
- inside `collections/`.
666
+ the project the step belongs to. For a step of a reusable requests file, that is the
667
+ file's own project, which may be a global one. The path is the same wherever the
668
+ collection sits inside `collections/`.
669
669
 
670
- A file that is not there is looked for in the global project (§1.1), as a request set
671
- or a base collection is, so projects can share one copy of a file. A project's own file
672
- of the same path wins. `global:` before the path reads only the global project's:
670
+ A file that is not there is looked for in the global project (§1.1), as a reusable
671
+ requests file or a base collection is, so projects can share one copy of a file. A
672
+ project's own file of the same path wins. `global:` before the path reads only the
673
+ global project's:
673
674
 
674
675
  ```yaml
675
676
  body:
@@ -810,11 +811,12 @@ tags, and a folder named to `gta`. Named on its own, it still runs. Use it for w
810
811
  progress, a manual-only collection, or one waiting on a fix. `gta` lists what it left
811
812
  out, so a suite never shrinks without saying so.
812
813
 
813
- ### 2.5 Request sets and `use:`
814
+ ### 2.5 Reusable requests and `use:`
814
815
 
815
- A **request set** is a collection in `requests/`, directly or one folder down, with a
816
- `params:` key: the inputs it takes. A step elsewhere runs it with **`use:`**, and passes
817
- values with **`with:`**.
816
+ **Reusable requests** are one or more requests that any step can run with **`use:`**,
817
+ passing values with **`with:`**. They are written in a **reusable requests file**: a
818
+ collection in `requests/`, directly or one folder down, with a `params:` key, the
819
+ inputs it takes.
818
820
 
819
821
  ```yaml
820
822
  # requests/login.yml
@@ -859,39 +861,40 @@ values. No variable can take the place of a `params.` name.
859
861
 
860
862
  A default may name variables and other params, as in
861
863
  `email: '{{params.accountId}}@example.com'`. Like a `with:` value, it is resolved once
862
- for each use, so `accountId: '{{$uuid}}'` is one id wherever the set reads it.
864
+ for each use, so `accountId: '{{$uuid}}'` is one id wherever the file reads it.
863
865
 
864
866
  **A use step** holds only `use`, `with`, `name`, `tags`, `flags`, `docs` and `tests`. A
865
867
  method key, `headers`, `body`, `settings` or `before` on it is an error, and `with`
866
868
  without `use` is an error too.
867
869
 
868
- - **Finding the set.** `use: login` is `requests/login.yml` in the project, else in its
870
+ - **Finding the file.** `use: login` is `requests/login.yml` in the project, else in its
869
871
  global project. `use: auth/login` is one folder down. `use: global:login` looks
870
872
  only in the global project.
871
873
  - **`with:`** gives plain values; a param left out takes its default. A string may hold
872
- `{{variables}}`, resolved as the set's first request starts, just after the
874
+ `{{variables}}`, resolved as the file's first request starts, just after the
873
875
  collection's `before.script` has run for it: a value that script sets for each step
874
- (§4) reaches the set. A missing required value, a name the set does not take, or a
875
- value or default that cannot be resolved stops the set's steps before anything is
876
- sent.
877
- - **Running.** A use step runs each of the set's steps in turn, in the collection's
876
+ (§4) reaches the file's requests. A missing required value, a name the file does not
877
+ take, or a value or default that cannot be resolved stops the file's steps before
878
+ anything is sent.
879
+ - **Running.** A use step runs each of the file's steps in turn, in the collection's
878
880
  variable scope, so what one sets the next can read, and so can the steps after the use
879
881
  step. Each request is reported as its own result. When the use step has a `name`,
880
- reports use it: `sign in` for a set of one step, `sign in › get profile` for a longer
882
+ reports use it: `sign in` for a file of one step, `sign in › get profile` for a longer
881
883
  one.
882
- - **Layers.** Headers and settings: the collection's, under the set's, under each
883
- step's own. Scripts run collection, then set, then step: `before.script` before the
884
+ - **Layers.** Headers and settings: the collection's, under the file's, under each
885
+ step's own. Scripts run collection, then file, then step: `before.script` before the
884
886
  request and `tests` after. The use step's own `tests` run last, on the response of
885
- the set's step marked `useTests: true`, or else its last step. `params` is the set's
886
- alone: the collection's scripts, and a base collection's or an endpoint's (§2.6,
887
- §2.7), never see it. In an endpoint's `before.script`, a segment written as
887
+ the file's step marked `useTests: true`, or else its last step. `params` is the
888
+ file's alone: the collection's scripts, and a base collection's or an endpoint's
889
+ (§2.6, §2.7), never see it. In an endpoint's `before.script`, a segment written as
888
890
  `{{params.id}}` reads as written.
889
- - **One level.** A request set must not `use:` another, and has `params`, not `vars`. A
890
- file in `requests/` without `params` is not a request set.
891
+ - **One level.** A reusable requests file must not `use:` another, and has `params`,
892
+ not `vars`. A file in `requests/` without `params` is not a reusable requests file.
891
893
 
892
- **Saving under the caller's name.** A set can take the name to save a value under as a
893
- param, save it with `gta.set(params.saveAs, …)`, and read it back in its later steps
894
- with `{{@params.saveAs}}` (§4). The caller then reads it by the name it chose:
894
+ **Saving under the caller's name.** A reusable requests file can take the name to save
895
+ a value under as a param, save it with `gta.set(params.saveAs, …)`, and read it back in
896
+ its later steps with `{{@params.saveAs}}` (§4). The caller then reads it by the name it
897
+ chose:
895
898
 
896
899
  ```yaml
897
900
  # requests/create-user.yml
@@ -920,7 +923,8 @@ steps:
920
923
  headers: { Authorization: 'Bearer {{token1}}' }
921
924
  ```
922
925
 
923
- Only one step of a set may have `useTests`, and only a set's steps.
926
+ Only one step of a reusable requests file may have `useTests`, and no other file's
927
+ steps.
924
928
 
925
929
  ### 2.6 Endpoint bases
926
930
 
@@ -961,8 +965,8 @@ steps:
961
965
  `endpoint.id` is `42` for `{{baseUrl}}/users/{{userId}}` with `userId: 42`.
962
966
  - **What applies**, outermost first: the endpoints file's own `headers`, `settings`,
963
967
  `before` and `tests`, then the endpoint's, then the base collection's (§2.7), the
964
- collection's, the request set's (§2.5) and the step's. Nearer headers and settings
965
- win.
968
+ collection's, the reusable requests file's (§2.5) and the step's. Nearer headers and
969
+ settings win.
966
970
  - **A step's own check replaces the base's check of the same thing**: the status, a
967
971
  header by name, or a body property by path. A negative test only says what it expects,
968
972
  so checking for a 404 replaces the base's 200. Checks of other things stay, and named
@@ -1062,8 +1066,8 @@ steps:
1062
1066
  ```
1063
1067
 
1064
1068
  - **Every flag named must have the value given.** A collection's `flags` apply to each
1065
- of its steps, and a use step's to each request of its set. Values compare as text, so
1066
- `true` matches `true` or `"true"`, and `2` matches `"2"`.
1069
+ of its steps, and a use step's to each of its reusable requests. Values compare as
1070
+ text, so `true` matches `true` or `"true"`, and `2` matches `"2"`.
1067
1071
  - **A step whose flags do not hold is skipped**, not failed. It sends nothing and is
1068
1072
  reported as skipped with the reason, such as `feature flag newCheckout is off`. A
1069
1073
  skipped step never fails a run.
@@ -1147,7 +1151,8 @@ steps: # once per row of approved-domains.csv, as before
1147
1151
  - **The collection applies to them**: its headers, settings, `before`, `tests` and
1148
1152
  flags, as to any step. Their steps may be use steps and may use `forEach`, but carry
1149
1153
  no `tags`: they run whenever the collection does.
1150
- - A request set, a base collection and an endpoints file have no setup or teardown.
1154
+ - A reusable requests file, a base collection and an endpoints file have no setup or
1155
+ teardown.
1151
1156
  - Reports name their results `setup › log in` and `teardown › remove the grant`. Running
1152
1157
  a single step in the desktop app does not run them.
1153
1158
 
@@ -1410,7 +1415,7 @@ to. Whitespace inside the braces is ignored. In code, read a variable with
1410
1415
  - **`{{@name}}` reads the variable `name` names.** With `saveAs: token1`,
1411
1416
  `{{@saveAs}}` is the value of `token1`. The name may itself be built from variables.
1412
1417
  A name that is not text, or names no variable, fails like an unknown variable. A
1413
- request set uses it to read what it saved under its caller's name (§2.5).
1418
+ reusable requests file uses it to read what it saved under its caller's name (§2.5).
1414
1419
  - **In YAML, quote a value that starts with `{{`.** Unquoted, YAML reads `{` as a map.
1415
1420
 
1416
1421
  ### Built-in variables
@@ -1523,7 +1528,7 @@ military zone letter (`U` is -08:00, not UTC).
1523
1528
  | `req` | `method`, `url`, `headers`, `body`: as sent in `tests`, as written in `before.script`, where a script may change `headers` and `body` (below). |
1524
1529
  | `assert` | Node's strict `assert`, for use inside `gta.test`. |
1525
1530
  | `console` | Captured into the step's result. |
1526
- | `params` | A request set's params (§2.5), in its own scripts and in the tests of the use step running it. |
1531
+ | `params` | A reusable requests file's params (§2.5), in its own scripts and in the tests of the use step running it. |
1527
1532
  | `endpoint` | An endpoint base's `{name}` values (§2.6), in its scripts and in every script of a step under it. |
1528
1533
  | `checks` | The project's check files (below). |
1529
1534
 
@@ -1704,7 +1709,8 @@ it. Rules checked at run time fail the step, or the run, before anything is sent
1704
1709
  - There is no `expect:` key; checks go in `tests`.
1705
1710
  - `base` is only ever `false`.
1706
1711
  - `forEach` is a string, and a use step has none.
1707
- - `useTests` is only ever `true`, only on a request set's step, and on one step at most.
1712
+ - `useTests` is only ever `true`, only on a reusable requests file's step, and on one
1713
+ step at most.
1708
1714
  - A step reading a connection has no `headers`, `body`, `base` or `forEach`. A step
1709
1715
  opening one has no `forEach`, and a use step has no `connection` (§2.11).
1710
1716
 
@@ -1729,7 +1735,8 @@ it. Rules checked at run time fail the step, or the run, before anything is sent
1729
1735
 
1730
1736
  **Library files**
1731
1737
 
1732
- - A request set (`requests/`) has `params`, uses no other set, and has no `vars`.
1738
+ - A reusable requests file (`requests/`) has `params`, uses no other, and has no
1739
+ `vars`.
1733
1740
  - A base collection (`bases/`) has no `steps`, `setup`, `teardown` or `params`, and no
1734
1741
  `extends`.
1735
1742
  - An endpoint (`endpoints/`) has a URL that is a path starting with `/`, and no use
@@ -1768,7 +1775,7 @@ it. Rules checked at run time fail the step, or the run, before anything is sent
1768
1775
  seconds, printing a JSON object.
1769
1776
  - Every file a body names can be read from the project folder, or its global
1770
1777
  project's (§2.2).
1771
- - Every `use:` and `extends:` names a usable file, and every `with:` suits its set.
1778
+ - Every `use:` and `extends:` names a usable file, and every `with:` suits its file.
1772
1779
  `gta get` checks these, and the body files named without `{{variables}}`, without
1773
1780
  running anything (§1.3).
1774
1781
  - A step's `forEach` resolves to a JSON array.
@@ -9,7 +9,7 @@ import {
9
9
  loadProject,
10
10
  paint,
11
11
  tallyOf
12
- } from "./chunk-Q3VRXFS5.js";
12
+ } from "./chunk-4W4TFJ53.js";
13
13
  import {
14
14
  COLLECTIONS_DIR,
15
15
  canonical,
@@ -20,7 +20,7 @@ import {
20
20
  secretValues,
21
21
  stepLabel,
22
22
  stepLines
23
- } from "./chunk-ZDHGCHIV.js";
23
+ } from "./chunk-S563G22M.js";
24
24
 
25
25
  // src/library/project.ts
26
26
  import path from "node:path";
@@ -22,7 +22,7 @@ import {
22
22
  resolveFlags,
23
23
  resultName,
24
24
  stepsForTags
25
- } from "./chunk-ZDHGCHIV.js";
25
+ } from "./chunk-S563G22M.js";
26
26
 
27
27
  // src/args.ts
28
28
  var UsageError = class extends Error {
@@ -54801,7 +54801,7 @@ var StepSchema = external_exports.looseObject({
54801
54801
  ctx.addIssue({
54802
54802
  code: "custom",
54803
54803
  path: [key],
54804
- message: `a use: step runs a request set, so it cannot have ${key} of its own (SPEC.md \xA72.5)`
54804
+ message: `a use: step runs reusable requests, so it cannot have ${key} of its own (SPEC.md \xA72.5)`
54805
54805
  });
54806
54806
  }
54807
54807
  return;
@@ -54964,7 +54964,7 @@ var CollectionSchema = external_exports.strictObject({
54964
54964
  ctx.addIssue({
54965
54965
  code: "custom",
54966
54966
  path: [stage],
54967
- message: `a request set runs inside another collection, so it has no ${stage} (SPEC.md \xA72.10)`
54967
+ message: `a reusable requests file runs inside another collection, so it has no ${stage} (SPEC.md \xA72.10)`
54968
54968
  });
54969
54969
  }
54970
54970
  collection[stage].forEach((step, index) => {
@@ -54982,7 +54982,7 @@ var CollectionSchema = external_exports.strictObject({
54982
54982
  ctx.addIssue({
54983
54983
  code: "custom",
54984
54984
  path: ["steps", marked[0], "useTests"],
54985
- message: "useTests marks the request set step whose response a use step's tests check; this collection has no params, so it is not a request set (SPEC.md \xA72.5)"
54985
+ message: "useTests marks the step of a reusable requests file whose response a use step's tests check; this collection has no params, so it is not a reusable requests file (SPEC.md \xA72.5)"
54986
54986
  });
54987
54987
  }
54988
54988
  if (marked.length > 1) {
@@ -54998,7 +54998,7 @@ var CollectionSchema = external_exports.strictObject({
54998
54998
  ctx.addIssue({
54999
54999
  code: "custom",
55000
55000
  path: ["steps", index, "use"],
55001
- message: "a request set cannot use another one (SPEC.md \xA72.5)"
55001
+ message: "a reusable requests file cannot use another one (SPEC.md \xA72.5)"
55002
55002
  });
55003
55003
  }
55004
55004
  });
@@ -55006,7 +55006,7 @@ var CollectionSchema = external_exports.strictObject({
55006
55006
  ctx.addIssue({
55007
55007
  code: "custom",
55008
55008
  path: ["vars"],
55009
- message: "a request set takes params, not vars (SPEC.md \xA72.5)"
55009
+ message: "a reusable requests file takes params, not vars (SPEC.md \xA72.5)"
55010
55010
  });
55011
55011
  }
55012
55012
  }
@@ -56611,7 +56611,7 @@ async function resolveRequestSet(root, global, reference) {
56611
56611
  const set2 = await resolveIn(root, global, reference, REQUESTS_DIR, "use");
56612
56612
  if (!set2.doc.params) {
56613
56613
  throw new Error(
56614
- `use: ${reference} \u2014 ${set2.name}.yml has no params, so it is not a request set (SPEC.md \xA72.5)`
56614
+ `use: ${reference} \u2014 ${set2.name}.yml has no params, so it is not a reusable requests file (SPEC.md \xA72.5)`
56615
56615
  );
56616
56616
  }
56617
56617
  return set2;
@@ -59355,7 +59355,7 @@ async function planSteps(collection, collectionPath) {
59355
59355
  project ??= await projectOf(collectionPath);
59356
59356
  const set2 = await resolveRequestSet(project.root, project.global, step.use);
59357
59357
  checkWith(step.use, set2.doc, step.with ?? {});
59358
- if (set2.doc.steps.length === 0) throw new Error(`use: ${step.use} \u2014 the set has no steps`);
59358
+ if (set2.doc.steps.length === 0) throw new Error(`use: ${step.use} \u2014 the file has no steps`);
59359
59359
  const planSet = {
59360
59360
  name: step.use,
59361
59361
  useName: step.name?.trim() ? step.name : void 0,
@@ -60472,7 +60472,7 @@ var idRule = (home, what) => ({
60472
60472
  var RULES = {
60473
60473
  ids: {
60474
60474
  collections: idRule("collections", "a collection"),
60475
- requests: idRule("requests", "a request set"),
60475
+ requests: idRule("requests", "a reusable requests file"),
60476
60476
  bases: idRule("bases", "a base collection"),
60477
60477
  endpoints: idRule("endpoints", "an endpoints file")
60478
60478
  },
@@ -60495,7 +60495,7 @@ var RULES = {
60495
60495
  steps: {
60496
60496
  names: {
60497
60497
  schema: RequirementSchema,
60498
- doc: "required: every step of a collection or request set has a name of its own, no other step of its file sharing it."
60498
+ doc: "required: every step of a collection or reusable requests file has a name of its own, no other step of its file sharing it."
60499
60499
  },
60500
60500
  url: {
60501
60501
  schema: UrlPatternSchema,
@@ -60504,10 +60504,13 @@ var RULES = {
60504
60504
  },
60505
60505
  docs: {
60506
60506
  collections: { schema: RequirementSchema, doc: "required: every collection has docs." },
60507
- requests: { schema: RequirementSchema, doc: "required: every request set has docs." },
60507
+ requests: {
60508
+ schema: RequirementSchema,
60509
+ doc: "required: every reusable requests file has docs."
60510
+ },
60508
60511
  steps: {
60509
60512
  schema: RequirementSchema,
60510
- doc: "required: every step of a collection or request set has docs, setup and teardown included."
60513
+ doc: "required: every step of a collection or reusable requests file has docs, setup and teardown included."
60511
60514
  }
60512
60515
  },
60513
60516
  tags: {
@@ -60531,7 +60534,7 @@ var RULES = {
60531
60534
  },
60532
60535
  everyStep: {
60533
60536
  schema: RequirementSchema,
60534
- doc: "required: every step that sends a request or reads a connection is checked by some tests \u2014 its own, its file\u2019s, its base collection\u2019s or its endpoint\u2019s. A use step\u2019s requests are checked in their request set."
60537
+ doc: "required: every step that sends a request or reads a connection is checked by some tests \u2014 its own, its file\u2019s, its base collection\u2019s or its endpoint\u2019s. A use step\u2019s requests are checked in their own file."
60535
60538
  },
60536
60539
  statusCode: {
60537
60540
  schema: RequirementSchema,
package/dist/gta.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  tableWidth,
29
29
  tally,
30
30
  totalsOf
31
- } from "./chunks/chunk-Q3VRXFS5.js";
31
+ } from "./chunks/chunk-4W4TFJ53.js";
32
32
  import {
33
33
  COLLECTIONS_DIR,
34
34
  MARK_GLYPH,
@@ -59,7 +59,7 @@ import {
59
59
  sortArraysBy,
60
60
  toJsonLines,
61
61
  unattempted
62
- } from "./chunks/chunk-ZDHGCHIV.js";
62
+ } from "./chunks/chunk-S563G22M.js";
63
63
 
64
64
  // src/main.ts
65
65
  import fs from "node:fs/promises";
@@ -276,7 +276,7 @@ var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
276
276
  function checkedLine(checked) {
277
277
  return [
278
278
  plural(checked.collections, "collection", "collections"),
279
- plural(checked.requests, "request set", "request sets"),
279
+ plural(checked.requests, "reusable requests file", "reusable requests files"),
280
280
  plural(checked.bases, "base collection", "base collections"),
281
281
  plural(checked.endpoints, "endpoints file", "endpoints files")
282
282
  ].join(", ");
@@ -1365,7 +1365,7 @@ function escape2(value) {
1365
1365
  var allowedInXml = (code) => code === 9 || code === 10 || code === 13 || code >= 32 && code <= 55295 || code >= 57344 && code <= 65533 || code >= 65536;
1366
1366
 
1367
1367
  // src/main.ts
1368
- var VERSION = true ? "0.14.0" : "0.0.0-dev";
1368
+ var VERSION = true ? "0.14.2" : "0.0.0-dev";
1369
1369
  var JUNIT_DIR = "junit";
1370
1370
  var JUNIT_FILE = "junit.xml";
1371
1371
  var HTML_DIR = "html";
package/dist/index.js CHANGED
@@ -3,9 +3,9 @@ import { createRequire as __gtaCreateRequire } from 'node:module';
3
3
  const require = __gtaCreateRequire(import.meta.url);
4
4
  import {
5
5
  openProject
6
- } from "./chunks/chunk-KVO46B7X.js";
7
- import "./chunks/chunk-Q3VRXFS5.js";
8
- import "./chunks/chunk-ZDHGCHIV.js";
6
+ } from "./chunks/chunk-4JUUUUWB.js";
7
+ import "./chunks/chunk-4W4TFJ53.js";
8
+ import "./chunks/chunk-S563G22M.js";
9
9
 
10
10
  // src/library/index.ts
11
11
  var openProject2 = openProject;
@@ -23,8 +23,8 @@ export interface Gta {
23
23
  readonly project: GravityProject;
24
24
  /** `project.run`, reported as a step, failing the test when the run fails. */
25
25
  run(collection: string, options?: GtaRunOptions): Promise<RunOutcome>;
26
- /** `project.use`, reported as a step, failing the test when the set fails. */
27
- use(set: string, params?: Record<string, VarValue>, options?: GtaUseOptions): Promise<RunOutcome>;
26
+ /** `project.use`, reported as a step, failing the test when the run fails. */
27
+ use(name: string, params?: Record<string, VarValue>, options?: GtaUseOptions): Promise<RunOutcome>;
28
28
  }
29
29
  export interface GravityFixtures {
30
30
  gta: Gta;
@@ -3,12 +3,12 @@ import { createRequire as __gtaCreateRequire } from 'node:module';
3
3
  const require = __gtaCreateRequire(import.meta.url);
4
4
  import {
5
5
  openProject
6
- } from "./chunks/chunk-KVO46B7X.js";
7
- import "./chunks/chunk-Q3VRXFS5.js";
6
+ } from "./chunks/chunk-4JUUUUWB.js";
7
+ import "./chunks/chunk-4W4TFJ53.js";
8
8
  import {
9
9
  iterationName,
10
10
  resultName
11
- } from "./chunks/chunk-ZDHGCHIV.js";
11
+ } from "./chunks/chunk-S563G22M.js";
12
12
 
13
13
  // src/library/playwright.ts
14
14
  import path from "node:path";
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The types of gta's library, `@schwabyio/gta`: a project's collections and
3
- * request sets run from code, such as a Playwright test.
3
+ * reusable requests run from code, such as a Playwright test.
4
4
  *
5
5
  * Written out here rather than taken from the core, so the published `.d.ts`
6
6
  * files stand alone: the core's are zod's inferences, and neither ships.
@@ -119,7 +119,10 @@ export interface RunResult {
119
119
  reason: string;
120
120
  };
121
121
  durationMs: number;
122
- /** For a request a use step ran: the set, the use step's name, and which of the set's steps, from 0. */
122
+ /**
123
+ * For a request a use step ran: the reusable requests as `use` named them,
124
+ * the use step's name, and which of their steps, from 0.
125
+ */
123
126
  use?: {
124
127
  set: string;
125
128
  name?: string;
@@ -148,7 +151,7 @@ export interface CollectionRunSummary {
148
151
  }
149
152
  /** Where a result's step is written, for a person to go and look. */
150
153
  export interface StepRef {
151
- /** The file, absolute: the collection's, or for `use`, the request set's. */
154
+ /** The file, absolute: the collection's, or for `use`, the reusable requests file's. */
152
155
  file: string;
153
156
  /** The step's line in it, from 1; null when it cannot be told. */
154
157
  line: number | null;
@@ -192,7 +195,7 @@ export type UseOptions = Omit<RunOptions, 'steps'>;
192
195
  export interface RunOutcome {
193
196
  /** Nothing failed or errored, and the run finished. */
194
197
  passed: boolean;
195
- /** The collection's id, or the request set as `use` named it. */
198
+ /** The collection's id, or the reusable requests as `use` named them. */
196
199
  id: string;
197
200
  /** Its file, absolute. */
198
201
  file: string;
@@ -233,11 +236,11 @@ export interface GravityProject {
233
236
  */
234
237
  run(collection: string, options?: RunOptions): Promise<RunOutcome>;
235
238
  /**
236
- * Run a request set as a use step would (SPEC.md §2.5): `login` is
239
+ * Run reusable requests as a use step would (SPEC.md §2.5): `login` is
237
240
  * `requests/login.yml`, in the project or its global project. A param left
238
241
  * out takes its default.
239
242
  */
240
- use(set: string, params?: Record<string, VarValue>, options?: UseOptions): Promise<RunOutcome>;
243
+ use(name: string, params?: Record<string, VarValue>, options?: UseOptions): Promise<RunOutcome>;
241
244
  }
242
245
  /** Open the project in `folder`, the one holding `collections/`. */
243
246
  export type OpenProjectFunction = (folder: string, options?: OpenOptions) => Promise<GravityProject>;
package/dist/worker.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire as __gtaCreateRequire } from 'node:module';
3
3
  const require = __gtaCreateRequire(import.meta.url);
4
4
  import {
5
5
  runJob
6
- } from "./chunks/chunk-ZDHGCHIV.js";
6
+ } from "./chunks/chunk-S563G22M.js";
7
7
 
8
8
  // src/worker.ts
9
9
  import { parentPort, workerData } from "node:worker_threads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schwabyio/gta",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "type": "module",
5
5
  "description": "gta, the Gravity Test Automation command-line runner: HTTP API tests written as YAML files, run from a terminal or CI.",
6
6
  "keywords": [