@yaks/testing 0.0.0-stage → 0.2.36

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.
Files changed (93) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +427 -2
  3. package/_dist/assert.d.ts +40 -0
  4. package/_dist/assert.d.ts.map +1 -0
  5. package/_dist/choose.d.ts +39 -0
  6. package/_dist/choose.d.ts.map +1 -0
  7. package/_dist/clock.d.ts +8 -0
  8. package/_dist/clock.d.ts.map +1 -0
  9. package/_dist/deps.d.ts +113 -0
  10. package/_dist/deps.d.ts.map +1 -0
  11. package/_dist/examples.d.ts +69 -0
  12. package/_dist/examples.d.ts.map +1 -0
  13. package/_dist/find.d.ts +23 -0
  14. package/_dist/find.d.ts.map +1 -0
  15. package/_dist/kept.d.ts +27 -0
  16. package/_dist/kept.d.ts.map +1 -0
  17. package/_dist/lend.d.ts +15 -0
  18. package/_dist/lend.d.ts.map +1 -0
  19. package/_dist/main.d.ts +2 -0
  20. package/_dist/main.d.ts.map +1 -0
  21. package/_dist/mod.d.ts +45 -0
  22. package/_dist/mod.d.ts.map +1 -0
  23. package/_dist/names.d.ts +31 -0
  24. package/_dist/names.d.ts.map +1 -0
  25. package/_dist/own.d.ts +25 -0
  26. package/_dist/own.d.ts.map +1 -0
  27. package/_dist/reads.d.ts +8 -0
  28. package/_dist/reads.d.ts.map +1 -0
  29. package/_dist/suite.d.ts +82 -0
  30. package/_dist/suite.d.ts.map +1 -0
  31. package/_dist/typist.d.ts +24 -0
  32. package/_dist/typist.d.ts.map +1 -0
  33. package/_dist/wait.d.ts +21 -0
  34. package/_dist/wait.d.ts.map +1 -0
  35. package/assert.js +114 -0
  36. package/assert.js.map +1 -0
  37. package/assert.ts +143 -0
  38. package/choose.js +197 -0
  39. package/choose.js.map +1 -0
  40. package/choose.ts +327 -0
  41. package/clock.js +45 -0
  42. package/clock.js.map +1 -0
  43. package/clock.ts +60 -0
  44. package/deno.json +1 -0
  45. package/deps.js +868 -0
  46. package/deps.js.map +1 -0
  47. package/deps.ts +1004 -0
  48. package/drive.js +43 -0
  49. package/drive.js.map +1 -0
  50. package/drive.ts +41 -0
  51. package/examples.js +279 -0
  52. package/examples.js.map +1 -0
  53. package/examples.ts +380 -0
  54. package/find.js +86 -0
  55. package/find.js.map +1 -0
  56. package/find.ts +102 -0
  57. package/kept.js +128 -0
  58. package/kept.js.map +1 -0
  59. package/kept.ts +146 -0
  60. package/lend.js +30 -0
  61. package/lend.js.map +1 -0
  62. package/lend.ts +31 -0
  63. package/load.js +106 -0
  64. package/load.js.map +1 -0
  65. package/load.ts +139 -0
  66. package/main.js +214 -0
  67. package/main.js.map +1 -0
  68. package/main.ts +217 -0
  69. package/mod.js +45 -0
  70. package/mod.js.map +1 -0
  71. package/mod.ts +55 -0
  72. package/names.js +209 -0
  73. package/names.js.map +1 -0
  74. package/names.ts +204 -0
  75. package/own.js +109 -0
  76. package/own.js.map +1 -0
  77. package/own.ts +136 -0
  78. package/package.json +56 -4
  79. package/reads.js +88 -0
  80. package/reads.js.map +1 -0
  81. package/reads.ts +98 -0
  82. package/run.js +306 -0
  83. package/run.js.map +1 -0
  84. package/run.ts +405 -0
  85. package/suite.js +191 -0
  86. package/suite.js.map +1 -0
  87. package/suite.ts +224 -0
  88. package/typist.js +74 -0
  89. package/typist.js.map +1 -0
  90. package/typist.ts +79 -0
  91. package/wait.js +34 -0
  92. package/wait.js.map +1 -0
  93. package/wait.ts +60 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sources":["../assert.ts"],"names":[],"mappings":"AAmDA;;;;;;;CAOC,GACD,OAAO,YAAI;GACR,UAAU,MAAM,EAAE,QAAQ,GAAG,UAAU,MAAM,EAAE,UAAU,MAAM,IAAG;GAClE,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,MAAM,IAAG;EAIhD;AAED;;;;;;CAMC,GACD,OAAO,YAAI,KAAM,GAAG,QAAQ,GAAG,UAAU,MAAM,KAAG,YAAY,GAG7D;AAuBD;;;;;;;;;;;;CAYC,GACD,OAAO,YAAI,QAAS,GAAG,QAAQ,GAAG,SAAS,OAAO,EAAE,UAAU,MAAM,KAAG,EAGtE;AAED;;;;;;;CAOC,GACD,OAAO,YAAI,SACT,UAAU,OAAO,EACjB,UAAU,MAAM,GAAG,WAClB,QAAQ,OAAO,EAajB"}
