testronaut 2.1.4 → 2.1.6

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/core/redaction.js CHANGED
@@ -153,6 +153,10 @@ export function redactArgs(fnName, args = {}, { showLength = true } = {}) {
153
153
  return out;
154
154
  }
155
155
 
156
+ if (fnName === 'prepare_dialog_response' && 'input' in out) {
157
+ out.input = maskPreview(out.input, showLength);
158
+ }
159
+
156
160
  // Mask direct props with sensitive-looking keys
157
161
  for (const k of Object.keys(out || {})) {
158
162
  if (hasSensitiveHint(k)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testronaut",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "main": "./runner/testronaut.js",
5
5
  "bin": {
6
6
  "testronaut": "bin/cli.js"
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "type": "module",
14
14
  "engines": {
15
- "node": ">=20.17.0"
15
+ "node": ">=20.18.1"
16
16
  },
17
17
  "scripts": {
18
18
  "benchmark:optimization": "node ./experiments/optimizationBenchmark.js",
@@ -83,6 +83,15 @@ describe('redaction utilities', () => {
83
83
  expect(redacted.value).toBe('•••••• (6)');
84
84
  expect(redacted.code).toBe('•••••• (6)');
85
85
  });
86
+
87
+ it('masks prompt input prepared for a JavaScript dialog', () => {
88
+ const redacted = redactArgs('prepare_dialog_response', {
89
+ type: 'prompt', action: 'accept', input: 'private answer', message: 'Name?',
90
+ });
91
+ expect(redacted).toEqual({
92
+ type: 'prompt', action: 'accept', input: '•••••• (14)', message: 'Name?',
93
+ });
94
+ });
86
95
  });
87
96
 
88
97
  describe('redactPasswordInText', () => {
@@ -187,7 +187,7 @@ describe('turnLoop', () => {
187
187
  event: 'javascript_dialog',
188
188
  type: 'confirm',
189
189
  message: 'Emergency meeting! Attend?',
190
- defaultValue: '',
190
+ defaultValueProvided: false,
191
191
  pageUrl: 'https://example.test/dashboard',
192
192
  matched: true,
193
193
  expected: true,
@@ -21,11 +21,21 @@ describe('runtime dependency compatibility', () => {
21
21
 
22
22
  it('declares the minimum Node runtime required by Inquirer 14', () => {
23
23
  const inquirer = lock.packages['node_modules/inquirer'];
24
- expect(pkg.engines.node).toBe('>=20.17.0');
24
+ expect(pkg.engines.node).toBe('>=20.18.1');
25
25
  expect(lock.packages[''].engines.node).toBe(pkg.engines.node);
26
26
  expect(pkg.dependencies.inquirer).toBe('^14.2.2');
27
27
  expect(lock.packages[''].dependencies.inquirer).toBe(pkg.dependencies.inquirer);
28
28
  expect(inquirer.version).toBe('14.2.2');
29
29
  expect(inquirer.engines.node).toContain('^20.17.0');
30
30
  });
31
+
32
+ it('pins the patched Undici release and its minimum Node runtime', () => {
33
+ const cheerio = lock.packages['node_modules/cheerio'];
34
+ const undici = lock.packages['node_modules/undici'];
35
+
36
+ expect(cheerio.dependencies.undici).toBe('^7.19.0');
37
+ expect(undici.version).toBe('7.30.2');
38
+ expect(undici.engines.node).toBe('>=20.18.1');
39
+ expect(pkg.engines.node).toBe(undici.engines.node);
40
+ });
31
41
  });
@@ -50,6 +50,8 @@ describe('ChromeBrowser JavaScript dialogs', () => {
50
50
  matched: true,
51
51
  outcome: action,
52
52
  });
53
+ expect(event).not.toHaveProperty('defaultValue');
54
+ expect(event.defaultValueProvided).toBe(Boolean(input));
53
55
  });
54
56
 
55
57
  it('dismisses and reports an unexpected dialog while retaining a nonmatching rule', async () => {
@@ -176,7 +176,7 @@ describe('generateHtmlReport', () => {
176
176
  event: 'javascript_dialog',
177
177
  type: 'prompt',
178
178
  message: 'Name the suspicious crewmate:',
179
- defaultValue: 'Red',
179
+ defaultValueProvided: true,
180
180
  inputProvided: true,
181
181
  action: 'accept',
182
182
  matched: true,
@@ -163,7 +163,9 @@ export class ChromeBrowser {
163
163
  event: 'javascript_dialog',
164
164
  type,
165
165
  message,
166
- defaultValue: dialog.defaultValue(),
166
+ // Prompt defaults can contain user or application secrets. Reports only
167
+ // need to know whether one existed, never its raw value.
168
+ defaultValueProvided: Boolean(dialog.defaultValue()),
167
169
  pageUrl: page?.url?.() || null,
168
170
  appearedAt: new Date(now).toISOString(),
169
171
  ruleId: rule?.id || null,
@@ -140,7 +140,7 @@ export function generateHtmlReport(report, outputPath) {
140
140
  <div class="dialog-window">
141
141
  <div class="dialog-title"><span class="dialog-icon">!</span><strong>Browser-native ${esc(type)}</strong></div>
142
142
  <div class="dialog-message">${esc(dialog.message || '(browser supplied no message)')}</div>
143
- ${type === 'prompt' ? `<div class="dialog-input">${dialog.inputProvided ? '•••••••• · input provided' : esc(dialog.defaultValue || 'No input provided')}</div>` : ''}
143
+ ${type === 'prompt' ? `<div class="dialog-input">${dialog.inputProvided ? '•••••••• · input provided' : dialog.defaultValueProvided ? '•••••••• · default value present' : 'No input provided'}</div>` : ''}
144
144
  <div class="dialog-actions">
145
145
  <span class="dialog-button ${accepted ? 'chosen' : ''}">${esc(acceptLabel)}</span>
146
146
  <span class="dialog-button ${!accepted ? 'chosen' : ''}">${esc(dismissLabel)}</span>