@dereekb/dbx-cli 13.38.0 → 13.40.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/eslint/package.json +8 -8
- package/firebase-api-manifest/package.json +3 -3
- package/firestore-query-manifest/main.js +3 -3
- package/firestore-query-manifest/package.json +3 -3
- package/generate-firestore-indexes/main.js +2 -2
- package/generate-firestore-indexes/package.json +2 -2
- package/generate-mcp-manifest/package.json +3 -3
- package/generate-route-manifest/package.json +2 -2
- package/index.esm.js +1011 -521
- package/lint-cache/package.json +2 -2
- package/manifest-extract/package.json +7 -7
- package/model-test/LICENSE +21 -0
- package/model-test/index.d.ts +1 -0
- package/model-test/index.esm.js +5984 -0
- package/model-test/package.json +21 -0
- package/model-test/src/index.d.ts +41 -0
- package/model-test/src/lib/fixture/archetype.d.ts +33 -0
- package/model-test/src/lib/fixture/extract.d.ts +37 -0
- package/model-test/src/lib/fixture/format.json.d.ts +24 -0
- package/model-test/src/lib/fixture/format.markdown.d.ts +23 -0
- package/model-test/src/lib/fixture/forward.d.ts +48 -0
- package/model-test/src/lib/fixture/framework-fixtures.d.ts +70 -0
- package/model-test/src/lib/fixture/inspect.d.ts +22 -0
- package/model-test/src/lib/fixture/scaffold.d.ts +74 -0
- package/model-test/src/lib/fixture/types.d.ts +175 -0
- package/model-test/src/lib/test/discover.d.ts +81 -0
- package/model-test/src/lib/test/extract.d.ts +49 -0
- package/model-test/src/lib/test/format.hotspots.d.ts +23 -0
- package/model-test/src/lib/test/format.json.d.ts +25 -0
- package/model-test/src/lib/test/format.list-app.d.ts +30 -0
- package/model-test/src/lib/test/format.markdown.d.ts +25 -0
- package/model-test/src/lib/test/hotspots.d.ts +98 -0
- package/model-test/src/lib/test/inspect.d.ts +32 -0
- package/model-test/src/lib/test/search.d.ts +34 -0
- package/model-test/src/lib/test/types.d.ts +179 -0
- package/package.json +18 -22
- package/route/package.json +12 -12
- package/src/lib/firestore/firestore.session.d.ts +40 -0
- package/src/lib/runner/index.d.ts +1 -0
- package/src/lib/runner/lifecycle.d.ts +85 -0
- package/src/lib/runner/run.d.ts +15 -1
- package/test/package.json +14 -14
- package/validate/LICENSE +21 -0
- package/validate/index.js +16641 -0
- package/validate/package.json +11 -0
- package/eslint/index.cjs.default.js +0 -1
- package/eslint/index.cjs.js +0 -1112
- package/eslint/index.cjs.mjs +0 -2
- package/index.cjs.js +0 -65624
- package/manifest-extract/index.cjs.default.js +0 -1
- package/manifest-extract/index.cjs.js +0 -1595
- package/manifest-extract/index.cjs.mjs +0 -2
- package/route/index.cjs.default.js +0 -1
- package/route/index.cjs.js +0 -18
- package/route/index.cjs.mjs +0 -2
- package/test/index.cjs.default.js +0 -1
- package/test/index.cjs.js +0 -383
- package/test/index.cjs.mjs +0 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST extractor for the `dbx_model_test_*` tool cluster.
|
|
3
|
+
*
|
|
4
|
+
* Parses one `.spec.ts` file's structural skeleton via ts-morph and returns
|
|
5
|
+
* the {@link SpecFileTree} consumed by the tree, search, and formatter
|
|
6
|
+
* modules. The extractor is pure — disk I/O lives in `inspect.ts`.
|
|
7
|
+
*
|
|
8
|
+
* Strategy:
|
|
9
|
+
* 1. Parse the spec text into an in-memory ts-morph project.
|
|
10
|
+
* 2. Resolve the workspace `<Prefix>` plus the set of known
|
|
11
|
+
* `<prefix><Model>Context` function names. When the caller supplied them
|
|
12
|
+
* (from `inspectAppFixtures()`) we use those; otherwise we read the
|
|
13
|
+
* spec's own imports off `**\/test/fixture` and derive the prefix as the
|
|
14
|
+
* longest common camel-prefix of the `*Context` named imports.
|
|
15
|
+
* 3. Detect locally-defined helper-describe functions (any top-level
|
|
16
|
+
* function/arrow whose body invokes `describe`/`it`).
|
|
17
|
+
* 4. Walk the file's top-level expression statements; for each call
|
|
18
|
+
* expression, classify it (describe / it / hook / fixture / wrapper /
|
|
19
|
+
* helperCall) and recurse into its callback body. Recursion only follows
|
|
20
|
+
* arrow / function-expression bodies — leaf calls (`expect(...)`,
|
|
21
|
+
* `assertSnapshotData(...)`, etc.) are not descended into.
|
|
22
|
+
*/
|
|
23
|
+
import type { SpecFileTree } from './types.js';
|
|
24
|
+
/**
|
|
25
|
+
* Inputs accepted by {@link extractSpecTreeFromText}.
|
|
26
|
+
*/
|
|
27
|
+
export interface ExtractSpecTreeInput {
|
|
28
|
+
readonly text: string;
|
|
29
|
+
readonly specPath: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional explicit prefix (e.g. `Hellosubs`). When supplied alongside
|
|
32
|
+
* {@link knownFixtureNames}, no import-based detection is attempted.
|
|
33
|
+
*/
|
|
34
|
+
readonly prefix?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional explicit list of `<prefix><Model>Context` function names.
|
|
37
|
+
* Typically supplied from the result of `inspectAppFixtures()`. When
|
|
38
|
+
* non-empty, fixture-name matching is exact instead of suffix-based.
|
|
39
|
+
*/
|
|
40
|
+
readonly knownFixtureNames?: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Pure entry point used by inspect.ts and tests. Parses the supplied spec
|
|
44
|
+
* text and returns the structural tree; never touches disk.
|
|
45
|
+
*
|
|
46
|
+
* @param input - The raw spec text + caller-relative path metadata.
|
|
47
|
+
* @returns The parsed tree.
|
|
48
|
+
*/
|
|
49
|
+
export declare function extractSpecTreeFromText(input: ExtractSpecTreeInput): SpecFileTree;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown / JSON renderers for `dbx_model_test_hotspots`.
|
|
3
|
+
*
|
|
4
|
+
* The markdown renderer leads with the actionable answer — "extend these
|
|
5
|
+
* existing crud/scenario specs" or "none exist, create these canonical files" —
|
|
6
|
+
* so the response directly counters the failure mode of concluding a model has
|
|
7
|
+
* no spec to extend from a filename search.
|
|
8
|
+
*/
|
|
9
|
+
import type { ModelTestHotspotsResult } from './hotspots.js';
|
|
10
|
+
/**
|
|
11
|
+
* Renders the hotspots result as a JSON string (two-space indent).
|
|
12
|
+
*
|
|
13
|
+
* @param result - The hotspots result.
|
|
14
|
+
* @returns The JSON body.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatHotspotsAsJson(result: ModelTestHotspotsResult): string;
|
|
17
|
+
/**
|
|
18
|
+
* Renders the hotspots result as markdown.
|
|
19
|
+
*
|
|
20
|
+
* @param result - The hotspots result.
|
|
21
|
+
* @returns The markdown body.
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatHotspotsAsMarkdown(result: ModelTestHotspotsResult): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON formatters for the `dbx_model_test_*` tool cluster.
|
|
3
|
+
*
|
|
4
|
+
* The tree formatter returns either the full parsed tree or one of the
|
|
5
|
+
* filtered views; the search formatter returns the search result verbatim.
|
|
6
|
+
* Both produce stable JSON suitable for downstream tooling.
|
|
7
|
+
*/
|
|
8
|
+
import type { SpecFileTree, SpecSearchResult, SpecTreeFilters, SpecTreeView } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Renders the tree report for `dbx_model_test_tree` in JSON form.
|
|
11
|
+
*
|
|
12
|
+
* @param tree - The parsed spec tree.
|
|
13
|
+
* @param view - The requested view.
|
|
14
|
+
* @param filters - Optional model / describe-path filters.
|
|
15
|
+
* @returns The JSON body.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatTreeAsJson(tree: SpecFileTree, view?: SpecTreeView, filters?: SpecTreeFilters): string;
|
|
18
|
+
/**
|
|
19
|
+
* Renders the search report for `dbx_model_test_search` in JSON form.
|
|
20
|
+
*
|
|
21
|
+
* @param tree - The parsed spec tree (used for the wrapper metadata)
|
|
22
|
+
* @param result - The search outcome.
|
|
23
|
+
* @returns The JSON body.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatSearchAsJson(tree: SpecFileTree, result: SpecSearchResult): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown / JSON renderers for `dbx_model_test_list_app`.
|
|
3
|
+
*
|
|
4
|
+
* The renderer takes a {@link DiscoveredSpecCatalog} and produces a per-group
|
|
5
|
+
* listing plus a "Where to add a new test" guidance block and a consolidated
|
|
6
|
+
* drift report. Output is intentionally compact so the answer to "what's
|
|
7
|
+
* already here and where do I add the next one?" lives in a single response.
|
|
8
|
+
*/
|
|
9
|
+
import type { DiscoveredSpecCatalog } from './discover.js';
|
|
10
|
+
/**
|
|
11
|
+
* Renders the list-app report as markdown.
|
|
12
|
+
*
|
|
13
|
+
* @param catalog - The discovered, classified catalog.
|
|
14
|
+
* @param filter - Optional caller-supplied filter — surfaced in the heading
|
|
15
|
+
* so the reader knows the listing is scoped.
|
|
16
|
+
* @param filter.group - When set, the rendered heading notes that only this
|
|
17
|
+
* model group is shown. The catalog itself is already pre-filtered.
|
|
18
|
+
* @returns The markdown body.
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatListAppAsMarkdown(catalog: DiscoveredSpecCatalog, filter?: {
|
|
21
|
+
readonly group?: string;
|
|
22
|
+
}): string;
|
|
23
|
+
/**
|
|
24
|
+
* Renders the list-app report as a JSON string (one shape suitable for
|
|
25
|
+
* automation). Pretty-printed with two-space indent so diffs stay readable.
|
|
26
|
+
*
|
|
27
|
+
* @param catalog - The discovered, classified catalog.
|
|
28
|
+
* @returns The JSON body.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatListAppAsJson(catalog: DiscoveredSpecCatalog): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown formatters for the `dbx_model_test_*` tool cluster.
|
|
3
|
+
*
|
|
4
|
+
* The tree formatter renders one of the requested {@link SpecTreeView}
|
|
5
|
+
* variants. The search formatter renders match lists for the four query
|
|
6
|
+
* modes. Both share a small node-line renderer so the output is consistent.
|
|
7
|
+
*/
|
|
8
|
+
import type { SpecFileTree, SpecSearchResult, SpecTreeFilters, SpecTreeView } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Renders the tree report for `dbx_model_test_tree`.
|
|
11
|
+
*
|
|
12
|
+
* @param tree - The parsed spec tree.
|
|
13
|
+
* @param view - The requested view (defaults to `all`)
|
|
14
|
+
* @param filters - Optional model / describe-path filters.
|
|
15
|
+
* @returns The markdown body.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatTreeAsMarkdown(tree: SpecFileTree, view?: SpecTreeView, filters?: SpecTreeFilters): string;
|
|
18
|
+
/**
|
|
19
|
+
* Renders the search report for `dbx_model_test_search`.
|
|
20
|
+
*
|
|
21
|
+
* @param tree - The parsed spec tree (used for the header)
|
|
22
|
+
* @param result - The search outcome.
|
|
23
|
+
* @returns The markdown body.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatSearchAsMarkdown(tree: SpecFileTree, result: SpecSearchResult): string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inverse fixture→spec lookup for the `dbx_model_test_hotspots` tool.
|
|
3
|
+
*
|
|
4
|
+
* Given a model, finds the existing API integration `.spec.ts` "hotspots" that
|
|
5
|
+
* reference the model's test fixture (or its parent fixtures), classified
|
|
6
|
+
* crud-vs-scenario — and, when none exist, the canonical default spec files to
|
|
7
|
+
* create. Composes the existing scanners ({@link inspectAppFixtures},
|
|
8
|
+
* {@link discoverSpecFilesByGroup}, {@link extractSpecTreeFromText},
|
|
9
|
+
* {@link searchSpecTree}) plus the `@dereekb/util` naming-convention helpers; the
|
|
10
|
+
* only net-new logic is inverting "spec → fixtures it uses" into "fixture → specs
|
|
11
|
+
* that use it" across the whole app.
|
|
12
|
+
*
|
|
13
|
+
* Why this exists: dbx-components API integration specs are grouped by model
|
|
14
|
+
* **group** (`<group>.crud[.<sub>].spec.ts` / `<group>.scenario[.<sub>].spec.ts`),
|
|
15
|
+
* not named per-model, so a filename search for a sub-model finds nothing even
|
|
16
|
+
* though its behaviour is tested inside the parent group's specs.
|
|
17
|
+
*/
|
|
18
|
+
import type { SpecSearchHit } from './types.js';
|
|
19
|
+
/**
|
|
20
|
+
* The crud/scenario classification of a hotspot's spec file, collapsed from the
|
|
21
|
+
* finer {@link SpecFileKind} (the `-subgroup` / `-misplaced` variants fold into
|
|
22
|
+
* their base bucket; everything else is `other`).
|
|
23
|
+
*/
|
|
24
|
+
export type SpecBucket = 'crud' | 'scenario' | 'other';
|
|
25
|
+
/**
|
|
26
|
+
* One existing spec file that references the target model's fixture or a parent
|
|
27
|
+
* fixture, with the per-reference counts and the matched fixture nodes.
|
|
28
|
+
*/
|
|
29
|
+
export interface ModelTestHotspot {
|
|
30
|
+
readonly fileRel: string;
|
|
31
|
+
readonly bucket: SpecBucket;
|
|
32
|
+
/**
|
|
33
|
+
* Fixture-node matches whose model is the target itself.
|
|
34
|
+
*/
|
|
35
|
+
readonly directRefs: number;
|
|
36
|
+
/**
|
|
37
|
+
* Fixture-node matches whose model is a parent fixture the target depends on.
|
|
38
|
+
*/
|
|
39
|
+
readonly parentRefs: number;
|
|
40
|
+
/**
|
|
41
|
+
* The matched fixture nodes (direct then parent), each with its describe path,
|
|
42
|
+
* inherited fixture chain, and 1-based line range.
|
|
43
|
+
*/
|
|
44
|
+
readonly hits: readonly SpecSearchHit[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Result of {@link findModelTestHotspots}: the resolved fixture context plus the
|
|
48
|
+
* ranked hotspots, or — when none reference the model — the canonical default
|
|
49
|
+
* spec files to create.
|
|
50
|
+
*/
|
|
51
|
+
export interface ModelTestHotspotsResult {
|
|
52
|
+
readonly model: string;
|
|
53
|
+
readonly apiRel: string;
|
|
54
|
+
/**
|
|
55
|
+
* `true` when the model has a `<prefix><Model>TestContext` triplet in
|
|
56
|
+
* `src/test/fixture.ts`; `false` ⇒ parent inference is unavailable and the
|
|
57
|
+
* scan falls back to matching the bare model name in specs.
|
|
58
|
+
*/
|
|
59
|
+
readonly fixtureFound: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Transitive parent-fixture models the target depends on (nearest first).
|
|
62
|
+
*/
|
|
63
|
+
readonly parentModels: readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
* The model group the hotspots / suggestions key off.
|
|
66
|
+
*/
|
|
67
|
+
readonly group: string;
|
|
68
|
+
/**
|
|
69
|
+
* `true` when {@link group} matched an existing `function/<group>/` folder;
|
|
70
|
+
* `false` ⇒ it was inferred from the model/parent name.
|
|
71
|
+
*/
|
|
72
|
+
readonly groupMatchedExisting: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Existing spec files referencing the fixture, ranked direct-refs-first.
|
|
75
|
+
*/
|
|
76
|
+
readonly hotspots: readonly ModelTestHotspot[];
|
|
77
|
+
/**
|
|
78
|
+
* Canonical default spec files to create — populated only when
|
|
79
|
+
* {@link hotspots} is empty.
|
|
80
|
+
*/
|
|
81
|
+
readonly suggestedFiles: readonly string[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Inputs to {@link findModelTestHotspots}.
|
|
85
|
+
*/
|
|
86
|
+
export interface FindModelTestHotspotsConfig {
|
|
87
|
+
readonly apiAbs: string;
|
|
88
|
+
readonly apiRel: string;
|
|
89
|
+
readonly model: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Finds the existing spec hotspots that reference a model's fixture (or its
|
|
93
|
+
* parents), or the default files to create when there are none.
|
|
94
|
+
*
|
|
95
|
+
* @param config - The API-app paths + target model name.
|
|
96
|
+
* @returns The resolved hotspots result.
|
|
97
|
+
*/
|
|
98
|
+
export declare function findModelTestHotspots(config: FindModelTestHotspotsConfig): Promise<ModelTestHotspotsResult>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem inspection for the `dbx_model_test_*` cluster.
|
|
3
|
+
*
|
|
4
|
+
* Reads a single `.spec.ts` file from disk and feeds its text through the
|
|
5
|
+
* pure {@link extractSpecTreeFromText} parser. When `apiDir` is supplied,
|
|
6
|
+
* the helper also reads the app's `src/test/fixture.ts` via
|
|
7
|
+
* `inspectAppFixtures()` so the parser can use the authoritative workspace
|
|
8
|
+
* prefix and the full set of `<prefix><Model>Context` function names.
|
|
9
|
+
*
|
|
10
|
+
* Centralising disk I/O here keeps the extractor and search modules pure;
|
|
11
|
+
* specs build trees from inline text without touching the filesystem.
|
|
12
|
+
*/
|
|
13
|
+
import type { SpecFileTree } from './types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Reads `<specAbs>` and returns the parsed tree. When `apiDir` is supplied,
|
|
16
|
+
* the helper additionally inspects `<apiAbs>/src/test/fixture.ts` so the
|
|
17
|
+
* parser can use the authoritative workspace prefix and the full set of
|
|
18
|
+
* fixture-context names.
|
|
19
|
+
*
|
|
20
|
+
* @param config - Inspection inputs.
|
|
21
|
+
* @param config.specAbs - Absolute path to the `.spec.ts` file.
|
|
22
|
+
* @param config.specRel - Caller-relative path metadata.
|
|
23
|
+
* @param config.apiAbs - Optional absolute path to the API app root.
|
|
24
|
+
* @param config.apiRel - Optional caller-relative path metadata for the app.
|
|
25
|
+
* @returns The parsed tree.
|
|
26
|
+
*/
|
|
27
|
+
export declare function inspectSpecFile(config: {
|
|
28
|
+
readonly specAbs: string;
|
|
29
|
+
readonly specRel: string;
|
|
30
|
+
readonly apiAbs?: string;
|
|
31
|
+
readonly apiRel?: string;
|
|
32
|
+
}): Promise<SpecFileTree>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search over the parsed `SpecFileTree`.
|
|
3
|
+
*
|
|
4
|
+
* Walks the tree depth-first while maintaining two stacks:
|
|
5
|
+
* - `describePath` — the chain of `describe` titles ascending from the
|
|
6
|
+
* spec root.
|
|
7
|
+
* - `fixtureChain` — the chain of fixture model names ascending from the
|
|
8
|
+
* spec root.
|
|
9
|
+
*
|
|
10
|
+
* Each query mode returns a flat list of {@link SpecSearchHit}s with both
|
|
11
|
+
* stacks captured per match. Stacks describe the path *down to* the match
|
|
12
|
+
* (excluding the match itself), so callers can render a search hit with
|
|
13
|
+
* the full context that a test sitting at that node would inherit.
|
|
14
|
+
*/
|
|
15
|
+
import type { SpecFileTree, SpecSearchQuery, SpecSearchResult } from './types.js';
|
|
16
|
+
/**
|
|
17
|
+
* Searches a parsed spec tree against a single query. Behaviour by
|
|
18
|
+
* `query.mode`:.
|
|
19
|
+
*
|
|
20
|
+
* - `'model'` — case-insensitive equality match on every `fixture` node's
|
|
21
|
+
* {@link SpecNode.model} (e.g. `Job`).
|
|
22
|
+
* - `'chain'` — case-insensitive consecutive-subsequence match against
|
|
23
|
+
* every fixture chain. The query value uses `>` as a separator
|
|
24
|
+
* (e.g. `Country > CountryState`).
|
|
25
|
+
* - `'describe'` — case-insensitive substring match against every
|
|
26
|
+
* `describe` node's title.
|
|
27
|
+
* - `'it'` — case-insensitive substring match against every `it` node's
|
|
28
|
+
* title.
|
|
29
|
+
*
|
|
30
|
+
* @param tree - The parsed spec tree.
|
|
31
|
+
* @param query - The search criterion.
|
|
32
|
+
* @returns The search hits (possibly empty)
|
|
33
|
+
*/
|
|
34
|
+
export declare function searchSpecTree(tree: SpecFileTree, query: SpecSearchQuery): SpecSearchResult;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types shared by the `dbx_model_test_*` tool cluster.
|
|
3
|
+
*
|
|
4
|
+
* The cluster reads a single `.spec.ts` file from a downstream API app and
|
|
5
|
+
* parses its structural skeleton: nested `describe`/`it` calls, the
|
|
6
|
+
* `<prefix><Model>Context(...)` fixture-context calls, locally-defined
|
|
7
|
+
* helper-describe functions, and the wrapper calls (e.g.
|
|
8
|
+
* `describeCallableRequestTest`, `<prefix>FunctionContextFactory`) that sit
|
|
9
|
+
* between them.
|
|
10
|
+
*
|
|
11
|
+
* The extractor returns the full {@link SpecFileTree}. Per-view filtering
|
|
12
|
+
* and search live in their own modules so the parser stays pure.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The kind of node detected at a call site inside a spec file.
|
|
16
|
+
*
|
|
17
|
+
* - `describe` — `describe(...)` / `xdescribe(...)` / `fdescribe(...)`
|
|
18
|
+
* - `it` — `it(...)` / `xit(...)` / `fit(...)` / `test(...)`
|
|
19
|
+
* - `hook` — `beforeEach` / `beforeAll` / `afterEach` / `afterAll`
|
|
20
|
+
* - `fixture` — a `<prefix><Model>Context(...)` test-context-fixture call
|
|
21
|
+
* - `wrapper` — any other call that takes a trailing arrow / function
|
|
22
|
+
* callback (e.g. `describeCallableRequestTest`,
|
|
23
|
+
* `<prefix>FunctionContextFactory`); rendered as a transparent layer
|
|
24
|
+
* - `helperCall` — a call to a function declared in this same file that
|
|
25
|
+
* itself emits `describe`/`it` calls
|
|
26
|
+
*/
|
|
27
|
+
export type SpecNodeKind = 'describe' | 'it' | 'hook' | 'fixture' | 'wrapper' | 'helperCall';
|
|
28
|
+
/**
|
|
29
|
+
* One structural node detected in a spec file.
|
|
30
|
+
*
|
|
31
|
+
* `line`/`endLine` are 1-based line numbers from ts-morph and bracket the
|
|
32
|
+
* call expression itself (not just its callback body) — they're what callers
|
|
33
|
+
* use to navigate.
|
|
34
|
+
*/
|
|
35
|
+
export interface SpecNode {
|
|
36
|
+
readonly kind: SpecNodeKind;
|
|
37
|
+
/**
|
|
38
|
+
* Title for `describe`/`it`/`hook` nodes. `undefined` when the call has no
|
|
39
|
+
* string title (e.g. `beforeEach`) or when the title is a non-trivial
|
|
40
|
+
* expression — see {@link titleIsTemplate}.
|
|
41
|
+
*/
|
|
42
|
+
readonly title?: string;
|
|
43
|
+
/**
|
|
44
|
+
* `true` when the title was a template literal or non-string-literal
|
|
45
|
+
* expression and the value reported in {@link title} is a textual
|
|
46
|
+
* approximation. Callers can use this flag to avoid asserting against the
|
|
47
|
+
* value.
|
|
48
|
+
*/
|
|
49
|
+
readonly titleIsTemplate?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Bare PascalCase model name for `fixture` nodes (e.g. `Country`).
|
|
52
|
+
* `undefined` when the prefix could not be resolved.
|
|
53
|
+
*/
|
|
54
|
+
readonly model?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The variable name bound by the fixture's callback parameter
|
|
57
|
+
* (e.g. `(rc) => ...` → `rc`). Only populated for `fixture` nodes.
|
|
58
|
+
*/
|
|
59
|
+
readonly varName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Identifier names that appear as values in the fixture's first-arg object
|
|
62
|
+
* (e.g. `{ f, sg, rd, bgb }` → `['f','sg','rd','bgb']`). These map to
|
|
63
|
+
* parent-fixture variables — the dependency hint that lets callers see
|
|
64
|
+
* which contexts a fixture relies on.
|
|
65
|
+
*/
|
|
66
|
+
readonly parentVars?: readonly string[];
|
|
67
|
+
/**
|
|
68
|
+
* Identifier name for `wrapper` and `helperCall` nodes (the function being
|
|
69
|
+
* called).
|
|
70
|
+
*/
|
|
71
|
+
readonly callee?: string;
|
|
72
|
+
/**
|
|
73
|
+
* 1-based line number of the call expression's first character.
|
|
74
|
+
*/
|
|
75
|
+
readonly line: number;
|
|
76
|
+
/**
|
|
77
|
+
* 1-based line number of the call expression's last character.
|
|
78
|
+
*/
|
|
79
|
+
readonly endLine: number;
|
|
80
|
+
/**
|
|
81
|
+
* Child nodes detected inside this node's callback body. Empty for `it`
|
|
82
|
+
* and `hook` nodes (their body is leaf code).
|
|
83
|
+
*/
|
|
84
|
+
readonly children: readonly SpecNode[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* One locally-defined helper function that emits `describe`/`it` calls when
|
|
88
|
+
* invoked. Detected by walking top-level function declarations and
|
|
89
|
+
* arrow-function constants.
|
|
90
|
+
*/
|
|
91
|
+
export interface HelperDescribe {
|
|
92
|
+
readonly name: string;
|
|
93
|
+
readonly line: number;
|
|
94
|
+
readonly endLine: number;
|
|
95
|
+
readonly emitsDescribe: boolean;
|
|
96
|
+
readonly emitsIt: boolean;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* How the workspace prefix used to detect fixture functions was obtained.
|
|
100
|
+
*
|
|
101
|
+
* - `apiDir` — caller supplied an `apiDir` and the prefix came from
|
|
102
|
+
* `inspectAppFixtures()` against `<apiDir>/src/test/fixture.ts`.
|
|
103
|
+
* - `imports` — extracted from the spec file's own import statements
|
|
104
|
+
* (named imports off `**\/test/fixture`).
|
|
105
|
+
* - `unknown` — neither source resolved a prefix; fixture nodes are still
|
|
106
|
+
* detected via the `*Context$` suffix heuristic but `model` may be empty.
|
|
107
|
+
*/
|
|
108
|
+
export type PrefixSource = 'apiDir' | 'imports' | 'unknown';
|
|
109
|
+
/**
|
|
110
|
+
* Aggregate result returned by the extractor.
|
|
111
|
+
*
|
|
112
|
+
* The `root` node always has kind `wrapper` and represents the spec file
|
|
113
|
+
* itself; its children are the top-level statements of the file.
|
|
114
|
+
*/
|
|
115
|
+
export interface SpecFileTree {
|
|
116
|
+
readonly specPath: string;
|
|
117
|
+
readonly prefix?: string;
|
|
118
|
+
readonly prefixSource: PrefixSource;
|
|
119
|
+
readonly knownFixtureNames: readonly string[];
|
|
120
|
+
readonly root: SpecNode;
|
|
121
|
+
readonly helpers: readonly HelperDescribe[];
|
|
122
|
+
readonly fixtureCallsCount: number;
|
|
123
|
+
readonly itCount: number;
|
|
124
|
+
readonly describeCount: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* View modes accepted by `dbx_model_test_tree`.
|
|
128
|
+
*/
|
|
129
|
+
export type SpecTreeView = 'all' | 'describes' | 'fixtures' | 'its' | 'helpers';
|
|
130
|
+
/**
|
|
131
|
+
* Optional filters accepted by `dbx_model_test_tree`.
|
|
132
|
+
*/
|
|
133
|
+
export interface SpecTreeFilters {
|
|
134
|
+
readonly filterByModel?: string;
|
|
135
|
+
readonly filterByDescribePath?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* One mutually-exclusive query accepted by `dbx_model_test_search`.
|
|
139
|
+
*/
|
|
140
|
+
export type SpecSearchQuery = {
|
|
141
|
+
readonly mode: 'model';
|
|
142
|
+
readonly value: string;
|
|
143
|
+
} | {
|
|
144
|
+
readonly mode: 'chain';
|
|
145
|
+
readonly value: string;
|
|
146
|
+
} | {
|
|
147
|
+
readonly mode: 'describe';
|
|
148
|
+
readonly value: string;
|
|
149
|
+
} | {
|
|
150
|
+
readonly mode: 'it';
|
|
151
|
+
readonly value: string;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* One match returned by the search tool.
|
|
155
|
+
*
|
|
156
|
+
* `describePath` lists the describe titles from the spec root down to the
|
|
157
|
+
* matched node (excluding the matched describe's own title).
|
|
158
|
+
*
|
|
159
|
+
* `fixtureChain` lists the model names of every `fixture` ancestor from
|
|
160
|
+
* the spec root down to the matched node — i.e. the data-setup chain that
|
|
161
|
+
* a test sitting at this position would inherit.
|
|
162
|
+
*/
|
|
163
|
+
export interface SpecSearchHit {
|
|
164
|
+
readonly kind: SpecNodeKind;
|
|
165
|
+
readonly title?: string;
|
|
166
|
+
readonly model?: string;
|
|
167
|
+
readonly callee?: string;
|
|
168
|
+
readonly line: number;
|
|
169
|
+
readonly endLine: number;
|
|
170
|
+
readonly describePath: readonly string[];
|
|
171
|
+
readonly fixtureChain: readonly string[];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Result returned by `searchSpecTree()`.
|
|
175
|
+
*/
|
|
176
|
+
export interface SpecSearchResult {
|
|
177
|
+
readonly query: SpecSearchQuery;
|
|
178
|
+
readonly hits: readonly SpecSearchHit[];
|
|
179
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.40.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
"./eslint": {
|
|
16
|
-
"module": "./eslint/index.esm.js",
|
|
17
16
|
"types": "./eslint/index.d.ts",
|
|
18
|
-
"import": "./eslint/index.
|
|
19
|
-
"default": "./eslint/index.
|
|
17
|
+
"import": "./eslint/index.esm.js",
|
|
18
|
+
"default": "./eslint/index.esm.js"
|
|
20
19
|
},
|
|
21
20
|
"./firebase-api-manifest": {
|
|
22
21
|
"default": "./firebase-api-manifest/main.js"
|
|
@@ -37,44 +36,41 @@
|
|
|
37
36
|
"default": "./lint-cache/main.js"
|
|
38
37
|
},
|
|
39
38
|
"./manifest-extract": {
|
|
40
|
-
"module": "./manifest-extract/index.esm.js",
|
|
41
39
|
"types": "./manifest-extract/index.d.ts",
|
|
42
|
-
"import": "./manifest-extract/index.
|
|
43
|
-
"default": "./manifest-extract/index.
|
|
40
|
+
"import": "./manifest-extract/index.esm.js",
|
|
41
|
+
"default": "./manifest-extract/index.esm.js"
|
|
44
42
|
},
|
|
45
43
|
"./model-test": {
|
|
46
|
-
"module": "./model-test/index.esm.js",
|
|
47
44
|
"types": "./model-test/index.d.ts",
|
|
48
|
-
"import": "./model-test/index.
|
|
49
|
-
"default": "./model-test/index.
|
|
45
|
+
"import": "./model-test/index.esm.js",
|
|
46
|
+
"default": "./model-test/index.esm.js"
|
|
50
47
|
},
|
|
51
48
|
"./route": {
|
|
52
|
-
"module": "./route/index.esm.js",
|
|
53
49
|
"types": "./route/index.d.ts",
|
|
54
50
|
"import": "./route/index.esm.js",
|
|
55
|
-
"default": "./route/index.
|
|
51
|
+
"default": "./route/index.esm.js"
|
|
56
52
|
},
|
|
57
53
|
"./test": {
|
|
58
|
-
"module": "./test/index.esm.js",
|
|
59
54
|
"types": "./test/index.d.ts",
|
|
60
|
-
"import": "./test/index.
|
|
61
|
-
"default": "./test/index.
|
|
55
|
+
"import": "./test/index.esm.js",
|
|
56
|
+
"default": "./test/index.esm.js"
|
|
62
57
|
},
|
|
63
58
|
"./validate": {
|
|
64
59
|
"default": "./validate/index.js"
|
|
65
60
|
},
|
|
66
61
|
"./package.json": "./package.json",
|
|
67
62
|
".": {
|
|
63
|
+
"types": "./index.d.ts",
|
|
68
64
|
"import": "./index.esm.js",
|
|
69
|
-
"
|
|
65
|
+
"default": "./index.esm.js"
|
|
70
66
|
}
|
|
71
67
|
},
|
|
72
68
|
"peerDependencies": {
|
|
73
|
-
"@dereekb/date": "13.
|
|
74
|
-
"@dereekb/firebase": "13.
|
|
75
|
-
"@dereekb/model": "13.
|
|
76
|
-
"@dereekb/nestjs": "13.
|
|
77
|
-
"@dereekb/util": "13.
|
|
69
|
+
"@dereekb/date": "13.40.0",
|
|
70
|
+
"@dereekb/firebase": "13.40.0",
|
|
71
|
+
"@dereekb/model": "13.40.0",
|
|
72
|
+
"@dereekb/nestjs": "13.40.0",
|
|
73
|
+
"@dereekb/util": "13.40.0",
|
|
78
74
|
"@nestjs/common": "^11.1.19",
|
|
79
75
|
"arktype": "^2.2.0",
|
|
80
76
|
"firebase": "^12.12.1",
|
|
@@ -92,4 +88,4 @@
|
|
|
92
88
|
"module": "./index.esm.js",
|
|
93
89
|
"main": "./index.esm.js",
|
|
94
90
|
"types": "./index.d.ts"
|
|
95
|
-
}
|
|
91
|
+
}
|
package/route/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/route",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.40.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"sideEffects": false,
|
|
5
6
|
"peerDependencies": {
|
|
6
|
-
"@dereekb/date": "13.
|
|
7
|
-
"@dereekb/dbx-cli": "13.
|
|
8
|
-
"@dereekb/firebase": "13.
|
|
9
|
-
"@dereekb/model": "13.
|
|
10
|
-
"@dereekb/nestjs": "13.
|
|
11
|
-
"@dereekb/util": "13.
|
|
7
|
+
"@dereekb/date": "13.40.0",
|
|
8
|
+
"@dereekb/dbx-cli": "13.40.0",
|
|
9
|
+
"@dereekb/firebase": "13.40.0",
|
|
10
|
+
"@dereekb/model": "13.40.0",
|
|
11
|
+
"@dereekb/nestjs": "13.40.0",
|
|
12
|
+
"@dereekb/util": "13.40.0"
|
|
12
13
|
},
|
|
13
14
|
"exports": {
|
|
14
15
|
"./package.json": "./package.json",
|
|
15
16
|
".": {
|
|
16
|
-
"module": "./index.esm.js",
|
|
17
17
|
"types": "./index.d.ts",
|
|
18
|
-
"import": "./index.
|
|
19
|
-
"default": "./index.
|
|
18
|
+
"import": "./index.esm.js",
|
|
19
|
+
"default": "./index.esm.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"module": "./index.esm.js",
|
|
23
|
-
"main": "./index.
|
|
23
|
+
"main": "./index.esm.js",
|
|
24
24
|
"types": "./index.d.ts"
|
|
25
|
-
}
|
|
25
|
+
}
|