Skip to content

Commit 9fde241

Browse files
committed
test(devframe): normalize path separators in remote-assets install tests
The installed-package resolution returns pathe (forward-slash) paths, but the tests built the expected distDir with node:path — backslashes on Windows — so the equality assertions failed only on windows-latest. Compare both sides normalized to forward slashes.
1 parent 4fde0ca commit 9fde241

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎packages/devframe/src/utils/remote-assets.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,19 @@ describe('resolveStaticAssetsSource (installed package)', () => {
180180
expect(resolveStaticAssetsSource('/some/dir', makeTmp())).toBe('/some/dir')
181181
})
182182

183+
// `resolveStaticAssetsSource` returns `pathe` (forward-slash) paths; the
184+
// test builds `distDir` with `node:path` (backslash on Windows).
185+
const norm = (p: string): string => p.replace(/\\/g, '/')
186+
183187
it('short-circuits to an exactly matching installed package', () => {
184188
const { resolveFrom, distDir } = install('1.2.3')
185-
expect(resolveStaticAssetsSource({ package: '@scope/demo-client', version: '1.2.3', resolveFrom }, makeTmp())).toBe(distDir)
189+
expect(norm(resolveStaticAssetsSource({ package: '@scope/demo-client', version: '1.2.3', resolveFrom }, makeTmp()) as string)).toBe(norm(distDir))
186190
expect(warnSpy).not.toHaveBeenCalled()
187191
})
188192

189193
it('warns on minor/patch skew and serves the installed copy (DF0062)', () => {
190194
const { resolveFrom, distDir } = install('1.3.0')
191-
expect(resolveStaticAssetsSource({ package: '@scope/demo-client', version: '1.2.3', resolveFrom }, makeTmp())).toBe(distDir)
195+
expect(norm(resolveStaticAssetsSource({ package: '@scope/demo-client', version: '1.2.3', resolveFrom }, makeTmp()) as string)).toBe(norm(distDir))
192196
expect(warnSpy.mock.calls.some(a => String(a[0]).includes('DF0062'))).toBe(true)
193197
})
194198

0 commit comments

Comments
 (0)