Skip to content

Commit 27fab85

Browse files
committed
test: update unit tests for antigravity fallback binary
1 parent d79561a commit 27fab85

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

packages/core/src/utils/editor.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import { execSync, spawn, spawnSync } from 'node:child_process';
2525
import { debugLogger } from './debugLogger.js';
2626

27-
vi.mock('child_process', () => ({
27+
vi.mock('node:child_process', () => ({
2828
execSync: vi.fn(),
2929
spawn: vi.fn(),
3030
spawnSync: vi.fn(() => ({ error: null, status: 0 })),
@@ -34,7 +34,7 @@ const originalPlatform = process.platform;
3434

3535
describe('editor utils', () => {
3636
beforeEach(() => {
37-
vi.clearAllMocks();
37+
vi.resetAllMocks();
3838
vi.unstubAllEnvs();
3939
Object.defineProperty(process, 'platform', {
4040
value: originalPlatform,
@@ -75,8 +75,8 @@ describe('editor utils', () => {
7575
{ editor: 'emacs', commands: ['emacs'], win32Commands: ['emacs.exe'] },
7676
{
7777
editor: 'antigravity',
78-
commands: ['agy'],
79-
win32Commands: ['agy.cmd'],
78+
commands: ['agy', 'antigravity'],
79+
win32Commands: ['agy.cmd', 'antigravity.cmd'],
8080
},
8181
];
8282

@@ -179,8 +179,8 @@ describe('editor utils', () => {
179179
{ editor: 'zed', commands: ['zed', 'zeditor'], win32Commands: ['zed'] },
180180
{
181181
editor: 'antigravity',
182-
commands: ['agy'],
183-
win32Commands: ['agy.cmd'],
182+
commands: ['agy', 'antigravity'],
183+
win32Commands: ['agy.cmd', 'antigravity.cmd'],
184184
},
185185
];
186186

@@ -332,6 +332,7 @@ describe('editor utils', () => {
332332
'windsurf',
333333
'cursor',
334334
'zed',
335+
'antigravity',
335336
];
336337

337338
for (const editor of guiEditors) {
@@ -447,6 +448,7 @@ describe('editor utils', () => {
447448
'windsurf',
448449
'cursor',
449450
'zed',
451+
'antigravity',
450452
];
451453
for (const editor of guiEditors) {
452454
it(`should not allow ${editor} in sandbox mode`, () => {

packages/core/src/utils/editor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ const editorCommands: Record<
9292
neovim: { win32: ['nvim'], default: ['nvim'] },
9393
zed: { win32: ['zed'], default: ['zed', 'zeditor'] },
9494
emacs: { win32: ['emacs.exe'], default: ['emacs'] },
95-
antigravity: { win32: ['agy.cmd'], default: ['agy'] },
95+
antigravity: {
96+
win32: ['agy.cmd', 'antigravity.cmd'],
97+
default: ['agy', 'antigravity'],
98+
},
9699
};
97100

98101
export function checkHasEditorType(editor: EditorType): boolean {

0 commit comments

Comments
 (0)