Skip to content

Commit 4eaa1e5

Browse files
committed
Fix tests on Windows
1 parent 12352ae commit 4eaa1e5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.config/rollup.dist.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
fetchPackageManifest,
2222
readPackageJson,
2323
} from '@socketsecurity/registry/lib/packages'
24+
import { normalizePath } from '@socketsecurity/registry/lib/path'
2425
import { escapeRegExp } from '@socketsecurity/registry/lib/regexps'
2526
import { naturalCompare } from '@socketsecurity/registry/lib/sorts'
2627

@@ -397,7 +398,8 @@ export default async () => {
397398
case shadowNpmInjectSrcPath:
398399
return SHADOW_NPM_INJECT
399400
default:
400-
if (id.startsWith(utilsSrcPath)) {
401+
console.log({ id, utilsSrcPath: normalizePath(utilsSrcPath) })
402+
if (id.startsWith(normalizePath(utilsSrcPath))) {
401403
return UTILS
402404
}
403405
if (id.includes(SLASH_NODE_MODULES_SLASH)) {

test/utils.mts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ export async function invokeNpm(
4141
args: string[],
4242
env = {},
4343
): Promise<{
44-
status: boolean
4544
code: number
45+
error?: {
46+
message: string
47+
stack: string
48+
}
49+
status: boolean
4650
stdout: string
4751
stderr: string
4852
}> {
@@ -74,7 +78,11 @@ export async function invokeNpm(
7478
} catch (e: unknown) {
7579
return {
7680
status: false,
77-
code: e?.['code'],
81+
code: e?.['code'] || 1,
82+
error: {
83+
message: e?.['message'] || '',
84+
stack: e?.['stack'] || '',
85+
},
7886
stdout: toAsciiSafeString(
7987
normalizeLogSymbols(stripAnsi(e?.['stdout']?.trim() ?? '')),
8088
),

0 commit comments

Comments
 (0)