@@ -0,0 +1,39 @@
1
+ import { type Survey } from "./deps.js";
2
+ import type { Examples } from "./examples.js";
3
+ /** What a run chose: the key of each runtime consumer of the change, those it runs,
4
+ * whether those import any of `paths` (true when the graph could not say),
5
+ * and what a file read as this version of it last passed, where that is
6
+ * known: another version's reads are not this one's. */ export type Chosen = {
7
+ keys: Map<string, string>;
8
+ run: string[];
9
+ affected: string[];
10
+ sources: string[];
11
+ beyond: number;
12
+ reaches: (paths: string[]) => boolean;
13
+ read: (file: string) => string[] | undefined;
14
+ };
15
+ /** Of `files`, what fits `budget`: the lowest rank first, and the cheapest
16
+ * first of a rank. A file that does not fit is passed over for a cheaper one
17
+ * behind it. Their order is kept. */ export declare let within: (files: string[], rank: (file: string) => number, cost: (file: string) => number, budget: number) => string[];
18
+ /**
19
+ * Chooses among `files`. A file runs in a runtime of some `kind`, whose files
20
+ * share the runtime's version, the kind's name, what `also` names and the
21
+ * modules of the `runner` running them, each with what loads with it
22
+ * (./deps.ts `shared`); when a run is `observed` its runtimes see what each
23
+ * file reads (./reads.ts), and a pass is kept by that too. `changed` first
24
+ * narrows the files to those reached by these paths, even with no cache.
25
+ * A narrowed run with a `budget` keeps changed files, files naming edited
26
+ * code directly or through re-exports, direct consumers of other runtime
27
+ * changes, and files that read the changed file or list its directory.
28
+ * Nearby and named consumers compete for the remaining time by expected cost.
29
+ * A change to shared runtime dependencies also keeps a sample of their files.
30
+ * Main's full run covers the farther consumers and files beyond the budget.
31
+ * Given each path's package
32
+ * (`owner`), the files of a changed package its distance reaches come first,
33
+ * followed by those importing it.
34
+ * When deno cannot say what a module imports, a narrowed run reports that
35
+ * selection is unavailable; an explicit run has no keys and runs its files.
36
+ */ export declare let choose: (files: string[], _dts_1: never) => Promise<Chosen>;
37
+ /** Whether a change reaches a file, its shared dependencies or its observed
38
+ * reads. Runner dependencies count only when they load unconditionally. */ export declare let affected: (s: Survey, roots: string[], runner: string[], changed: string[], reads?: string[], observed?: Survey, runtime?: boolean) => boolean;
39
+ //# sourceMappingURL=choose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choose.d.ts","sources":["../choose.ts"],"names":[],"mappings":"AAQA,SAOE,KAAK,MAAM,oBAGK;AAClB,cAAc,QAAQ,wBAAuB;AAK7C;;;sDAGsD,GACtD,YAAY;EACV,MAAM,IAAI,MAAM,EAAE,MAAM;EACxB,KAAK,MAAM;EACX,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,UAAU,OAAO,MAAM,OAAO,OAAO;EACrC,OAAO,MAAM,MAAM,KAAK,MAAM,KAAK,SAAS;;AAO9C;;mCAEmC,GACnC,OAAO,YAAI,SACT,OAAO,MAAM,IACb,OAAO,MAAM,MAAM,KAAK,MAAM,EAC9B,OAAO,MAAM,MAAM,KAAK,MAAM,EAC9B,QAAQ,MAAM,KACb,MAAM,GASR;AAUD;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,YAAI,SACT,OAAO,MAAM,IACb,kBAkCC,QAAQ,QAsKV;AAUD;yEACyE,GACzE,OAAO,YAAI,WACT,GAAG,QACH,OAAO,MAAM,IACb,QAAQ,MAAM,IACd,SAAS,MAAM,IACf,QAAO,MAAM,IACb,WAAU,QACV,sBACC,OAAO,CAGqC"}
@@ -0,0 +1,8 @@
1
+ /** A clock whose time and scheduled callbacks are controlled by the caller. */ export type Clock = {
2
+ now: () => number;
3
+ after: (ms: number, callback: () => void | Promise<void>) => () => void;
4
+ advance: (ms: number) => Promise<void>;
5
+ /** How many callbacks are set and have neither run nor been cancelled. */ pending: () => number;
6
+ };
7
+ /** Create a virtual clock at a chosen time, in milliseconds. */ export declare let clock: (start?: number) => Clock;
8
+ //# sourceMappingURL=clock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.d.ts","sources":["../clock.ts"],"names":[],"mappings":"AAIA,6EAA6E,GAC7E,YAAY;EACV,WAAW,MAAM;EACjB,QAAQ,IAAI,MAAM,EAAE,gBAAgB,IAAI,GAAG,QAAQ,IAAI,YAAY,IAAI;EACvE,UAAU,IAAI,MAAM,KAAK,QAAQ,IAAI;EACrC,wEAAwE,GACxE,eAAe,MAAM;;AAGvB,8DAA8D,GAC9D,OAAO,YAAI,QAAS,mBAAY,MA6C/B"}
@@ -0,0 +1,113 @@
1
+ import { type Info } from "@yaks/process/modules";
2
+ export type { Info };
3
+ /** A checkout's paths: its directory, its `file://` base, a path's URL and a
4
+ * specifier's checkout path. */ export type Location = {
5
+ cwd: string;
6
+ base: string;
7
+ url: (path: string) => string;
8
+ rel: (specifier: string) => string;
9
+ };
10
+ export declare let location: (cwd?: string) => Location;
11
+ /** The module graph reached from `roots`, checkout paths or URLs, or
12
+ * undefined when deno cannot say (@yaks/process/modules). */ export declare let graph: (roots: string[]) => Promise<Info | undefined>;
13
+ /** What a graph's caller can say of a path: what it holds now (`digest`). */ export type Bytes = (path: string) => Promise<string>;
14
+ /** What in a module's source decides what deno says it imports: each line
15
+ * holding an import, a re-export, a `require` or a compiler pragma, and each
16
+ * specifier one of those names, however the lines around it break. Two
17
+ * versions of a module alike in these resolve alike. */ export declare let importing: (source: string) => string;
18
+ /** What decides what deno says `path` imports, now: a module's
19
+ * `importing`, any other file's bytes. */ export declare let said: Bytes;
20
+ /** Where what deno said each module imports is kept, by what decides it. */ export declare let GRAPH: string;
21
+ /** What a checkout's graph starts from: the one any checkout under the same
22
+ * root configuration wrote last. A checkout of another revision keeps its
23
+ * own, so checkouts of main and of a branch changing deno.json, run at once,
24
+ * never each find the other's and resolve every module again. */ export declare let graphSeed: (cwd?: string) => string;
25
+ /** Where what each file of the checkout held, as last read, is kept by the
26
+ * file's status (`survey`). */ export declare let FACTS: string;
27
+ /**
28
+ * `info` (`deno info`), asked only of what changed: each module deno said
29
+ * before is kept by what decides what it imports (`said`: its import lines,
30
+ * not the rest of its bytes), and while those and the configs and lock
31
+ * resolving it hold, what it imports is what deno said then. A module whose
32
+ * imports changed, or never seen, is asked again, with what it reaches. The
33
+ * store names a checkout's files from the checkout, and the examples a
34
+ * process writes beside a page (./load.ts `beside`) without its pid, so
35
+ * every checkout and run shares it; the checkout's store is written once,
36
+ * and the seed is the same file.
37
+ */ export declare let remembered: (info?: (roots: string[]) => Promise<Info | undefined>, seed?: string) => any;
38
+ /** Files a module names with a module-relative URL or a literal Deno read
39
+ * path. Computed paths are observed in the runtime. */ export declare let named: (source: string, path: string, _dts_1: never) => string[];
40
+ /** What a path holds now: a file's bytes, a directory's listing (each entry's
41
+ * name, a directory's ending in `/`, but for what the runner writes beside a
42
+ * page while it is keyed or loads), or nothing. A directory a module only
43
+ * names is a `place`, whatever lies in it. */ export declare let digest: (path: string, place?: boolean) => Promise<string>;
44
+ /**
45
+ * Each node's seal: a digest of what it is (`own`) and of every node it
46
+ * reaches through `next`, so a change to any of those changes it. Nodes in a
47
+ * cycle reach each other, and share one; a seal is made of the seals of the
48
+ * cycles a node's own reaches (Tarjan's strongly connected components, which
49
+ * come last first), so a graph is sealed in one pass however many roots
50
+ * share it.
51
+ */ export declare let seal: (next: Map<string, string[]>, own: (node: string) => string) => Map<string, string>;
52
+ /** What a run knows of some paths and everything they reach, each file read
53
+ * once: what a path holds now (`of`: a code module's seal, else its `digest`,
54
+ * a directory its listing), what a module is with only what loads with it
55
+ * (`loads`: its seal without what it imports only when it asks, by a literal
56
+ * `import('…')`), and the seals of what a module imports (`next`). A file of
57
+ * data is its bytes whether or not a module there imports it (a config read
58
+ * as JSON), so it holds the same in every survey. A file's `distance` from a
59
+ * change is the imports between them, never through a module wider than
60
+ * `WIDE`; given each path's package (`owner`), a file of a changed package
61
+ * is 0 when changes in that package reach it, and 1 otherwise. A file
62
+ * importing a changed package from another is at most 1. `distance` follows
63
+ * runtime imports by default; `false` includes type-only imports. */ export type Survey = {
64
+ info: (roots: string[], refreshed?: string[]) => Promise<Info | undefined>;
65
+ bytes: Bytes;
66
+ said: Bytes;
67
+ of: (path: string, runtime?: boolean) => Promise<string>;
68
+ loads: (path: string) => Promise<string>;
69
+ next: (path: string, runtime?: boolean) => string[];
70
+ reaches: (roots: string[], changed: string[], loaded?: boolean, runtime?: boolean) => boolean;
71
+ distance: (changed: string[], owner?: (path: string) => string | undefined, runtime?: boolean) => (root: string) => number;
72
+ };
73
+ /** How many modules a module may load and still say something about what its
74
+ * importers depend on. Past it, a module composes a whole platform (a kernel,
75
+ * a test fixture over one): nearly every change reaches its importers, so that
76
+ * path does not make them relevant to the change. */ export declare const WIDE: 200;
77
+ /** The survey of `paths`, their modules' graph from `info` (`deno info`), or
78
+ * undefined when it cannot say what they import. Given a `store`, what each
79
+ * file among them and their modules held is kept there by the file's status
80
+ * (./kept.ts `byStatus`). */ export declare let survey: (paths: string[], info?: (roots: string[], bytes: Bytes) => Promise<Info | undefined>, store?: string) => Promise<Survey | undefined>;
81
+ /** What every file of a kind shares: `salt`, the runtime's version, what
82
+ * each of `also` holds, and the modules of the `runner` running them, each
83
+ * with what loads with it: the modules it imports only when it asks, for
84
+ * some other file's sake, are that file's to depend on. */ export declare let shared: (s: Survey, also: string[], salt?: string, runner?: string[]) => Promise<string>;
85
+ /** A file's key: `common` (what it shares with its kind), its name, and what
86
+ * it is and reaches. A root standing for another file, `name` (an example
87
+ * page's plan module stands for the page), is that file's: what the root
88
+ * imports, and the page, not the root itself. */ export declare let key: (s: Survey, common: string, root: string, runtime?: boolean) => Promise<string>;
89
+ /** The pass a file is kept by: its key, and what each path it read as it ran
90
+ * holds now. A run that could not see what it read keeps the key alone,
91
+ * which no proof of a run that could ever matches. */ export declare let proof: (s: Survey, key: string, reads?: string[], runtime?: boolean) => Promise<string>;
92
+ /** Where passes are kept, by proof, for every checkout on this machine: a
93
+ * proof a line, the newest last. */ export declare let STORE: string;
94
+ /** Where what each file read as it last passed is kept, beside them. */ export declare let READS: string;
95
+ declare let KEEP: number;
96
+ /** The passes kept. */ export declare let passed: () => Set<string>;
97
+ /** Adds passes made now to what the store holds. A run appends only its
98
+ * own, so runs adding at once keep each other's; a store grown past twice
99
+ * `keep` lines is cut to the newest `keep`. */ export declare let remember: (made: string[]) => void;
100
+ /** What each file read as it last passed, in any checkout. A proof holds
101
+ * the file's key, so reads kept from another version of it match only a
102
+ * pass of that version that read the same. */ export declare let recall: () => Record<string, string[]>;
103
+ /** The key each file had as it last passed, where its run knew it: the
104
+ * version of it its reads (`recall`) are what. */ export declare let versions: () => Record<string, string>;
105
+ /** Adds what each file read as it passed now, nothing included: a file kept
106
+ * as reading nothing is known to, where one with no entry is unknown. `keys`
107
+ * says which version of each file read it. */ export declare let note: (reads: Record<string, string[]>, keys?: Record<string, string>) => void;
108
+ /** Where what each file last took to load and run is kept, beside them. */ export declare let TOOK: string;
109
+ /** What each file last took to load and run here, in milliseconds. */ export declare let took: () => Record<string, number>;
110
+ /** Adds what files took now to what the store holds. */ export declare let tally: (times: Record<string, number>) => void;
111
+ /** Takes passes back out of what the store holds: those that a caller
112
+ * holding the run to more than passing (bin/test-budget.ts) does not grant. */ export declare let forget: (taken: string[]) => void;
113
+ //# sourceMappingURL=deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.d.ts","sources":["../deps.ts"],"names":[],"mappings":"AAEA,SAAS,KAAK,IAAI,qCAAmD;AAkCrE,cAAc,IAAI,GAAE;AAKpB;8BAC8B,GAC9B,YAAY;EACV,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,MAAM,MAAM,MAAM,KAAK,MAAM;EAC7B,MAAM,WAAW,MAAM,KAAK,MAAM;;AAKpC,OAAO,YAAI,WAAY,MAAK,MAAM,KAAkB,SA0BnD;AAGD;2DAC2D,GAC3D,OAAO,YAAI,QAAS,OAAO,MAA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E,GACpE,OAAO,YAAI,YAAuB,OAAO,MAAM,EAAE,MAAM,EAAgB;AAEvE,sDAAsD,GACtD,OAAO,YAAI,QAAS,OAAO,OAAO,MAAM,EAAE,MAAM,MAAkB,IAAI,CAErE;AAED;6EAC6E,GAC7E,OAAO,YAAI,SAAU,OAAO,MAAM,OAAoB,IAAI,CAIzD"}
@@ -0,0 +1,69 @@
1
+ /** One doctest: its first line, its kind, and its code, or its two sides. */ export type Doctest = {
2
+ line: number;
3
+ skip: boolean;
4
+ op?: '->' | '~>' | 'throws';
5
+ code: string;
6
+ };
7
+ /** One fenced example: the line its fence opens on, and its code. */ export type Fence = {
8
+ line: number;
9
+ skip: boolean;
10
+ lang: string;
11
+ code: string;
12
+ };
13
+ /** A fenced test's page and line for failures, and code digest for listings. */ export declare let fenceName: (page: string, fence: Fence) => Promise<string>;
14
+ /**
15
+ * The doctests in a module's source, a line indented past its first joined
16
+ * to it.
17
+ */ export declare let doctests: (source: string) => Doctest[];
18
+ /** A doctest's two sides: the first operator outside a string or bracket. */ export declare let split: (code: string) => {
19
+ actual: string;
20
+ op: Doctest['op'];
21
+ expected: string;
22
+ } | undefined;
23
+ /** Whether a page is a module, whose doc comments hold its examples. */ export declare let module: (path: string) => boolean;
24
+ /**
25
+ * The fenced examples in a page: every block in a Markdown page, and in a
26
+ * module every block inside a doc comment, its ` * ` margin taken off.
27
+ */ export declare let fences: (source: string, path?: string) => Fence[];
28
+ /** A page's runnable fences and doctest lines, parsed once for a command. */ export type Examples = {
29
+ fenced: Fence[];
30
+ lines: Doctest[];
31
+ };
32
+ export declare let scan: (source: string, page: string) => Examples;
33
+ /**
34
+ * A line of an example as a statement in a function body: what it exported
35
+ * it still declares, a default export is only evaluated, and a re-export is
36
+ * gone.
37
+ */ export declare let unexport: (line: string) => string;
38
+ /** An example's import statements, and the rest of its lines with blanks
39
+ * where the imports stood, so the lines keep their numbers. */ export declare let hoist: (code: string) => {
40
+ imports: string[];
41
+ rest: string[];
42
+ };
43
+ /** The names an import statement binds. */ export declare let bound: (statement: string) => string[];
44
+ /** What an example's imports name: its import statements, and each
45
+ * `import(…)` of a literal specifier. */ export declare let specifiers: (code: string) => string[];
46
+ /** The names a module exports that an example can use unimported. */ export declare let usable: (exports: string[], taken?: string[]) => string[];
47
+ /**
48
+ * The page, with the exports an example uses unimported imported by name, so
49
+ * each stays the live binding the page's own code assigns. The example's code
50
+ * is a function's body, so it may declare one of those names again.
51
+ */ export declare let imported: (names: string[], base: string) => string;
52
+ /**
53
+ * One fenced example as a module that declares it as a test named for its
54
+ * page, line and code digest. `exports` are the page's, for an example in a
55
+ * module.
56
+ */ export declare let compileFence: (name: string, page: string, fence: Fence, exports?: string[]) => string;
57
+ /**
58
+ * One fenced example as a module for a type checker, as `deno check --doc`
59
+ * reads it: its code at the top level, with the page's exports it neither
60
+ * imports nor declares imported, keeping the page's line numbers.
61
+ */ export declare let typed: (page: string, fence: Fence, exports?: string[]) => string;
62
+ /** The names code declares at its top level. */ export declare let declared: (code: string) => string[];
63
+ /** The names a module's source exports by declaration or by list, each
64
+ * once, for its examples to use unimported where they cannot load it. */ export declare let exported: (source: string) => string[];
65
+ /**
66
+ * A page's doctests as one module: its statements run in order, and each
67
+ * check declares a test named for its line and code.
68
+ */ export declare let compileDoctests: (page: string, tests: Doctest[], exports?: string[]) => string;
69
+ //# sourceMappingURL=examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"examples.d.ts","sources":["../examples.ts"],"names":[],"mappings":"AAeA,2EAA2E,GAC3E,YAAY;EACV,MAAM,MAAM;EACZ,MAAM,OAAO;EACb,KAAK,OAAO,OAAO;EACnB,MAAM,MAAM;;AAGd,mEAAmE,GACnE,YAAY;EAAU,MAAM,MAAM;EAAE,MAAM,OAAO;EAAE,MAAM,MAAM;EAAE,MAAM,MAAM;;AAE7E,8EAA8E,GAC9E,OAAO,YAAI,YAAmB,MAAM,MAAM,EAAE,OAAO,UAAQ,QAAQ,MAAM,EAUxE;AAOD;;;CA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,YAAI,WAAY,QAAQ,MAAM,KAAG,MAAM,GAU7C;AAID;;;CAGC,GACD,OAAO,YAAI,kBACT,MAAM,MAAM,EACZ,OAAO,WACP,UAAS,MAAM,OACd,MAAM,CAqCR"}
@@ -0,0 +1,23 @@
1
+ import { type Examples } from "./examples.js";
2
+ /** Whether a path is a test module. */ export declare let tested: (path: string) => boolean;
3
+ /** Whether a path could hold examples: a module or a Markdown page. */ export declare let paged: (path: string) => boolean;
4
+ /** The process that wrote a file beside a page while the page was keyed or
5
+ * its examples loaded (./load.ts `beside`), by the file's name; none for any
6
+ * other file. */ export declare let written: (name: string) => number | undefined;
7
+ /** Every file under the paths, sorted, each once. */ export declare let walk: (paths: string[]) => Promise<string[]>;
8
+ /** Whether a page's source holds an example that runs. */ export declare let examples: (path: string, source: string) => boolean;
9
+ export type Found = {
10
+ tests: string[];
11
+ pages: string[];
12
+ parsed?: ReadonlyMap<string, Examples>;
13
+ };
14
+ /** Where what each page of a checkout held, as last scanned, is kept by its
15
+ * status (`discover`). */ export declare let PAGES: string;
16
+ /** Test modules, example pages and their parsed inputs for one command.
17
+ * Given a `store`, what each page holds is kept there by the page's status
18
+ * (./kept.ts `byStatus`), and a page unchanged since is not read again. */ export declare let discover: (paths: string[], store?: string) => Promise<Found>;
19
+ /** The test modules and the example pages under the paths. */ export declare let find: (paths: string[]) => Promise<{
20
+ tests: string[];
21
+ pages: string[];
22
+ }>;
23
+ //# sourceMappingURL=find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.d.ts","sources":["../find.ts"],"names":[],"mappings":"AAKA,SAAS,KAAK,QAAQ,wBAAqC;AAO3D,qCAAqC,GACrC,OAAO,YAAI,SAAU,MAAM,MAAM,KAAG,OAAO,CAAqC;AAMhF,qEAAqE,GACrE,OAAO,YAAI,QAAS,MAAM,MAAM,KAAG,OAAO,CACe;AAKzD;;eAEe,GACf,OAAO,YAAI,UAAW,MAAM,MAAM,KAAG,MAAM,GAAG,SAAS,CAGtD;AAED,mDAAmD,GACnD,OAAO,YAAI,OAAQ,OAAO,MAAM,OAAK,QAAQ,MAAM,IAkB/C;AAEJ,wDAAwD,GACxD,OAAO,YAAI,WAAY,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAG5D;AAED,YAAY;EACV,OAAO,MAAM;EACb,OAAO,MAAM;EACb,SAAS,YAAY,MAAM,EAAE;;AAG/B;wBACwB,GACxB,OAAO,YAAI,OAAO,MAAM,CAA2B;AAEnD;;yEAEyE,GACzE,OAAO,YAAI,WACT,OAAO,MAAM,IACb,QAAQ,MAAM,KACb,QAAQ,OAgBV;AAED,4DAA4D,GAC5D,OAAO,YAAI,OACT,OAAO,MAAM,OACZ;EAAU,OAAO,MAAM;EAAI,OAAO,MAAM;GAG1C"}
@@ -0,0 +1,27 @@
1
+ import * as io from "@yaks/file/io";
2
+ /** The machine's cache, where every store lies. */ export declare let cache: string;
3
+ /** Where a checkout's own stores lie, by its path. Checkouts differ: one
4
+ * store they all shared would hold whichever checkout wrote it last, and each
5
+ * run would ask deno again of every module another checkout had changed. */ export declare let stores: (cwd?: string) => string;
6
+ /** A store every checkout on the machine starts from, one of `name`'s by
7
+ * `key`: checkouts whose `key` differs (another revision's configuration)
8
+ * each keep their own, rather than one replacing what the other wrote. One
9
+ * no run has written for two days goes as the next is asked for. */ export declare let seed: (name: string, key: string) => string;
10
+ /** What a JSON store holds; nothing, when there is none. */ export declare let load: <T>(store: string) => Record<string, T>;
11
+ /** Adds `text` to the end of a store. Writes from runs at once each land
12
+ * whole. */ export declare let append: (text: string, store: string) => void;
13
+ /** A store written whole, through a rename, so a reader never reads half; a
14
+ * `copy` holding the same is the same file, linked. */ export declare let put: (text: string, store: string, copy?: string) => void;
15
+ /** A JSON store written whole. */ export declare let write: (all: unknown, store: string) => void;
16
+ /**
17
+ * What files held, by `read`, kept in `store` beside each file's status: a
18
+ * file whose status still matches is not read again. A file changed within
19
+ * the second before it was read could change again within its times' grain,
20
+ * so it is not kept. `save` writes the store when what it holds changed: a
21
+ * file read anew, or one it held and no longer does. A file not asked of
22
+ * stays held when it lies `beyond` what the caller looked at.
23
+ */ export declare let byStatus: <T>(store?: string) => {
24
+ of: (path: string, s: io.FileInfo, read: () => T) => T;
25
+ save: (beyond?: (path: string) => boolean) => void;
26
+ };
27
+ //# sourceMappingURL=kept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kept.d.ts","sources":["../kept.ts"],"names":[],"mappings":"AAAA,YAAY,6BAAkC;AAM9C,iDAAiD,GACjD,OAAO,YAAI,OAAO,MAAM,CACY;AAEpC;;0EAE0E,GAC1E,OAAO,YAAI,SAAU,MAAK,MAAM,KAAkB,MAAM,CAGpD;AAEJ;;;kEAGkE,GAClE,OAAO,YAAI,OAAQ,MAAM,MAAM,EAAE,KAAK,MAAM,KAAG,MAAM,CAepD;AA8BD,0DAA0D,GAC1D,OAAO,YAAI,OAAQ,GAAG,OAAO,MAAM,KAAG,OAAO,MAAM,EAAE,GAMpD;AAED;UACU,GACV,OAAO,YAAI,SAAU,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAGtD;AAED;qDACqD,GACrD,OAAO,YAAI,MAAO,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAWlE;AAED,gCAAgC,GAChC,OAAO,YAAI,QAAS,KAAK,OAAO,EAAE,OAAO,MAAM,KAAG,IAAI,CACrB;AAKjC;;;;;;;CAOC,GACD,OAAO,YAAI,WAAY,GAAG,QAAQ,MAAM;EACtC,KAAK,MAAM,MAAM,EAAE,GAAG,GAAG,UAAU,YAAY,MAAM;EACrD,OAAO,UAAU,MAAM,MAAM,KAAK,OAAO,KAAK,IAAI;EA8BnD"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Lend `globalThis[name]` the value `value`, over whatever is there, read-only
3
+ * or not; the call it returns puts back what was there, or removes the name
4
+ * where nothing was.
5
+ *
6
+ * ```ts
7
+ * import { equal, lend } from '@yaks/testing'
8
+ *
9
+ * let back = lend('lent', 1)
10
+ * equal((globalThis as { lent?: number }).lent, 1)
11
+ * back()
12
+ * equal('lent' in globalThis, false)
13
+ * ```
14
+ */ export declare let lend: (name: string, value: unknown) => () => void;
15
+ //# sourceMappingURL=lend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lend.d.ts","sources":["../lend.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;CAaC,GACD,OAAO,YAAI,OAAQ,MAAM,MAAM,EAAE,OAAO,OAAO,WAAS,IAAI,CAW3D"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env -S deno run -A
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sources":["../main.ts"],"names":[],"mappings":"AAAA"}
package/_dist/mod.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @yaks/testing — declare tests, check what they expect, and wait on facts.
3
+ *
4
+ * A test module declares its tests with `test` (or a `suite` of clauses),
5
+ * each with tags a run can pick it by, and says what it expects with
6
+ * `equal`, `ok`, `match` and `throws`:
7
+ *
8
+ * ```ts ignore
9
+ * import { equal, suite, test } from '@yaks/testing'
10
+ *
11
+ * test('two and two', () => equal(2 + 2, 4))
12
+ * suite('sum', ({ it, equal }) => {
13
+ * it('of nothing is zero', () => equal([].length, 0))
14
+ * }, { tags: ['math'] })
15
+ * ```
16
+ *
17
+ * `tick` yields one macrotask and `until` polls a fact, so a test waits on
18
+ * what it expects instead of sleeping a guessed span:
19
+ *
20
+ * ```ts
21
+ * import { until } from '@yaks/testing'
22
+ *
23
+ * let ready = false
24
+ * setTimeout(() => ready = true)
25
+ * await until(() => ready, { label: 'ready' })
26
+ * ```
27
+ *
28
+ * `lend` sets a global, such as `document`, until it is put back, over one
29
+ * another module installed read-only.
30
+ *
31
+ * `typist` keeps a text field's caret as a browser does, on a DOM that keeps
32
+ * none, and types at it as a person does.
33
+ *
34
+ * The runner, `@yaks/testing/main`, loads test modules and the examples
35
+ * beside the code into one runtime and runs them.
36
+ *
37
+ * @module
38
+ */ export { equal, match, ok, throws } from "./assert.js";
39
+ export { type Clock, clock } from "./clock.js";
40
+ export { afterAll, cleanup, type It, kept, type Options, type Spec, suite, type Test, test } from "./suite.js";
41
+ export { lend } from "./lend.js";
42
+ export { type Looks, own, waits } from "./own.js";
43
+ export { type Typist, typist } from "./typist.js";
44
+ export { tick, until, type Wait } from "./wait.js";
45
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCC,GACD,SAAS,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,sBAAqB;AACtD,SAAS,KAAK,KAAK,EAAE,KAAK,qBAAoB;AAC9C,SACE,QAAQ,EACR,OAAO,EACP,KAAK,EAAE,EACP,IAAI,EACJ,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,EACL,KAAK,IAAI,EACT,IAAI,qBACa;AACnB,SAAS,IAAI,oBAAmB;AAChC,SAAS,KAAK,KAAK,EAAE,GAAG,EAAE,KAAK,mBAAkB;AACjD,SAAS,KAAK,MAAM,EAAE,MAAM,sBAAqB;AACjD,SAAS,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,oBAAmB"}
@@ -0,0 +1,31 @@
1
+ import type { Info } from "@yaks/process/modules";
2
+ /** The top-level declaration each line of formatted source belongs to, by
3
+ * the nearest line above it at no indentation that opens one; none for an
4
+ * import or other top-level code. */ export declare let declared: (text: string) => (string | undefined)[];
5
+ /** What a module imports or re-exports from one specifier: each name by the
6
+ * name it has there and the one it is given here, every name (`*`), or the
7
+ * whole module under one name (`as`). */ export type Imported = {
8
+ from: string;
9
+ names: [string, string][];
10
+ all?: boolean;
11
+ as?: string;
12
+ exported?: boolean;
13
+ };
14
+ /** The values a module imports and re-exports by a specifier, but types,
15
+ * and those it loads with `await import`, as a test that must set its stage
16
+ * first does. */ export declare let imported: (text: string) => Imported[];
17
+ /** How many public declarations can relay an edited name. Re-exports and
18
+ * references inside private declarations keep the same distance. */ export declare const STEPS: 2;
19
+ /**
20
+ * Of `files`, how near each is to what a change `edited` (each module's
21
+ * declarations, by checkout path, `*` for its top-level code): 0 for a file
22
+ * importing an edited declaration by name, directly or from a module
23
+ * re-exporting it, or reading it off the whole module (`m.fields`), and for
24
+ * one directly importing a module whose top-level code is edited. A public
25
+ * declaration that uses edited code adds a step, even inside the same
26
+ * module, as does a re-export of a module with edited top-level code; and so on
27
+ * to `steps`. A file naming none is left out. Each file is read for the root it stands for
28
+ * (`root`, an example page's plan module), and modules as `info` resolved
29
+ * them.
30
+ */ export declare let naming: (info: Info, files: string[], edited: Record<string, string[]>, read: (path: string) => string | undefined, root?: (file: string) => string, steps?: number) => Map<string, number>;
31
+ //# sourceMappingURL=names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.d.ts","sources":["../names.ts"],"names":[],"mappings":"AAOA,cAAc,IAAI,qCAA0C;AAY5D;;mCAEmC,GACnC,OAAO,YAAI,WAAY,MAAM,MAAM,MAAI,MAAM,GAAG,SAAS,IAMxD;AAED;;uCAEuC,GACvC,YAAY;EACV,MAAM,MAAM;EACZ,QAAQ,MAAM,EAAE,MAAM;EACtB,MAAM,OAAO;EACb,KAAK,MAAM;EACX,WAAW,OAAO;;AAkBpB;;eAEe,GACf,OAAO,YAAI,WAAY,MAAM,MAAM,KAAG,WAsBrC;AAED;kEACkE,GAClE,OAAO,cAAM,OAAQ,EAAC;AAEtB;;;;;;;;;;;CAWC,GACD,OAAO,YAAI,SACT,MAAM,MACN,OAAO,MAAM,IACb,QAAQ,OAAO,MAAM,EAAE,MAAM,KAC7B,OAAO,MAAM,MAAM,KAAK,MAAM,GAAG,SAAS,EAC1C,QAAO,MAAM,MAAM,KAAK,MAAM,EAC9B,QAAO,MAAM,KACZ,IAAI,MAAM,EAAE,MAAM,EAiGpB"}
package/_dist/own.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ /** What each thread of `pid` and of every process it started has waited for
2
+ * a CPU so far, in ms, by the thread's path under /proc. Empty where the
3
+ * platform does not say. */ export declare let waits: (pid: number) => Map<string, number>;
4
+ /** What the main thread of every process `pid` started has waited for a CPU
5
+ * so far, in ms, by its path under /proc: the processes `pid`'s main thread
6
+ * started, as Deno starts every child there, and the ones theirs did. A
7
+ * process's other threads are left out, so a look costs two reads a process,
8
+ * and one with no child costs one. */ export declare let started: (pid?: number) => Map<string, number>;
9
+ /** How {@link own} looks: how often, at what, and by which clock. */ export type Looks = {
10
+ /** ms before the first look and between looks; a reading in between keeps
11
+ * the wall clock's pace */ every?: number;
12
+ /** what each thread has waited for a CPU so far, in ms */ look?: (pid: number) => Map<string, number>;
13
+ /** the wall clock, in ms */ time?: () => number;
14
+ };
15
+ /** Looks at what threads have waited for a CPU so far (`look`, as `waits`
16
+ * says it), and says, in ms, how long the box has held them since the first
17
+ * look: between two looks, at least as long as their most-held thread waited,
18
+ * a thread new since the last look having waited all its wait since. */ export declare let held: (look: () => Map<string, number>) => () => number;
19
+ /** A clock of `pid`'s own time, in ms since the clock was made: the wall
20
+ * clock's pace, less what the box kept the process, or any process it
21
+ * started, waiting for a CPU (`held`). The first look is `every` ms in and the
22
+ * span before it counts whole, so a clock read only sooner never looks. Where
23
+ * the platform does not say, it is the wall clock (the README has an
24
+ * example). */ export declare let own: (pid?: number, _dts_1: never) => () => number;
25
+ //# sourceMappingURL=own.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"own.d.ts","sources":["../own.ts"],"names":[],"mappings":"AAWA;;0BAE0B,GAC1B,OAAO,YAAI,QAAS,KAAK,MAAM,KAAG,IAAI,MAAM,EAAE,MAAM,EAcnD;AAED;;;;oCAIoC,GACpC,OAAO,YAAI,UAAW,MAAK,MAAM,KAAgB,IAAI,MAAM,EAAE,MAAM,EAYlE;AAiCD,mEAAmE,GACnE,YAAY;EACV;2BACyB,GACzB,QAAQ,MAAM;EACd,wDAAwD,GACxD,QAAQ,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,MAAM;EAC1C,0BAA0B,GAC1B,aAAa,MAAM;;AAGrB;;;sEAGsE,GACtE,OAAO,YAAI,OAAQ,YAAY,IAAI,MAAM,EAAE,MAAM,YAAU,MAAM,CAYhE;AAED;;;;;aAKa,GACb,OAAO,YAAI,MACT,MAAK,MAAM,EACX,wBACO,MAAM,CAiBd"}
@@ -0,0 +1,8 @@
1
+ /** A path a check names, from `root`; none outside it, or the runner's. */ export declare let path: (value: string, root: string) => string | undefined;
2
+ /** Observe only reads, retaining one path per file. Restore the runtime's doors
3
+ * after the run; wrappers preserve arguments, receiver, result and exceptions. */ export declare let observe: (root?: string) => {
4
+ mark: (name: string) => void;
5
+ reads: () => Map<string, string[]>;
6
+ close: () => void;
7
+ };
8
+ //# sourceMappingURL=reads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reads.d.ts","sources":["../reads.ts"],"names":[],"mappings":"AAeA,yEAAyE,GACzE,OAAO,YAAI,OAAQ,OAAO,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,SAAS,CAUlE;AAED;gFACgF,GAChF,OAAO,YAAI,UAAW,OAAM,MAAM;EAChC,OAAO,MAAM,MAAM,KAAK,IAAI;EAC5B,aAAa,IAAI,MAAM,EAAE,MAAM;EAC/B,aAAa,IAAI;EAgElB"}
@@ -0,0 +1,82 @@
1
+ import * as assertions from "./assert.js";
2
+ /** A test's tags, which a run is filtered by, and whether it is skipped. */ export type Options = {
3
+ tags?: string[];
4
+ skip?: boolean;
5
+ };
6
+ /** One declared test. `file` is the module the runner was loading. */ export type Test = {
7
+ name: string;
8
+ body: () => unknown;
9
+ tags: string[];
10
+ skip: boolean;
11
+ file: string;
12
+ };
13
+ /**
14
+ * Declares a test: a name, a body that throws or rejects to fail, and the
15
+ * tags a run can pick it by.
16
+ *
17
+ * ```ts ignore
18
+ * test('two and two', () => equal(2 + 2, 4))
19
+ * test('the whole shop', async () => ok(await shop()), { tags: ['kernel'] })
20
+ * ```
21
+ */ export declare let test: (name: string, body: () => unknown, _dts_1: never) => void;
22
+ /**
23
+ * Asks for `done` once the running test ends, before its time is taken, so
24
+ * a test pays for closing what it opened and leaves nothing running into
25
+ * the next one. Outside a test, it is the file's (`afterAll`). Outside the
26
+ * runner and any test it does nothing, and answers false.
27
+ *
28
+ * ```ts ignore
29
+ * let fixture = () => {
30
+ * let db = open()
31
+ * cleanup(() => db.close())
32
+ * return db
33
+ * }
34
+ * ```
35
+ */ export declare let cleanup: (done: () => unknown) => boolean;
36
+ /**
37
+ * Asks for `done` once the file the runner loaded last has run its tests,
38
+ * whichever of them asks. A runtime keeps every module it loads, and what a
39
+ * module holds: a kernel a file opened for its tests would otherwise run on,
40
+ * holding every store it made, beside every file the runtime loads after.
41
+ * Outside the runner it does nothing, and answers false.
42
+ *
43
+ * ```ts ignore
44
+ * let shared: Promise<Kernel> | undefined
45
+ * let kernel = () => {
46
+ * if (!shared) afterAll(async () => (await shared)?.close())
47
+ * return shared ??= boot()
48
+ * }
49
+ * ```
50
+ */ export declare let afterAll: (done: () => unknown) => boolean;
51
+ /**
52
+ * Asks for `done` once the runtime needs back the memory a fixture holds
53
+ * (./main.ts `full`), rather than once the file that made it ends: a fixture
54
+ * that costs more to make than to keep (a kernel, say) serves every file
55
+ * after it until then. Outside the runner it does nothing, and answers false.
56
+ *
57
+ * ```ts ignore
58
+ * let shared: Promise<Kernel> | undefined
59
+ * let kernel = () => {
60
+ * if (!shared) kept(async () => (await shared)?.close())
61
+ * return shared ??= boot()
62
+ * }
63
+ * ```
64
+ */ export declare let kept: (done: () => unknown) => boolean;
65
+ /** Declares one clause of a suite; `it.skip` declares it skipped. */ export type It = ((name: string, body: () => unknown, options?: Options) => void) & {
66
+ skip: (name: string, body: () => unknown) => void;
67
+ };
68
+ /** What a suite's body declares with: `it`, and the assertions. */ export type Spec = typeof assertions & {
69
+ it: It;
70
+ };
71
+ /**
72
+ * Declares a group of tests under one name, each clause named after it and
73
+ * carrying its tags. A body that throws declares a failing test instead.
74
+ *
75
+ * ```ts ignore
76
+ * suite('sum', ({ it, equal }) => {
77
+ * it('adds', () => equal(sum([1, 2]), 3))
78
+ * it('of nothing is zero', () => equal(sum([]), 0))
79
+ * })
80
+ * ```
81
+ */ export declare let suite: (name: string, body: (spec: Spec) => void, options?: Options) => void;
82
+ //# sourceMappingURL=suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.d.ts","sources":["../suite.ts"],"names":[],"mappings":"AAIA,YAAY,8BAA6B;AAEzC,0EAA0E,GAC1E,YAAY;EAAY,OAAO,MAAM;EAAI,OAAO,OAAO;;AAEvD,oEAAoE,GACpE,YAAY;EACV,MAAM,MAAM;EACZ,YAAY,OAAO;EACnB,MAAM,MAAM;EACZ,MAAM,OAAO;EACb,MAAM,MAAM;;AAoBd;;;;;;;;CAQC,GACD,OAAO,YAAI,OACT,MAAM,MAAM,EACZ,YAAY,OAAO,EACnB,kBACC,IAAI,CAWN;AAQD;;;;;;;;;;;;;CAaC,GACD,OAAO,YAAI,UAAW,YAAY,OAAO,KAAG,OAAO,CAIlD;AAED;;;;;;;;;;;;;;CAcC,GACD,OAAO,YAAI,WAAY,YAAY,OAAO,KAAG,OAAO,CAGnD;AAOD;;;;;;;;;;;;;CAaC,GACD,OAAO,YAAI,OAAQ,YAAY,OAAO,KAAG,OAAO,CAK/C;AAqDD,mEAAmE,GACnE,YAAY,OACN,MAAM,MAAM,EAAE,YAAY,OAAO,EAAE,UAAU,YAAY,IAAI;EAC7D,OAAO,MAAM,MAAM,EAAE,YAAY,OAAO,KAAK,IAAI;;AAEvD,iEAAiE,GACjE,YAAY,cAAc;EAAe,IAAI;;AAE7C;;;;;;;;;;CAUC,GACD,OAAO,YAAI,QACT,MAAM,MAAM,EACZ,OAAO,MAAM,SAAS,IAAI,EAC1B,UAAS,YACR,IAAI,CAgBN"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A text field kept the way a browser keeps one, on a DOM that keeps none
3
+ * (linkedom): a value a script puts in moves the caret to the end, and a
4
+ * person's typing goes in at the caret, replacing what is selected, and fires
5
+ * `input`. A bug that moves the caret shows here as it does in a browser.
6
+ *
7
+ * ```ts ignore
8
+ * let t = typist(textarea)
9
+ * t.at(4)
10
+ * t.type(' me')
11
+ * equal([textarea.value, textarea.selectionStart], ['Find me the recipe', 7])
12
+ * ```
13
+ *
14
+ * @module
15
+ */ type Typed = HTMLInputElement | HTMLTextAreaElement;
16
+ /** A person at a field. */ export type Typist = {
17
+ /** put the caret at `a`, or select from `a` to `b` */ at: (a: number, b?: number) => void;
18
+ /** type `typed` at the caret, a character at a time */ type: (typed: string) => void;
19
+ /** type `typed` at once as an input method composes it */ compose: (typed: string) => void;
20
+ /** end the composition */ end: () => void;
21
+ };
22
+ /** A person at `el`: `at` puts the caret (or selects to `to`), `type` types
23
+ * at it, and `compose` types as an input method does, `end` closing it. */ export declare let typist: (el: Typed) => Typist;
24
+ //# sourceMappingURL=typist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typist.d.ts","sources":["../typist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,QAEI,QAAQ,mBAAmB;AAEhC,yBAAyB,GACzB,YAAY;EACV,oDAAoD,GACpD,KAAK,GAAG,MAAM,EAAE,IAAI,MAAM,KAAK,IAAI;EACnC,qDAAqD,GACrD,OAAO,OAAO,MAAM,KAAK,IAAI;EAC7B,wDAAwD,GACxD,UAAU,OAAO,MAAM,KAAK,IAAI;EAChC,wBAAwB,GACxB,WAAW,IAAI;;AAGjB;yEACyE,GACzE,OAAO,YAAI,SAAU,IAAI,UAAQ,OA8ChC"}
@@ -0,0 +1,21 @@
1
+ import type { Clock } from "./clock.js";
2
+ /** One macrotask yield: queued timers and microtasks flush, no span passes. */ export declare let tick: () => Promise<void>;
3
+ /** How long `until` waits, how often it looks, what it names on a timeout
4
+ * (a string, or a thunk resolved late so it can name live state), and the
5
+ * clock it keeps both by: the test's own time and the runtime's timers,
6
+ * unless a test hands it one (`clock()`). */ export type Wait = {
7
+ timeout?: number;
8
+ poll?: number;
9
+ label?: string | (() => string);
10
+ clock?: Pick<Clock, 'now' | 'after'>;
11
+ };
12
+ /**
13
+ * Wait for a fact to become true, polling instead of guessing a duration. The
14
+ * timeout only exists to fail instead of hanging; the fact's value comes back.
15
+ *
16
+ * ```ts
17
+ * let n = 0
18
+ * await until(() => ++n == 3) // true
19
+ * ```
20
+ */ export declare let until: <T>(fact: () => T | Promise<T>, _dts_1: never) => Promise<NonNullable<T>>;
21
+ //# sourceMappingURL=wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.d.ts","sources":["../wait.ts"],"names":[],"mappings":"AAMA,cAAc,KAAK,qBAAoB;AAGvC,6EAA6E,GAC7E,OAAO,YAAI,YAAW,QAAQ,IAAI,EAA2C;AAE7E;;;2CAG2C,GAC3C,YAAY;EACV,UAAU,MAAM;EAChB,OAAO,MAAM;EACb,QAAQ,MAAM,UAAU,MAAM;EAC9B,QAAQ,KAAK,OAAO,QAAQ;;AAa9B;;;;;;;;CAQC,GACD,OAAO,YAAI,QAAe,GACxB,YAAY,IAAI,QAAQ,IACxB,kBACC,QAAQ,YAAY,IActB"}