Commit 456291f
committed
test(core): cover env-prefix substitution + buildShellExecWarnings dual-check (#4386 R4)
Round-4 test-coverage findings from wenshao:
1. **env-prefix integration test in `shell.test.ts`** (cid 3293075622) —
the `command substitution warning (issue #4093)` describe block in
`shell.test.ts` covered `$()`, backticks, `<()`, `>()`, and the
no-warning case, but had no test for the shape where
`stripShellWrapper` strips the env-prefix + `bash -c` wrapper to
yield a substitution-free inner command (`echo ok`) while the raw
command has substitution in the env assignment
(`FOO=$(cat secret.txt) bash -c 'echo ok'`). This is the exact
shape that exercises the `|| detectCommandSubstitution(rawCommand)`
branch of `buildShellExecWarnings` via integration through
`getConfirmationDetails`. Without this test, removing the `||`
clause wouldn't regress any case here.
2. **`buildShellExecWarnings` unit tests in `shell-utils.test.ts`**
(cid 3293078758 second half) — round 3 extracted
`buildShellExecWarnings` as an exported helper but added no direct
unit test. Added a 5-case describe block covering: no substitution,
stripped-form substitution, the env-prefix dual-check case (with
a sanity-check that the stripped form actually lacks `$(` to make
the dual-check load-bearing), backticks, and process substitution.
These complement the integration tests in shell.test.ts /
monitor.test.ts which exercise the helper through the tool
confirmation paths.
Closes wenshao R4 findings: env-prefix integration test
(cid 3293075622), `buildShellExecWarnings` direct unit coverage
(cid 3293078758 — second half).1 parent a244850 commit 456291f
2 files changed
Lines changed: 73 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5035 | 5035 | | |
5036 | 5036 | | |
5037 | 5037 | | |
| 5038 | + | |
| 5039 | + | |
| 5040 | + | |
| 5041 | + | |
| 5042 | + | |
| 5043 | + | |
| 5044 | + | |
| 5045 | + | |
| 5046 | + | |
| 5047 | + | |
| 5048 | + | |
| 5049 | + | |
| 5050 | + | |
| 5051 | + | |
| 5052 | + | |
| 5053 | + | |
| 5054 | + | |
| 5055 | + | |
| 5056 | + | |
| 5057 | + | |
5038 | 5058 | | |
5039 | 5059 | | |
5040 | 5060 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
1098 | 1100 | | |
1099 | 1101 | | |
1100 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
0 commit comments