Skip to content

Commit 69fa7e0

Browse files
vctrchuclaude
andcommitted
Add regression test for non-canonical path shapes
Extends the same-path guard coverage with a case where localOutputDir and bundleOutputDir are string-distinct but resolve to the same directory (`/test/extension/dist` vs `/test/./extension/dist`). This is the actual shape that triggered the original fs-extra "Source and destination must not be the same" failure in the field — the existing identical-strings test did not catch it because both the old and new guard handle the trivial case. Verified that this test fails against the pre-fix guard (`copyFile` is called with distinct strings) and passes once the guard normalizes both sides with `resolvePath`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e94c94e commit 69fa7e0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

packages/app/src/cli/services/build/steps/bundle-ui-step.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,19 @@ describe('executeBundleUIStep', () => {
5757
// Then
5858
expect(fs.copyFile).toHaveBeenCalledWith('/test/extension/dist', '/bundle/handle')
5959
})
60+
61+
test('skips the copy when local and bundle output directories resolve to the same path but differ as strings', async () => {
62+
// Given — same directory, non-canonical string shape (`.` segment).
63+
// Without path normalization in the guard, the raw string comparison
64+
// would fail and fs-extra would throw "Source and destination must not
65+
// be the same" on the downstream copy.
66+
mockContext.extension.outputPath = '/test/./extension/dist/handle.js'
67+
vi.mocked(buildExtension.buildUIExtension).mockResolvedValue('/test/extension/dist/handle.js')
68+
69+
// When
70+
await executeBundleUIStep(step, mockContext)
71+
72+
// Then
73+
expect(fs.copyFile).not.toHaveBeenCalled()
74+
})
6075
})

0 commit comments

Comments
 (0)