Skip to content

Commit d5b9fab

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 d5b9fab

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,16 @@ 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
63+
mockContext.extension.outputPath = '/test/./extension/dist/handle.js'
64+
vi.mocked(buildExtension.buildUIExtension).mockResolvedValue('/test/extension/dist/handle.js')
65+
66+
// When
67+
await executeBundleUIStep(step, mockContext)
68+
69+
// Then
70+
expect(fs.copyFile).not.toHaveBeenCalled()
71+
})
6072
})

0 commit comments

Comments
 (0)