Ensure that copied extensions are writable in the user's local directory (#23016)

This commit is contained in:
kevinjwang1
2026-03-19 15:22:08 -07:00
committed by GitHub
parent 98d1bec99f
commit 0e66f545ca
4 changed files with 170 additions and 0 deletions

View File

@@ -36,6 +36,8 @@ vi.mock('node:fs', async (importOriginal) => {
rm: vi.fn(),
cp: vi.fn(),
readFile: vi.fn(),
lstat: vi.fn(),
chmod: vi.fn(),
},
};
});
@@ -143,6 +145,11 @@ describe('extensionUpdates', () => {
vi.mocked(fs.promises.rm).mockResolvedValue(undefined);
vi.mocked(fs.promises.cp).mockResolvedValue(undefined);
vi.mocked(fs.promises.readdir).mockResolvedValue([]);
vi.mocked(fs.promises.lstat).mockResolvedValue({
isDirectory: () => true,
mode: 0o755,
} as unknown as fs.Stats);
vi.mocked(fs.promises.chmod).mockResolvedValue(undefined);
vi.mocked(isWorkspaceTrusted).mockReturnValue({
isTrusted: true,
source: 'file',