@activate-core/test-forge 0.19.2 → 0.19.3

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.
@@ -92,11 +92,18 @@ export function buildDiscoverPrompt(srcDir, docsDir, journey) {
92
92
  ` and the key fields/enum values a test would need to`,
93
93
  ` seed or verify (use the data layer from the map)`,
94
94
  ``,
95
+ `Also add "Test setup" and "Questions for product (not asserted)" last,`,
96
+ `as described above.`,
97
+ ``,
95
98
  `Rules:`,
96
99
  `- Base everything on real evidence in the code and the map. Do not`,
97
100
  ` invent routes, fields, or behavior with false confidence.`,
98
- `- Where you are unsure, add a line starting with "# TODO:"`,
99
- ` describing what the developer must verify.`,
101
+ `- With no external reference, the code is the source: behaviour the`,
102
+ ` code clearly and deliberately implements is [spec]. Still add the`,
103
+ ` full [baseline] scenarios for every field, control and action.`,
104
+ `- Never write a "# TODO" line: what the tests need goes in "Test`,
105
+ ` setup", what only product can decide goes in "Questions for product`,
106
+ ` (not asserted)".`,
100
107
  `- For the Data section, never include secrets — refer to env var`,
101
108
  ` names only (as in the map).`,
102
109
  `- Capture real risks you notice (e.g. a charge that could happen`,
@@ -5,11 +5,28 @@
5
5
  * depth is the ceiling on test quality. This wording is shared by both
6
6
  * discover prompts (code-based and reference-based) so a doc is deep and
7
7
  * well-sectioned regardless of where it is drafted from.
8
+ *
9
+ * A source (a client spec, a ticket) describes a journey in a few lines;
10
+ * the doc must turn that into EVERY scenario a QA engineer would test. So
11
+ * each criterion carries a tier saying where it came from, and a failing
12
+ * test is reported under that tier:
13
+ * [spec] — the source states it. A failure is a defect against the spec.
14
+ * [baseline] — universal robustness every well-built app owes, added for
15
+ * every field, control and action even when the source is
16
+ * silent. Robustness only, never product policy.
17
+ * [observed] — the source is silent but the code fixes a concrete rule;
18
+ * tested for consistency across layers, not as the spec.
19
+ * Nothing becomes a "# TODO": what only product can decide is a question,
20
+ * what the test environment needs is test setup.
8
21
  */
9
22
  export const DEEP_DOC_GUIDANCE = [
10
23
  `Make each doc DEEP and exhaustive — the generated tests can only be as`,
11
- `good as this doc, so do NOT stop at a thin outline. For the journey,`,
12
- `document, where they apply:`,
24
+ `good as this doc, so do NOT stop at a thin outline. A source usually`,
25
+ `describes a journey in a few lines ("the user enters a username and a`,
26
+ `password"); YOUR job is to expand it into every scenario a senior QA`,
27
+ `engineer would test: the happy path, every validation of every field,`,
28
+ `every state of every control, every failure and edge case. For the`,
29
+ `journey, document, where they apply:`,
13
30
  `- every distinct sub-flow and lifecycle STATE it can be in, and the`,
14
31
  ` transitions between them (not just the happy path);`,
15
32
  `- each endpoint/screen involved, with real inputs, outputs, status`,
@@ -20,14 +37,69 @@ export const DEEP_DOC_GUIDANCE = [
20
37
  ` vague mentions;`,
21
38
  `- concrete acceptance criteria per case (exactly what must hold).`,
22
39
  `Aim for the depth of a spec a new engineer could implement from.`,
23
- `Every acceptance criterion you write becomes an ORACLE — tests are`,
24
- `generated from it, and a product that disagrees is reported to the team`,
25
- `as a defect. So state a criterion ONLY where the source actually fixes`,
26
- `the behaviour. Anything you merely believe SHOULD hold goes under a`,
27
- `"Suggested (not a requirement — do not assert)" heading, never into the`,
28
- `acceptance criteria: an invented requirement becomes a false bug report.`,
40
+ ``,
41
+ `TIERS. Every acceptance criterion becomes an ORACLE: a test is generated`,
42
+ `from it, and a product that disagrees is reported. So start EVERY`,
43
+ `criterion with its tier, which says where it comes from and how a`,
44
+ `failure is reported:`,
45
+ `- "[spec]" — the source states this behaviour. A failure is a defect`,
46
+ ` against the spec.`,
47
+ `- "[baseline]" — universal robustness that holds for ANY well-built app.`,
48
+ ` Add these YOURSELF for every field, control and action the journey`,
49
+ ` has, even when the source says nothing about them:`,
50
+ ` * Inputs: empty and whitespace-only values; leading/trailing spaces;`,
51
+ ` a very long value (5,000 characters); unicode and emoji; an HTML or`,
52
+ ` script payload. The app never crashes, never answers with a server`,
53
+ ` error (5xx), never executes the payload (it is shown as text), and`,
54
+ ` either accepts the value or rejects it with a visible reason.`,
55
+ ` * No silent failure: every rejected submit shows a visible reason; a`,
56
+ ` server error, network failure or timeout shows a visible message`,
57
+ ` and leaves the form usable.`,
58
+ ` * Double submission: a double click or a repeated Enter sends at most`,
59
+ ` one request with a side effect (one record, one charge, one`,
60
+ ` message); the control is disabled or ignored while a request is`,
61
+ ` pending.`,
62
+ ` * Keyboard: the form can be filled and submitted with the keyboard`,
63
+ ` alone; Enter submits.`,
64
+ ` * Navigation: refresh, Back, and opening a mid-flow URL directly never`,
65
+ ` crash or leave a blank, broken page.`,
66
+ ` * Sensitive data: passwords are masked; passwords and tokens never`,
67
+ ` appear in a URL or query string.`,
68
+ ` * Access: a page or action that needs a login is not usable logged`,
69
+ ` out; one user never sees another user's data.`,
70
+ ` * Choice controls (dropdown, radio, checkbox, list): every option`,
71
+ ` shown can be selected and submitted.`,
72
+ ` [baseline] is ROBUSTNESS only. Never present product POLICY you`,
73
+ ` invented (a maximum length, a password rule, an error wording, a`,
74
+ ` limit) as [baseline].`,
75
+ `- "[observed]" — the source is silent, but the code fixes a concrete`,
76
+ ` rule: a validation pattern, a length limit, allowed values, the`,
77
+ ` options a list offers, a rate limit, a timeout. State the rule with`,
78
+ ` its real value, use it to build valid data and boundary cases (just`,
79
+ ` inside and just outside), and require every layer to enforce it the`,
80
+ ` same way (the screen accepts exactly what the server accepts). A`,
81
+ ` failure is an inconsistency, not a spec defect. Never use [observed]`,
82
+ ` to override or soften a [spec] criterion.`,
83
+ ``,
84
+ `TEST DATA. Tests fill data themselves. Never ask for an exact value:`,
85
+ `valid data comes from the stated or [observed] rules; invalid data`,
86
+ `breaks one rule at a time; a choice control is filled with an option`,
87
+ `the screen actually offers at run time, never a hard-coded one.`,
88
+ ``,
89
+ `NO TODOs. Never write a "# TODO" line or leave a placeholder. Instead:`,
90
+ `- What the test environment must provide — accounts and records to`,
91
+ ` seed, settings or flags that must be on, external services to stub`,
92
+ ` (SMS/OTP, payments, OAuth, email) and the endpoint or SDK to stub,`,
93
+ ` browser dialogs to handle — goes in a "## Test setup" section, written`,
94
+ ` as instructions for the test generator.`,
95
+ `- What only product can decide, and neither the source nor the code`,
96
+ ` fixes, goes in a "## Questions for product (not asserted)" section.`,
97
+ ` Keep it short: a question is a last resort, after [spec], [baseline]`,
98
+ ` and [observed] have been used.`,
99
+ ``,
29
100
  `Organise the body with numbered "## N. <Section>" headings, ONE`,
30
101
  `concern per section, because each section later becomes its own`,
31
102
  `focused test file — so the richer and better-separated the sections,`,
32
- `the better the test suite.`,
103
+ `the better the test suite. Put "## Test setup" and "## Questions for`,
104
+ `product (not asserted)" last, without numbers.`,
33
105
  ].join('\n');
@@ -115,10 +115,11 @@ export function buildReferenceDiscoverPrompt(srcDir, docsDir, reference, journey
115
115
  `it describes. The comparison you need is already in "${DIFF_PATH}".`,
116
116
  ``,
117
117
  `Use the project map at "${MAP_PATH}" and the source under "${srcDir}"`,
118
- `ONLY for TECHNICAL detail the reference does not spell out: routes,`,
119
- `field names, models/collections, enums, and env var names. NEVER take`,
120
- `expected behavior, acceptance criteria, or negative cases from the`,
121
- `code — those come from the reference.`,
118
+ `for TECHNICAL detail the reference does not spell out (routes, field`,
119
+ `names, models/collections, enums, env var names), for the concrete`,
120
+ `rules behind [observed] criteria, and for what the Test setup needs.`,
121
+ `NEVER take a [spec] criterion from the code — [spec] comes only from`,
122
+ `the reference.`,
122
123
  ``,
123
124
  `For EACH journey the reference describes, create one markdown file at`,
124
125
  `"${docsDir}/<area>/<journey>.md" (area = folder such as api/web/ops,`,
@@ -137,10 +138,9 @@ export function buildReferenceDiscoverPrompt(srcDir, docsDir, reference, journey
137
138
  ``,
138
139
  ]
139
140
  : [
140
- `Also create a doc for any journey that exists in the map but NOT in`,
141
- `the reference, drafted from the map, and add a line`,
142
- `"# TODO: not covered by the reference — confirm expected behavior"`,
143
- `at its top so it is clearly flagged.`,
141
+ `Create docs ONLY for journeys the reference describes. A journey`,
142
+ `that is in the map but not in the reference gets no file; name it`,
143
+ `in your final summary as "not covered by this reference".`,
144
144
  ``,
145
145
  ]),
146
146
  `Each file starts with this header (required):`,
@@ -155,25 +155,25 @@ export function buildReferenceDiscoverPrompt(srcDir, docsDir, reference, journey
155
155
  `- security (add more if relevant: performance, accessibility, ...)`,
156
156
  ``,
157
157
  `Then whichever of these sections apply: Fields, Actions, Expected,`,
158
- `Negative Cases, Race Conditions, Webhooks, Security Notes, Data. The`,
159
- `Expected / Negative Cases / acceptance criteria MUST reflect the`,
160
- `reference. For the Data section use the map's data layer.`,
158
+ `Negative Cases, Race Conditions, Webhooks, Security Notes, Data, and`,
159
+ `last "Test setup" and "Questions for product (not asserted)". For the`,
160
+ `Data section use the map's data layer.`,
161
161
  ``,
162
162
  `Rules:`,
163
- `- Base behavior on the reference and technical detail on real code;`,
164
- ` do not invent either with false confidence.`,
165
- `- EVERY requirement you write becomes an ORACLE: tests will be`,
166
- ` generated from it, and a product that disagrees will be reported to`,
167
- ` the team as a defect. So write a requirement ONLY when the reference`,
168
- ` actually states it. Do NOT add hardening, validation, limits, or`,
169
- ` guards that the reference does not ask for, however sensible they`,
170
- ` seem — an invented requirement becomes a false bug report and costs`,
171
- ` the team a release.`,
172
- `- When you believe something SHOULD hold but the reference does not say`,
173
- ` so, put it under a "Suggested (not a requirement — do not assert)"`,
174
- ` heading, never in Expected / Negative Cases / acceptance criteria.`,
175
- `- Where the reference is silent on a needed detail, add a "# TODO:"`,
176
- ` line describing what the developer must verify.`,
163
+ `- Tag every criterion [spec], [baseline] or [observed] as described`,
164
+ ` above. [spec] only where the reference states the behaviour; never`,
165
+ ` present your own idea of product policy as [spec].`,
166
+ `- Expand the reference: a field, control or action it mentions gets`,
167
+ ` its full [baseline] scenarios and, where the code fixes a rule, its`,
168
+ ` [observed] scenarios, even when the reference names it in passing.`,
169
+ `- When the code seems to behave differently from a [spec] criterion,`,
170
+ ` keep the criterion exactly as the reference states it — the test`,
171
+ ` will report the difference — and add a line "Likely defect: <what`,
172
+ ` the code does>" under it. Never turn it into a question.`,
173
+ `- Base technical detail on real code; do not invent it with false`,
174
+ ` confidence.`,
175
+ `- No "# TODO" lines and no "Suggested" section: use "Test setup" and`,
176
+ ` "Questions for product (not asserted)" as described above.`,
177
177
  `- Never include secrets — refer to env var names only.`,
178
178
  `- Create the area subfolders as needed. Write NOTHING at the root of`,
179
179
  ` "${docsDir}" and no file that is not a journey doc — a shared note`,
@@ -130,8 +130,11 @@ export function buildPrompt(journey, map, testPath, focus, harnessPath, transpor
130
130
  ` than the prose. Only after checking those is it genuinely unstated.`,
131
131
  ` An assertion you cannot trace to a stated requirement is a false`,
132
132
  ` positive waiting to happen. Anything under a "Suggested (not a`,
133
- ` requirement…)" heading is explicitly NOT an oracle — never assert`,
134
- ` it; make it ${pending} if you cover it at all.`,
133
+ ` requirement…)" or "Questions for product (not asserted)" heading is`,
134
+ ` explicitly NOT an oracle — never assert it; make it ${pending} if you`,
135
+ ` cover it at all. Criteria tagged [spec], [baseline] or [observed]`,
136
+ ` ARE stated oracles. The "Test setup" section says how to establish`,
137
+ ` preconditions (seeds, settings, stubs, dialogs) — follow it.`,
135
138
  `(2) INFRASTRUCTURE IS NEVER A PRODUCT DEFECT. If a precondition cannot`,
136
139
  ` be established — a dependency is unreachable, a required env var or`,
137
140
  ` credential is absent, seed/fixture data is missing, a second`,
@@ -40,6 +40,9 @@ function buildPlanPrompt(journey, map) {
40
40
  ` refunds) may need many. Do not pad, do not over-split, do not force`,
41
41
  ` a fixed number.`,
42
42
  `- Each file covers ONE concern and must be independently meaningful.`,
43
+ `- "## Test setup" is what every file needs to run, not a behaviour, and`,
44
+ ` "## Questions for product (not asserted)" is not tested: plan no file`,
45
+ ` for either.`,
43
46
  ``,
44
47
  `Output ONLY a JSON array (no prose, no markdown fences) of objects:`,
45
48
  ` [{ "slug": "<short-kebab-name>", "title": "<describe title>",`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activate-core/test-forge",
3
- "version": "0.19.2",
3
+ "version": "0.19.3",
4
4
  "description": "AI-powered QA automation. Scans a project, drafts journey docs, and generates seeded Jest/Playwright tests. Works in any project, with any AI CLI.",
5
5
  "type": "module",
6
6
  "bin": {