@flyingrobots/bijou 0.10.0 → 1.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/dist/adapters/test/assertions.d.ts +51 -0
- package/dist/adapters/test/assertions.d.ts.map +1 -0
- package/dist/adapters/test/assertions.js +67 -0
- package/dist/adapters/test/assertions.js.map +1 -0
- package/dist/adapters/test/audit-style.d.ts +28 -7
- package/dist/adapters/test/audit-style.d.ts.map +1 -1
- package/dist/adapters/test/audit-style.js +61 -4
- package/dist/adapters/test/audit-style.js.map +1 -1
- package/dist/adapters/test/index.d.ts +36 -1
- package/dist/adapters/test/index.d.ts.map +1 -1
- package/dist/adapters/test/index.js +12 -1
- package/dist/adapters/test/index.js.map +1 -1
- package/dist/adapters/test/io.d.ts +27 -0
- package/dist/adapters/test/io.d.ts.map +1 -1
- package/dist/adapters/test/io.js +56 -0
- package/dist/adapters/test/io.js.map +1 -1
- package/dist/adapters/test/runtime.d.ts +17 -0
- package/dist/adapters/test/runtime.d.ts.map +1 -1
- package/dist/adapters/test/runtime.js +14 -0
- package/dist/adapters/test/runtime.js.map +1 -1
- package/dist/adapters/test/style.d.ts +9 -0
- package/dist/adapters/test/style.d.ts.map +1 -1
- package/dist/adapters/test/style.js +54 -0
- package/dist/adapters/test/style.js.map +1 -1
- package/dist/context.d.ts +21 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +21 -0
- package/dist/context.js.map +1 -1
- package/dist/core/bg-fill.d.ts +32 -0
- package/dist/core/bg-fill.d.ts.map +1 -0
- package/dist/core/bg-fill.js +42 -0
- package/dist/core/bg-fill.js.map +1 -0
- package/dist/core/components/accordion.d.ts +20 -0
- package/dist/core/components/accordion.d.ts.map +1 -1
- package/dist/core/components/accordion.js +13 -6
- package/dist/core/components/accordion.js.map +1 -1
- package/dist/core/components/alert.d.ts +16 -0
- package/dist/core/components/alert.d.ts.map +1 -1
- package/dist/core/components/alert.js +17 -6
- package/dist/core/components/alert.js.map +1 -1
- package/dist/core/components/badge.d.ts +18 -0
- package/dist/core/components/badge.d.ts.map +1 -1
- package/dist/core/components/badge.js +15 -11
- package/dist/core/components/badge.js.map +1 -1
- package/dist/core/components/box.d.ts +31 -0
- package/dist/core/components/box.d.ts.map +1 -1
- package/dist/core/components/box.js +45 -10
- package/dist/core/components/box.js.map +1 -1
- package/dist/core/components/breadcrumb.d.ts +15 -0
- package/dist/core/components/breadcrumb.d.ts.map +1 -1
- package/dist/core/components/breadcrumb.js +13 -6
- package/dist/core/components/breadcrumb.js.map +1 -1
- package/dist/core/components/dag-source.d.ts +52 -9
- package/dist/core/components/dag-source.d.ts.map +1 -1
- package/dist/core/components/dag-source.js +53 -9
- package/dist/core/components/dag-source.js.map +1 -1
- package/dist/core/components/dag-stats.d.ts +2 -0
- package/dist/core/components/dag-stats.d.ts.map +1 -1
- package/dist/core/components/dag-stats.js.map +1 -1
- package/dist/core/components/dag.d.ts +88 -1
- package/dist/core/components/dag.d.ts.map +1 -1
- package/dist/core/components/dag.js +127 -6
- package/dist/core/components/dag.js.map +1 -1
- package/dist/core/components/enumerated-list.d.ts +30 -0
- package/dist/core/components/enumerated-list.d.ts.map +1 -1
- package/dist/core/components/enumerated-list.js +50 -11
- package/dist/core/components/enumerated-list.js.map +1 -1
- package/dist/core/components/hyperlink.d.ts +16 -0
- package/dist/core/components/hyperlink.d.ts.map +1 -1
- package/dist/core/components/hyperlink.js +22 -11
- package/dist/core/components/hyperlink.js.map +1 -1
- package/dist/core/components/index.d.ts +7 -0
- package/dist/core/components/index.d.ts.map +1 -1
- package/dist/core/components/index.js +7 -0
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/kbd.d.ts +14 -0
- package/dist/core/components/kbd.d.ts.map +1 -1
- package/dist/core/components/kbd.js +13 -6
- package/dist/core/components/kbd.js.map +1 -1
- package/dist/core/components/log.d.ts +20 -0
- package/dist/core/components/log.d.ts.map +1 -1
- package/dist/core/components/log.js +24 -11
- package/dist/core/components/log.js.map +1 -1
- package/dist/core/components/logo.d.ts +32 -0
- package/dist/core/components/logo.d.ts.map +1 -1
- package/dist/core/components/logo.js +38 -0
- package/dist/core/components/logo.js.map +1 -1
- package/dist/core/components/markdown.d.ts +7 -1
- package/dist/core/components/markdown.d.ts.map +1 -1
- package/dist/core/components/markdown.js +76 -0
- package/dist/core/components/markdown.js.map +1 -1
- package/dist/core/components/paginator.d.ts +16 -0
- package/dist/core/components/paginator.d.ts.map +1 -1
- package/dist/core/components/paginator.js +12 -6
- package/dist/core/components/paginator.js.map +1 -1
- package/dist/core/components/progress.d.ts +55 -0
- package/dist/core/components/progress.d.ts.map +1 -1
- package/dist/core/components/progress.js +37 -6
- package/dist/core/components/progress.js.map +1 -1
- package/dist/core/components/separator.d.ts +16 -0
- package/dist/core/components/separator.d.ts.map +1 -1
- package/dist/core/components/separator.js +12 -6
- package/dist/core/components/separator.js.map +1 -1
- package/dist/core/components/skeleton.d.ts +15 -0
- package/dist/core/components/skeleton.d.ts.map +1 -1
- package/dist/core/components/skeleton.js +12 -6
- package/dist/core/components/skeleton.js.map +1 -1
- package/dist/core/components/spinner.d.ts +37 -0
- package/dist/core/components/spinner.d.ts.map +1 -1
- package/dist/core/components/spinner.js +26 -6
- package/dist/core/components/spinner.js.map +1 -1
- package/dist/core/components/stepper.d.ts +20 -0
- package/dist/core/components/stepper.d.ts.map +1 -1
- package/dist/core/components/stepper.js +16 -6
- package/dist/core/components/stepper.js.map +1 -1
- package/dist/core/components/table.d.ts +20 -0
- package/dist/core/components/table.d.ts.map +1 -1
- package/dist/core/components/table.js +31 -6
- package/dist/core/components/table.js.map +1 -1
- package/dist/core/components/tabs.d.ts +19 -0
- package/dist/core/components/tabs.d.ts.map +1 -1
- package/dist/core/components/tabs.js +19 -6
- package/dist/core/components/tabs.js.map +1 -1
- package/dist/core/components/timeline.d.ts +19 -0
- package/dist/core/components/timeline.d.ts.map +1 -1
- package/dist/core/components/timeline.js +20 -6
- package/dist/core/components/timeline.js.map +1 -1
- package/dist/core/components/tree.d.ts +19 -0
- package/dist/core/components/tree.d.ts.map +1 -1
- package/dist/core/components/tree.js +49 -11
- package/dist/core/components/tree.js.map +1 -1
- package/dist/core/detect/index.d.ts +8 -2
- package/dist/core/detect/index.d.ts.map +1 -1
- package/dist/core/detect/index.js +7 -1
- package/dist/core/detect/index.js.map +1 -1
- package/dist/core/detect/tty.d.ts +36 -0
- package/dist/core/detect/tty.d.ts.map +1 -1
- package/dist/core/detect/tty.js +34 -0
- package/dist/core/detect/tty.js.map +1 -1
- package/dist/core/forms/confirm.d.ts +14 -0
- package/dist/core/forms/confirm.d.ts.map +1 -1
- package/dist/core/forms/confirm.js +15 -5
- package/dist/core/forms/confirm.js.map +1 -1
- package/dist/core/forms/filter.d.ts +30 -0
- package/dist/core/forms/filter.d.ts.map +1 -1
- package/dist/core/forms/filter.js +67 -49
- package/dist/core/forms/filter.js.map +1 -1
- package/dist/core/forms/form-utils.d.ts +103 -0
- package/dist/core/forms/form-utils.d.ts.map +1 -0
- package/dist/core/forms/form-utils.js +135 -0
- package/dist/core/forms/form-utils.js.map +1 -0
- package/dist/core/forms/group.d.ts +12 -0
- package/dist/core/forms/group.d.ts.map +1 -1
- package/dist/core/forms/group.js +7 -0
- package/dist/core/forms/group.js.map +1 -1
- package/dist/core/forms/index.d.ts +6 -0
- package/dist/core/forms/index.d.ts.map +1 -1
- package/dist/core/forms/index.js +6 -0
- package/dist/core/forms/index.js.map +1 -1
- package/dist/core/forms/input.d.ts +17 -0
- package/dist/core/forms/input.d.ts.map +1 -1
- package/dist/core/forms/input.js +27 -15
- package/dist/core/forms/input.js.map +1 -1
- package/dist/core/forms/multiselect.d.ts +16 -0
- package/dist/core/forms/multiselect.d.ts.map +1 -1
- package/dist/core/forms/multiselect.js +54 -38
- package/dist/core/forms/multiselect.js.map +1 -1
- package/dist/core/forms/select.d.ts +17 -0
- package/dist/core/forms/select.d.ts.map +1 -1
- package/dist/core/forms/select.js +51 -37
- package/dist/core/forms/select.js.map +1 -1
- package/dist/core/forms/textarea.d.ts +19 -0
- package/dist/core/forms/textarea.d.ts.map +1 -1
- package/dist/core/forms/textarea.js +51 -47
- package/dist/core/forms/textarea.js.map +1 -1
- package/dist/core/forms/types.d.ts +41 -2
- package/dist/core/forms/types.d.ts.map +1 -1
- package/dist/core/forms/wizard.d.ts +19 -0
- package/dist/core/forms/wizard.d.ts.map +1 -1
- package/dist/core/forms/wizard.js +4 -0
- package/dist/core/forms/wizard.js.map +1 -1
- package/dist/core/resolve-ctx.d.ts +30 -0
- package/dist/core/resolve-ctx.d.ts.map +1 -0
- package/dist/core/resolve-ctx.js +43 -0
- package/dist/core/resolve-ctx.js.map +1 -0
- package/dist/core/text/clip.d.ts +6 -1
- package/dist/core/text/clip.d.ts.map +1 -1
- package/dist/core/text/clip.js +12 -3
- package/dist/core/text/clip.js.map +1 -1
- package/dist/core/text/grapheme.d.ts +15 -3
- package/dist/core/text/grapheme.d.ts.map +1 -1
- package/dist/core/text/grapheme.js +21 -3
- package/dist/core/text/grapheme.js.map +1 -1
- package/dist/core/text/index.d.ts +7 -0
- package/dist/core/text/index.d.ts.map +1 -1
- package/dist/core/text/index.js +7 -0
- package/dist/core/text/index.js.map +1 -1
- package/dist/core/theme/color.d.ts +47 -8
- package/dist/core/theme/color.d.ts.map +1 -1
- package/dist/core/theme/color.js +77 -8
- package/dist/core/theme/color.js.map +1 -1
- package/dist/core/theme/downsample.d.ts +24 -6
- package/dist/core/theme/downsample.d.ts.map +1 -1
- package/dist/core/theme/downsample.js +41 -10
- package/dist/core/theme/downsample.js.map +1 -1
- package/dist/core/theme/dtcg.d.ts +28 -2
- package/dist/core/theme/dtcg.d.ts.map +1 -1
- package/dist/core/theme/dtcg.js +112 -9
- package/dist/core/theme/dtcg.js.map +1 -1
- package/dist/core/theme/extend.d.ts +14 -0
- package/dist/core/theme/extend.d.ts.map +1 -1
- package/dist/core/theme/extend.js +14 -0
- package/dist/core/theme/extend.js.map +1 -1
- package/dist/core/theme/gradient.d.ts +16 -0
- package/dist/core/theme/gradient.d.ts.map +1 -1
- package/dist/core/theme/gradient.js +13 -0
- package/dist/core/theme/gradient.js.map +1 -1
- package/dist/core/theme/index.d.ts +7 -0
- package/dist/core/theme/index.d.ts.map +1 -1
- package/dist/core/theme/index.js +7 -0
- package/dist/core/theme/index.js.map +1 -1
- package/dist/core/theme/presets.d.ts +6 -1
- package/dist/core/theme/presets.d.ts.map +1 -1
- package/dist/core/theme/presets.js +34 -1
- package/dist/core/theme/presets.js.map +1 -1
- package/dist/core/theme/resolve.d.ts +59 -13
- package/dist/core/theme/resolve.d.ts.map +1 -1
- package/dist/core/theme/resolve.js +36 -9
- package/dist/core/theme/resolve.js.map +1 -1
- package/dist/core/theme/styled.d.ts +12 -0
- package/dist/core/theme/styled.d.ts.map +1 -1
- package/dist/core/theme/styled.js +12 -0
- package/dist/core/theme/styled.js.map +1 -1
- package/dist/core/theme/tokens.d.ts +29 -0
- package/dist/core/theme/tokens.d.ts.map +1 -1
- package/dist/factory.d.ts +18 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +11 -0
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/ports/context.d.ts +11 -0
- package/dist/ports/context.d.ts.map +1 -1
- package/dist/ports/index.d.ts +6 -1
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +5 -0
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/io.d.ts +66 -2
- package/dist/ports/io.d.ts.map +1 -1
- package/dist/ports/runtime.d.ts +11 -0
- package/dist/ports/runtime.d.ts.map +1 -1
- package/dist/ports/style.d.ts +14 -0
- package/dist/ports/style.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test assertion helpers for ANSI escape and output validation.
|
|
3
|
+
*
|
|
4
|
+
* These helpers import `vitest` and are intended for test files only —
|
|
5
|
+
* they are NOT exported from the main bijou barrel.
|
|
6
|
+
*
|
|
7
|
+
* @module adapters/test/assertions
|
|
8
|
+
*/
|
|
9
|
+
import type { TestContext } from './index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Assert that the output contains no ANSI escapes at all (no CSI, no OSC).
|
|
12
|
+
*
|
|
13
|
+
* @param output - The string to check.
|
|
14
|
+
*/
|
|
15
|
+
export declare function expectNoAnsi(output: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Assert that the output contains no SGR color/style sequences.
|
|
18
|
+
*
|
|
19
|
+
* Allows cursor-control escapes like `\x1b[?25l` (hide cursor),
|
|
20
|
+
* `\x1b[K` (clear line), and `\x1b[3A` (move up). Only rejects
|
|
21
|
+
* sequences of the form `\x1b[<digits>m`.
|
|
22
|
+
*
|
|
23
|
+
* @param output - The string to check.
|
|
24
|
+
*/
|
|
25
|
+
export declare function expectNoAnsiSgr(output: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Assert that the output contains at least one ANSI escape sequence.
|
|
28
|
+
*
|
|
29
|
+
* @param output - The string to check.
|
|
30
|
+
*/
|
|
31
|
+
export declare function expectContainsAnsi(output: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Assert that the output contains the hide-cursor sequence (`\x1b[?25l`).
|
|
34
|
+
*
|
|
35
|
+
* @param output - The string to check.
|
|
36
|
+
*/
|
|
37
|
+
export declare function expectHiddenCursor(output: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Assert that the output contains the show-cursor sequence (`\x1b[?25h`).
|
|
40
|
+
*
|
|
41
|
+
* @param output - The string to check.
|
|
42
|
+
*/
|
|
43
|
+
export declare function expectShownCursor(output: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Assert that the combined written output of a test context contains a substring.
|
|
46
|
+
*
|
|
47
|
+
* @param ctx - A test context with a mock IO adapter.
|
|
48
|
+
* @param substring - The substring to search for in the joined output.
|
|
49
|
+
*/
|
|
50
|
+
export declare function expectWritten(ctx: TestContext, substring: string): void;
|
|
51
|
+
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAQ9C;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAEvE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test assertion helpers for ANSI escape and output validation.
|
|
3
|
+
*
|
|
4
|
+
* These helpers import `vitest` and are intended for test files only —
|
|
5
|
+
* they are NOT exported from the main bijou barrel.
|
|
6
|
+
*
|
|
7
|
+
* @module adapters/test/assertions
|
|
8
|
+
*/
|
|
9
|
+
import { expect } from 'vitest';
|
|
10
|
+
/** Matches any ANSI escape: CSI (`\x1b[`) or OSC (`\x1b]`). */
|
|
11
|
+
const ANSI_RE = new RegExp('\\x1b[\\[\\]]');
|
|
12
|
+
/** Matches SGR color/style sequences (`\x1b[<digits>m`) but not cursor control. */
|
|
13
|
+
const SGR_RE = new RegExp('\\x1b\\[\\d+(?:;\\d+)*m');
|
|
14
|
+
/**
|
|
15
|
+
* Assert that the output contains no ANSI escapes at all (no CSI, no OSC).
|
|
16
|
+
*
|
|
17
|
+
* @param output - The string to check.
|
|
18
|
+
*/
|
|
19
|
+
export function expectNoAnsi(output) {
|
|
20
|
+
expect(output).not.toMatch(ANSI_RE);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Assert that the output contains no SGR color/style sequences.
|
|
24
|
+
*
|
|
25
|
+
* Allows cursor-control escapes like `\x1b[?25l` (hide cursor),
|
|
26
|
+
* `\x1b[K` (clear line), and `\x1b[3A` (move up). Only rejects
|
|
27
|
+
* sequences of the form `\x1b[<digits>m`.
|
|
28
|
+
*
|
|
29
|
+
* @param output - The string to check.
|
|
30
|
+
*/
|
|
31
|
+
export function expectNoAnsiSgr(output) {
|
|
32
|
+
expect(output).not.toMatch(SGR_RE);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Assert that the output contains at least one ANSI escape sequence.
|
|
36
|
+
*
|
|
37
|
+
* @param output - The string to check.
|
|
38
|
+
*/
|
|
39
|
+
export function expectContainsAnsi(output) {
|
|
40
|
+
expect(output).toMatch(ANSI_RE);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Assert that the output contains the hide-cursor sequence (`\x1b[?25l`).
|
|
44
|
+
*
|
|
45
|
+
* @param output - The string to check.
|
|
46
|
+
*/
|
|
47
|
+
export function expectHiddenCursor(output) {
|
|
48
|
+
expect(output).toContain('\x1b[?25l');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Assert that the output contains the show-cursor sequence (`\x1b[?25h`).
|
|
52
|
+
*
|
|
53
|
+
* @param output - The string to check.
|
|
54
|
+
*/
|
|
55
|
+
export function expectShownCursor(output) {
|
|
56
|
+
expect(output).toContain('\x1b[?25h');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Assert that the combined written output of a test context contains a substring.
|
|
60
|
+
*
|
|
61
|
+
* @param ctx - A test context with a mock IO adapter.
|
|
62
|
+
* @param substring - The substring to search for in the joined output.
|
|
63
|
+
*/
|
|
64
|
+
export function expectWritten(ctx, substring) {
|
|
65
|
+
expect(ctx.io.written.join('')).toContain(substring);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=assertions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../../src/adapters/test/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,+DAA+D;AAC/D,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;AAE5C,mFAAmF;AACnF,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAAgB,EAAE,SAAiB;IAC/D,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,25 +1,46 @@
|
|
|
1
1
|
import type { StylePort } from '../../ports/style.js';
|
|
2
2
|
import type { TokenValue, RGB } from '../../core/theme/tokens.js';
|
|
3
|
+
/**
|
|
4
|
+
* Record of a single styling invocation captured by {@link AuditStylePort}.
|
|
5
|
+
*/
|
|
3
6
|
export interface StyledCall {
|
|
4
|
-
|
|
7
|
+
/** Which styling method was called. */
|
|
8
|
+
method: 'styled' | 'rgb' | 'hex' | 'bgRgb' | 'bgHex' | 'bold';
|
|
9
|
+
/** The text that was styled. */
|
|
5
10
|
text: string;
|
|
11
|
+
/** The design-token value passed to `styled()`, if applicable. */
|
|
6
12
|
token?: TokenValue;
|
|
13
|
+
/** The color argument passed to `rgb()` or `hex()`, if applicable. */
|
|
7
14
|
color?: string | RGB;
|
|
8
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Extended {@link StylePort} that records every call for test assertions.
|
|
18
|
+
*
|
|
19
|
+
* All styling methods return text unchanged (identity pass-through) so that
|
|
20
|
+
* string equality assertions work without stripping escape codes. Use the
|
|
21
|
+
* `calls` array or `wasStyled` helper to verify styling behavior.
|
|
22
|
+
*/
|
|
9
23
|
export interface AuditStylePort extends StylePort {
|
|
10
24
|
/** All recorded style calls in order. */
|
|
11
25
|
readonly calls: readonly StyledCall[];
|
|
12
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Check whether a `styled()` call matched a given token and text substring.
|
|
28
|
+
* @param token - The design-token value to match against (compared by hex and modifiers).
|
|
29
|
+
* @param substring - A substring that must appear in the styled text.
|
|
30
|
+
* @returns `true` if a matching `styled()` call was recorded.
|
|
31
|
+
*/
|
|
13
32
|
wasStyled(token: TokenValue, substring: string): boolean;
|
|
14
|
-
/**
|
|
33
|
+
/** Clear all recorded calls. */
|
|
15
34
|
reset(): void;
|
|
16
35
|
}
|
|
17
36
|
/**
|
|
18
|
-
* Create a StylePort that records all styling calls for test assertions.
|
|
37
|
+
* Create a {@link StylePort} that records all styling calls for test assertions.
|
|
38
|
+
*
|
|
39
|
+
* Return text unchanged (like {@link plainStyle}) so existing string assertions
|
|
40
|
+
* still work. Record every call for post-hoc assertion via the `calls` array
|
|
41
|
+
* and the `wasStyled()` convenience method.
|
|
19
42
|
*
|
|
20
|
-
*
|
|
21
|
-
* still work. Records every call for post-hoc assertion via `calls` array
|
|
22
|
-
* and `wasStyled()` convenience method.
|
|
43
|
+
* @returns An {@link AuditStylePort} with an empty call log.
|
|
23
44
|
*/
|
|
24
45
|
export declare function auditStyle(): AuditStylePort;
|
|
25
46
|
//# sourceMappingURL=audit-style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-style.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/audit-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"audit-style.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/audit-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,MAAM,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IAC9D,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAEtC;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzD,gCAAgC;IAChC,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAmG3C"}
|
|
@@ -1,38 +1,95 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Create a StylePort that records all styling calls for test assertions.
|
|
2
|
+
* Create a {@link StylePort} that records all styling calls for test assertions.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* still work.
|
|
6
|
-
* and `wasStyled()` convenience method.
|
|
4
|
+
* Return text unchanged (like {@link plainStyle}) so existing string assertions
|
|
5
|
+
* still work. Record every call for post-hoc assertion via the `calls` array
|
|
6
|
+
* and the `wasStyled()` convenience method.
|
|
7
|
+
*
|
|
8
|
+
* @returns An {@link AuditStylePort} with an empty call log.
|
|
7
9
|
*/
|
|
8
10
|
export function auditStyle() {
|
|
11
|
+
/** @internal Mutable backing array for recorded calls. */
|
|
9
12
|
const _calls = [];
|
|
10
13
|
return {
|
|
11
14
|
get calls() {
|
|
12
15
|
return _calls.slice();
|
|
13
16
|
},
|
|
17
|
+
/**
|
|
18
|
+
* Record a `styled()` call and return the text unchanged.
|
|
19
|
+
* @param token - The design-token value.
|
|
20
|
+
* @param text - The text to style.
|
|
21
|
+
* @returns The original text, unmodified.
|
|
22
|
+
*/
|
|
14
23
|
styled(token, text) {
|
|
15
24
|
_calls.push({ method: 'styled', text, token });
|
|
16
25
|
return text;
|
|
17
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Record an `rgb()` call and return the text unchanged.
|
|
29
|
+
* @param r - Red channel (0-255).
|
|
30
|
+
* @param g - Green channel (0-255).
|
|
31
|
+
* @param b - Blue channel (0-255).
|
|
32
|
+
* @param text - The text to style.
|
|
33
|
+
* @returns The original text, unmodified.
|
|
34
|
+
*/
|
|
18
35
|
rgb(r, g, b, text) {
|
|
19
36
|
_calls.push({ method: 'rgb', text, color: [r, g, b] });
|
|
20
37
|
return text;
|
|
21
38
|
},
|
|
39
|
+
/**
|
|
40
|
+
* Record a `hex()` call and return the text unchanged.
|
|
41
|
+
* @param color - Hex color string (e.g. `"#ff00aa"`).
|
|
42
|
+
* @param text - The text to style.
|
|
43
|
+
* @returns The original text, unmodified.
|
|
44
|
+
*/
|
|
22
45
|
hex(color, text) {
|
|
23
46
|
_calls.push({ method: 'hex', text, color });
|
|
24
47
|
return text;
|
|
25
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* Record a `bgRgb()` call and return the text unchanged.
|
|
51
|
+
* @param r - Red channel (0-255).
|
|
52
|
+
* @param g - Green channel (0-255).
|
|
53
|
+
* @param b - Blue channel (0-255).
|
|
54
|
+
* @param text - The text to style.
|
|
55
|
+
* @returns The original text, unmodified.
|
|
56
|
+
*/
|
|
57
|
+
bgRgb(r, g, b, text) {
|
|
58
|
+
_calls.push({ method: 'bgRgb', text, color: [r, g, b] });
|
|
59
|
+
return text;
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Record a `bgHex()` call and return the text unchanged.
|
|
63
|
+
* @param color - Hex color string (e.g. `"#ff00aa"`).
|
|
64
|
+
* @param text - The text to style.
|
|
65
|
+
* @returns The original text, unmodified.
|
|
66
|
+
*/
|
|
67
|
+
bgHex(color, text) {
|
|
68
|
+
_calls.push({ method: 'bgHex', text, color });
|
|
69
|
+
return text;
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Record a `bold()` call and return the text unchanged.
|
|
73
|
+
* @param text - The text to style.
|
|
74
|
+
* @returns The original text, unmodified.
|
|
75
|
+
*/
|
|
26
76
|
bold(text) {
|
|
27
77
|
_calls.push({ method: 'bold', text });
|
|
28
78
|
return text;
|
|
29
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* Check whether a `styled()` call matched a given token and text substring.
|
|
82
|
+
* @param token - The design-token value to match (compared by hex and modifiers).
|
|
83
|
+
* @param substring - A substring that must appear in the styled text.
|
|
84
|
+
* @returns `true` if a matching `styled()` call was recorded.
|
|
85
|
+
*/
|
|
30
86
|
wasStyled(token, substring) {
|
|
31
87
|
return _calls.some((c) => c.method === 'styled'
|
|
32
88
|
&& c.token?.hex === token.hex
|
|
33
89
|
&& JSON.stringify([...(c.token?.modifiers ?? [])].sort()) === JSON.stringify([...(token.modifiers ?? [])].sort())
|
|
34
90
|
&& c.text.includes(substring));
|
|
35
91
|
},
|
|
92
|
+
/** Clear all recorded calls. */
|
|
36
93
|
reset() {
|
|
37
94
|
_calls.length = 0;
|
|
38
95
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-style.js","sourceRoot":"","sources":["../../../src/adapters/test/audit-style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit-style.js","sourceRoot":"","sources":["../../../src/adapters/test/audit-style.ts"],"names":[],"mappings":"AAwCA;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU;IACxB,0DAA0D;IAC1D,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,OAAO;QACL,IAAI,KAAK;YACP,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAED;;;;;WAKG;QACH,MAAM,CAAC,KAAiB,EAAE,IAAY;YACpC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;;;;;;WAOG;QACH,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,IAAY;YAC/C,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;;;;WAKG;QACH,GAAG,CAAC,KAAa,EAAE,IAAY;YAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;;;;;;WAOG;QACH,KAAK,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,IAAY;YACjD,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;;;;WAKG;QACH,KAAK,CAAC,KAAa,EAAE,IAAY;YAC/B,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;;;WAIG;QACH,IAAI,CAAC,IAAY;YACf,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;QAED;;;;;WAKG;QACH,SAAS,CAAC,KAAiB,EAAE,SAAiB;YAC5C,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,MAAM,KAAK,QAAQ;mBAClB,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,GAAG;mBAC1B,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;mBAC9G,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAChC,CAAC;QACJ,CAAC;QAED,gCAAgC;QAChC,KAAK;YACH,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test adapters for bijou's hexagonal ports.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports mock/stub implementations of {@link RuntimePort}, {@link IOPort},
|
|
5
|
+
* and {@link StylePort} along with the {@link createTestContext} convenience
|
|
6
|
+
* factory that assembles them into a complete {@link BijouContext}.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
1
10
|
import type { BijouContext } from '../../ports/context.js';
|
|
2
|
-
import type { OutputMode } from '../../core/detect/tty.js';
|
|
11
|
+
import type { OutputMode, ColorScheme } from '../../core/detect/tty.js';
|
|
3
12
|
import { type MockRuntimeOptions } from './runtime.js';
|
|
4
13
|
import { type MockIOOptions, type MockIO } from './io.js';
|
|
5
14
|
import type { Theme } from '../../core/theme/tokens.js';
|
|
@@ -7,15 +16,41 @@ export { mockRuntime, type MockRuntimeOptions } from './runtime.js';
|
|
|
7
16
|
export { mockIO, type MockIOOptions, type MockIO } from './io.js';
|
|
8
17
|
export { plainStyle } from './style.js';
|
|
9
18
|
export { auditStyle, type StyledCall, type AuditStylePort } from './audit-style.js';
|
|
19
|
+
export { expectNoAnsi, expectNoAnsiSgr, expectContainsAnsi, expectHiddenCursor, expectShownCursor, expectWritten, } from './assertions.js';
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for {@link createTestContext}.
|
|
22
|
+
*/
|
|
10
23
|
export interface TestContextOptions {
|
|
24
|
+
/** Overrides for the mock runtime (env vars, terminal dimensions). */
|
|
11
25
|
runtime?: MockRuntimeOptions;
|
|
26
|
+
/** Overrides for mock I/O (pre-loaded answers, keys, virtual files). */
|
|
12
27
|
io?: MockIOOptions;
|
|
28
|
+
/** Theme to resolve. Defaults to `CYAN_MAGENTA`. */
|
|
13
29
|
theme?: Theme;
|
|
30
|
+
/** Output mode. Defaults to `'interactive'`. */
|
|
14
31
|
mode?: OutputMode;
|
|
32
|
+
/** Whether to strip color from the resolved theme. Defaults to `false`. */
|
|
15
33
|
noColor?: boolean;
|
|
34
|
+
/** Terminal color scheme for the resolved theme. Defaults to `'dark'`. */
|
|
35
|
+
colorScheme?: ColorScheme;
|
|
16
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A {@link BijouContext} whose `io` property is narrowed to {@link MockIO},
|
|
39
|
+
* exposing test-inspection helpers such as `written` and `answerQueue`.
|
|
40
|
+
*/
|
|
17
41
|
export interface TestContext extends BijouContext {
|
|
42
|
+
/** Mock I/O adapter with inspectable internal buffers. */
|
|
18
43
|
readonly io: MockIO;
|
|
19
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a fully-wired {@link BijouContext} for unit and integration tests.
|
|
47
|
+
*
|
|
48
|
+
* Assemble a {@link mockRuntime}, {@link mockIO}, and {@link plainStyle}
|
|
49
|
+
* together with a resolved theme so tests can exercise bijou components
|
|
50
|
+
* without touching real terminals or filesystems.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Optional overrides for runtime, I/O, theme, mode, and color.
|
|
53
|
+
* @returns A {@link TestContext} ready for use in tests.
|
|
54
|
+
*/
|
|
20
55
|
export declare function createTestContext(options?: TestContextOptions): TestContext;
|
|
21
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAU,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAIlE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,wEAAwE;IACxE,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,oDAAoD;IACpD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gDAAgD;IAChD,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAQ/E"}
|
|
@@ -7,11 +7,22 @@ export { mockRuntime } from './runtime.js';
|
|
|
7
7
|
export { mockIO } from './io.js';
|
|
8
8
|
export { plainStyle } from './style.js';
|
|
9
9
|
export { auditStyle } from './audit-style.js';
|
|
10
|
+
export { expectNoAnsi, expectNoAnsiSgr, expectContainsAnsi, expectHiddenCursor, expectShownCursor, expectWritten, } from './assertions.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create a fully-wired {@link BijouContext} for unit and integration tests.
|
|
13
|
+
*
|
|
14
|
+
* Assemble a {@link mockRuntime}, {@link mockIO}, and {@link plainStyle}
|
|
15
|
+
* together with a resolved theme so tests can exercise bijou components
|
|
16
|
+
* without touching real terminals or filesystems.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Optional overrides for runtime, I/O, theme, mode, and color.
|
|
19
|
+
* @returns A {@link TestContext} ready for use in tests.
|
|
20
|
+
*/
|
|
10
21
|
export function createTestContext(options = {}) {
|
|
11
22
|
const runtime = mockRuntime(options.runtime);
|
|
12
23
|
const io = mockIO(options.io);
|
|
13
24
|
const style = plainStyle();
|
|
14
|
-
const theme = createResolved(options.theme ?? CYAN_MAGENTA, options.noColor ?? false);
|
|
25
|
+
const theme = createResolved(options.theme ?? CYAN_MAGENTA, options.noColor ?? false, options.colorScheme ?? 'dark');
|
|
15
26
|
const mode = options.mode ?? 'interactive';
|
|
16
27
|
return { theme, mode, runtime, io, style };
|
|
17
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/test/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/test/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAA2B,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,MAAM,EAAmC,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,WAAW,EAA2B,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,MAAM,EAAmC,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAwC,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,iBAAiB,CAAC;AA6BzB;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA8B,EAAE;IAChE,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,YAAY,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK,EAAE,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC,CAAC;IACrH,MAAM,IAAI,GAAe,OAAO,CAAC,IAAI,IAAI,aAAa,CAAC;IAEvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
import type { IOPort } from '../../ports/io.js';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for {@link mockIO}.
|
|
4
|
+
*/
|
|
2
5
|
export interface MockIOOptions {
|
|
6
|
+
/** Pre-loaded answers returned by {@link MockIO.question} in FIFO order. */
|
|
3
7
|
answers?: string[];
|
|
8
|
+
/** Pre-loaded keypress strings delivered by {@link MockIO.rawInput} via microtasks. */
|
|
4
9
|
keys?: string[];
|
|
10
|
+
/** Virtual filesystem entries (path to content) for {@link MockIO.readFile}. */
|
|
5
11
|
files?: Record<string, string>;
|
|
12
|
+
/** Virtual directory listings (path to entries) for {@link MockIO.readDir}. */
|
|
6
13
|
dirs?: Record<string, string[]>;
|
|
7
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Extended {@link IOPort} exposing internal buffers for test assertions.
|
|
17
|
+
*
|
|
18
|
+
* Use `written` to inspect everything sent to the output stream, and
|
|
19
|
+
* `answerQueue` / `files` / `dirs` to prepopulate mock data.
|
|
20
|
+
*/
|
|
8
21
|
export interface MockIO extends IOPort {
|
|
22
|
+
/** All strings passed to {@link write} and prompt strings passed to {@link question}. */
|
|
9
23
|
written: string[];
|
|
24
|
+
/** Remaining answers that will be consumed by {@link question}. */
|
|
10
25
|
answerQueue: string[];
|
|
26
|
+
/** Mutable virtual filesystem backing {@link readFile}. */
|
|
11
27
|
files: Record<string, string>;
|
|
28
|
+
/** Mutable virtual directory listing backing {@link readDir}. */
|
|
12
29
|
dirs: Record<string, string[]>;
|
|
13
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Create an in-memory {@link IOPort} for tests.
|
|
33
|
+
*
|
|
34
|
+
* Capture all output in `written`, resolve `question()` calls from a
|
|
35
|
+
* pre-loaded answer queue, deliver keypress events via microtasks, and
|
|
36
|
+
* serve filesystem reads from an in-memory map.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Optional pre-loaded answers, keys, files, and directory listings.
|
|
39
|
+
* @returns A {@link MockIO} ready for use in tests.
|
|
40
|
+
*/
|
|
14
41
|
export declare function mockIO(options?: MockIOOptions): MockIO;
|
|
15
42
|
//# sourceMappingURL=io.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+B,MAAM,mBAAmB,CAAC;AAG7E,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,MAAO,SAAQ,MAAM;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAED,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+B,MAAM,mBAAmB,CAAC;AAG7E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,MAAO,SAAQ,MAAM;IACpC,yFAAyF;IACzF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,mEAAmE;IACnE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAuG1D"}
|
package/dist/adapters/test/io.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Create an in-memory {@link IOPort} for tests.
|
|
4
|
+
*
|
|
5
|
+
* Capture all output in `written`, resolve `question()` calls from a
|
|
6
|
+
* pre-loaded answer queue, deliver keypress events via microtasks, and
|
|
7
|
+
* serve filesystem reads from an in-memory map.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Optional pre-loaded answers, keys, files, and directory listings.
|
|
10
|
+
* @returns A {@link MockIO} ready for use in tests.
|
|
11
|
+
*/
|
|
2
12
|
export function mockIO(options = {}) {
|
|
3
13
|
const written = [];
|
|
4
14
|
const answerQueue = [...(options.answers ?? [])];
|
|
@@ -9,16 +19,35 @@ export function mockIO(options = {}) {
|
|
|
9
19
|
answerQueue,
|
|
10
20
|
files,
|
|
11
21
|
dirs,
|
|
22
|
+
/**
|
|
23
|
+
* Append a string to the `written` buffer.
|
|
24
|
+
* @param data - The string to write.
|
|
25
|
+
*/
|
|
12
26
|
write(data) {
|
|
13
27
|
written.push(data);
|
|
14
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* Record the prompt in `written` and resolve with the next queued answer.
|
|
31
|
+
* @param prompt - The prompt string displayed to the user.
|
|
32
|
+
* @returns The next answer from `answerQueue`, or `""` if exhausted.
|
|
33
|
+
*/
|
|
15
34
|
question(prompt) {
|
|
16
35
|
written.push(prompt);
|
|
17
36
|
return Promise.resolve(answerQueue.shift() ?? '');
|
|
18
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Deliver pre-loaded keys to the callback via microtasks.
|
|
40
|
+
*
|
|
41
|
+
* Each key is delivered one at a time; delivery stops when the handle
|
|
42
|
+
* is disposed or the key queue is exhausted.
|
|
43
|
+
*
|
|
44
|
+
* @param onKey - Callback invoked for each keypress.
|
|
45
|
+
* @returns A handle whose `dispose()` stops further key delivery.
|
|
46
|
+
*/
|
|
19
47
|
rawInput(onKey) {
|
|
20
48
|
const keyQueue = [...(options.keys ?? [])];
|
|
21
49
|
let disposed = false;
|
|
50
|
+
/** @internal Deliver the next key from the queue via microtask. */
|
|
22
51
|
function deliver() {
|
|
23
52
|
if (disposed || keyQueue.length === 0)
|
|
24
53
|
return;
|
|
@@ -30,22 +59,49 @@ export function mockIO(options = {}) {
|
|
|
30
59
|
queueMicrotask(deliver);
|
|
31
60
|
return { dispose() { disposed = true; } };
|
|
32
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* Register a resize callback (no-op in tests).
|
|
64
|
+
* @param _callback - Ignored; resize events are not simulated.
|
|
65
|
+
* @returns A no-op disposable handle.
|
|
66
|
+
*/
|
|
33
67
|
onResize(_callback) {
|
|
34
68
|
return { dispose() { } };
|
|
35
69
|
},
|
|
70
|
+
/**
|
|
71
|
+
* Start a real repeating timer via `globalThis.setInterval`.
|
|
72
|
+
* @param callback - Function to call at each interval.
|
|
73
|
+
* @param ms - Interval in milliseconds.
|
|
74
|
+
* @returns A handle whose `dispose()` cancels the timer.
|
|
75
|
+
*/
|
|
36
76
|
setInterval(callback, ms) {
|
|
37
77
|
const id = globalThis.setInterval(callback, ms);
|
|
38
78
|
return { dispose() { clearInterval(id); } };
|
|
39
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* Read a file from the virtual filesystem.
|
|
82
|
+
* @param path - The file path to look up.
|
|
83
|
+
* @returns The file content as a string.
|
|
84
|
+
* @throws {Error} If the path is not present in the virtual filesystem.
|
|
85
|
+
*/
|
|
40
86
|
readFile(path) {
|
|
41
87
|
const content = files[path];
|
|
42
88
|
if (content === undefined)
|
|
43
89
|
throw new Error(`Mock: file not found: ${path}`);
|
|
44
90
|
return content;
|
|
45
91
|
},
|
|
92
|
+
/**
|
|
93
|
+
* List entries for a virtual directory.
|
|
94
|
+
* @param path - The directory path to look up.
|
|
95
|
+
* @returns The directory listing, or an empty array if not registered.
|
|
96
|
+
*/
|
|
46
97
|
readDir(path) {
|
|
47
98
|
return dirs[path] ?? [];
|
|
48
99
|
},
|
|
100
|
+
/**
|
|
101
|
+
* Join path segments using the platform separator (delegates to Node `path.join`).
|
|
102
|
+
* @param segments - Path components to join.
|
|
103
|
+
* @returns The joined path string.
|
|
104
|
+
*/
|
|
49
105
|
joinPath(...segments) {
|
|
50
106
|
return join(...segments);
|
|
51
107
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/adapters/test/io.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/adapters/test/io.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiC5B;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAAC,UAAyB,EAAE;IAChD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3C,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;IAEzC,OAAO;QACL,OAAO;QACP,WAAW;QACX,KAAK;QACL,IAAI;QAEJ;;;WAGG;QACH,KAAK,CAAC,IAAY;YAChB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAED;;;;WAIG;QACH,QAAQ,CAAC,MAAc;YACrB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC;QAED;;;;;;;;WAQG;QACH,QAAQ,CAAC,KAA4B;YACnC,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;YAC3C,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,mEAAmE;YACnE,SAAS,OAAO;gBACd,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;oBAAE,OAAO;gBAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAG,CAAC;gBAC9B,KAAK,CAAC,GAAG,CAAC,CAAC;gBACX,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;oBAAE,cAAc,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC;YACD,cAAc,CAAC,OAAO,CAAC,CAAC;YACxB,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,CAAC;QAED;;;;WAIG;QACH,QAAQ,CAAC,SAA+C;YACtD,OAAO,EAAE,OAAO,KAAI,CAAC,EAAE,CAAC;QAC1B,CAAC;QAED;;;;;WAKG;QACH,WAAW,CAAC,QAAoB,EAAE,EAAU;YAC1C,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAChD,OAAO,EAAE,OAAO,KAAK,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,CAAC;QAED;;;;;WAKG;QACH,QAAQ,CAAC,IAAY;YACnB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,OAAO,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;YAC5E,OAAO,OAAO,CAAC;QACjB,CAAC;QAED;;;;WAIG;QACH,OAAO,CAAC,IAAY;YAClB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1B,CAAC;QAED;;;;WAIG;QACH,QAAQ,CAAC,GAAG,QAAkB;YAC5B,OAAO,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { RuntimePort } from '../../ports/runtime.js';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for {@link mockRuntime}.
|
|
4
|
+
*/
|
|
2
5
|
export interface MockRuntimeOptions {
|
|
6
|
+
/** Environment variables to expose. Defaults to an empty record. */
|
|
3
7
|
env?: Record<string, string>;
|
|
8
|
+
/** Whether stdout is a TTY. Defaults to `true`. */
|
|
4
9
|
stdoutIsTTY?: boolean;
|
|
10
|
+
/** Whether stdin is a TTY. Defaults to `true`. */
|
|
5
11
|
stdinIsTTY?: boolean;
|
|
12
|
+
/** Terminal width in columns. Defaults to `80`. */
|
|
6
13
|
columns?: number;
|
|
14
|
+
/** Terminal height in rows. Defaults to `24`. */
|
|
7
15
|
rows?: number;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Create an in-memory {@link RuntimePort} for tests.
|
|
19
|
+
*
|
|
20
|
+
* Provide deterministic environment variables and terminal dimensions
|
|
21
|
+
* without depending on the real `process` global.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Optional overrides for environment and terminal geometry.
|
|
24
|
+
* @returns A {@link RuntimePort} backed by the supplied (or default) values.
|
|
25
|
+
*/
|
|
9
26
|
export declare function mockRuntime(options?: MockRuntimeOptions): RuntimePort;
|
|
10
27
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAgBzE"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an in-memory {@link RuntimePort} for tests.
|
|
3
|
+
*
|
|
4
|
+
* Provide deterministic environment variables and terminal dimensions
|
|
5
|
+
* without depending on the real `process` global.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Optional overrides for environment and terminal geometry.
|
|
8
|
+
* @returns A {@link RuntimePort} backed by the supplied (or default) values.
|
|
9
|
+
*/
|
|
1
10
|
export function mockRuntime(options = {}) {
|
|
2
11
|
const envMap = options.env ?? {};
|
|
3
12
|
return {
|
|
13
|
+
/**
|
|
14
|
+
* Look up an environment variable by key.
|
|
15
|
+
* @param key - The variable name.
|
|
16
|
+
* @returns The value, or `undefined` if not set.
|
|
17
|
+
*/
|
|
4
18
|
env(key) {
|
|
5
19
|
return envMap[key];
|
|
6
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/adapters/test/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/adapters/test/runtime.ts"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,UAA8B,EAAE;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;IACjC,OAAO;QACL;;;;WAIG;QACH,GAAG,CAAC,GAAW;YACb,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;QACxC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;QACtC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { StylePort } from '../../ports/style.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a no-op {@link StylePort} that returns text unchanged.
|
|
4
|
+
*
|
|
5
|
+
* Use in tests where color output is irrelevant; all methods act as
|
|
6
|
+
* identity functions so string equality assertions work without
|
|
7
|
+
* stripping ANSI escape codes.
|
|
8
|
+
*
|
|
9
|
+
* @returns A {@link StylePort} whose methods pass text through unmodified.
|
|
10
|
+
*/
|
|
2
11
|
export declare function plainStyle(): StylePort;
|
|
3
12
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,wBAAgB,UAAU,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/adapters/test/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAiEtC"}
|