Skip to content

Commit 40eb697

Browse files
committed
More test fixes
1 parent bf92eb4 commit 40eb697

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

src/commands/manifest/cmd-manifest-conda.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async function run(
158158
test: cli.input.length <= 1,
159159
message: 'Can only accept one DIR (make sure to escape spaces!)',
160160
pass: 'ok',
161-
fail: 'received ' + cli.input.length,
161+
fail: `received ${cli.input.length}`,
162162
},
163163
{
164164
nook: true,

src/utils/check-input.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import colors from 'yoctocolors-cjs'
22

33
import { logger } from '@socketsecurity/registry/lib/logger'
4+
import { stripAnsi } from '@socketsecurity/registry/lib/strings'
45

56
import { failMsgWithBadge } from './fail-msg-with-badge.mts'
67
import { serializeResultJson } from './serialize-result-json.mts'
@@ -53,7 +54,7 @@ export function checkCommandInput(
5354
serializeResultJson({
5455
ok: false,
5556
message: 'Input error',
56-
data: msg.join('\n'),
57+
data: stripAnsi(msg.join('\n')),
5758
}),
5859
)
5960
} else {

src/utils/serialize-result-json.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function serializeResultJson(data: CResult<unknown>): string {
1414
debugFn('inspect', 'data:\n', data)
1515
}
1616

17-
// We should not allow the json value to be "null", or a boolean/number/string,
17+
// We should not allow the JSON value to be "null", or a boolean/number/string,
1818
// even if they are valid "json".
1919
const message =
2020
'There was a problem converting the data set to JSON. The JSON was not an object. Please try again without --json'

test/utils.mts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,23 @@ export async function invokeNpm(
6464
return {
6565
status: true,
6666
code: 0,
67-
stdout: toAsciiSafeString(normalizeLogSymbols(stripAnsi(output.stdout.trim()))),
68-
stderr: toAsciiSafeString(normalizeLogSymbols(stripAnsi(output.stderr.trim()))),
67+
stdout: toAsciiSafeString(
68+
normalizeLogSymbols(stripAnsi(output.stdout.trim())),
69+
),
70+
stderr: toAsciiSafeString(
71+
normalizeLogSymbols(stripAnsi(output.stderr.trim())),
72+
),
6973
}
7074
} catch (e: unknown) {
7175
return {
7276
status: false,
7377
code: e?.['code'],
74-
stdout: toAsciiSafeString(normalizeLogSymbols(stripAnsi(e?.['stdout']?.trim() ?? ''))),
75-
stderr: toAsciiSafeString(normalizeLogSymbols(stripAnsi(e?.['stderr']?.trim() ?? ''))),
78+
stdout: toAsciiSafeString(
79+
normalizeLogSymbols(stripAnsi(e?.['stdout']?.trim() ?? '')),
80+
),
81+
stderr: toAsciiSafeString(
82+
normalizeLogSymbols(stripAnsi(e?.['stderr']?.trim() ?? '')),
83+
),
7684
}
7785
}
7886
}

0 commit comments

Comments
 (0)