From 90ce8fc1dd1dae0b83a1edc3aa193e0f0bb5ee30 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 17 Apr 2026 11:49:26 -0500 Subject: [PATCH 1/3] chore: Simplify tests --- packages/runner/src/__tests__/options.test.ts | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/packages/runner/src/__tests__/options.test.ts b/packages/runner/src/__tests__/options.test.ts index 23ec3e4ab..d8d1bf489 100644 --- a/packages/runner/src/__tests__/options.test.ts +++ b/packages/runner/src/__tests__/options.test.ts @@ -25,6 +25,7 @@ describe('Options', () => { describe('extensionDir', () => { it('should default to the current working directory', async () => { const actual = await resolveRunOptions({}); + expect(actual).toMatchObject>({ extensionDir: process.cwd(), }); @@ -34,17 +35,27 @@ describe('Options', () => { const actual = await resolveRunOptions({ extensionDir: './path/to/extension', }); + expect(actual).toMatchObject>({ extensionDir: resolve(process.cwd(), './path/to/extension'), }); }); + + it('should use absolute paths as-is', async () => { + const actual = await resolveRunOptions({ + extensionDir: '/abs/path/to/extension2', + }); + + expect(actual).toMatchObject>({ + extensionDir: '/abs/path/to/extension2', + }); + }); }); describe('target', () => { it('should be "chrome" by default', async () => { - const actual = await resolveRunOptions({ - extensionDir: 'path/to/extension', - }); + const actual = await resolveRunOptions({}); + expect(actual).toMatchObject>({ target: 'chrome', }); @@ -52,12 +63,12 @@ describe('Options', () => { it('should be what is passed in', async () => { const actual = await resolveRunOptions({ - extensionDir: 'path/to/extension', target: 'custom', browserBinaries: { custom: '/path/to/custom/browser', }, }); + expect(actual).toMatchObject>({ target: 'custom', }); @@ -65,9 +76,9 @@ describe('Options', () => { it('should throw an error if the target binary could not be found', async () => { const actual = resolveRunOptions({ - extensionDir: 'path/to/extension', target: 'custom', }); + await expect(actual).rejects.toThrow('Could not find "custom" binary.'); }); }); @@ -83,7 +94,6 @@ describe('Options', () => { ? 'C:\\path\\to\\custom\\browser.exe' : path; const actual = await resolveRunOptions({ - extensionDir: 'path/to/extension', target: 'custom', browserBinaries: { custom: path, @@ -98,9 +108,11 @@ describe('Options', () => { describe('chromiumArgs', () => { it('should log a warning when --user-data-dir is passed in', async () => { const warnSpy = vi.spyOn(console, 'warn'); + await resolveRunOptions({ chromiumArgs: ['--user-data-dir=some/custom/path'], }); + expect(warnSpy).toBeCalledTimes(1); expect(warnSpy).toHaveBeenCalledWith( expect.stringContaining( @@ -111,9 +123,11 @@ describe('Options', () => { it('should log a warning when --remote-debugging-port is passed in', async () => { const warnSpy = vi.spyOn(console, 'warn'); + await resolveRunOptions({ chromiumArgs: ['--remote-debugging-port=9222'], }); + expect(warnSpy).toBeCalledTimes(1); expect(warnSpy).toHaveBeenCalledWith( expect.stringContaining( @@ -126,6 +140,7 @@ describe('Options', () => { const actual = await resolveRunOptions({ chromiumArgs: ['--window-size=1920,1080'], }); + expect(actual.chromiumArgs).toEqual([ // Defaults '--disable-features=Translate,OptimizationHints,MediaRouter,DialMediaRouteProvider,CalculateNativeWinOcclusion,InterestFeedContentSuggestions,CertificateTransparencyComponentUpdater,AutofillServerCommunication,PrivacySandboxSettings4', @@ -161,9 +176,11 @@ describe('Options', () => { describe('firefoxArgs', () => { it('should log a warning when --profile is passed in', async () => { const warnSpy = vi.spyOn(console, 'warn'); + await resolveRunOptions({ firefoxArgs: ['--profile=some/custom/path'], }); + expect(warnSpy).toBeCalledTimes(1); expect(warnSpy).toHaveBeenCalledWith( expect.stringContaining('Custom Firefox --profile argument ignored'), @@ -172,9 +189,11 @@ describe('Options', () => { it('should log a warning when --remote-debugging-port is passed in', async () => { const warnSpy = vi.spyOn(console, 'warn'); + await resolveRunOptions({ firefoxArgs: ['--remote-debugging-port=9222'], }); + expect(warnSpy).toBeCalledTimes(1); expect(warnSpy).toHaveBeenCalledWith( expect.stringContaining( @@ -187,6 +206,7 @@ describe('Options', () => { const actual = await resolveRunOptions({ firefoxArgs: ['--window-size=1920,1080'], }); + expect(actual.firefoxArgs).toEqual([ // Defaults '--new-instance', From f1d6c39c0cce9787d293a9b4f4030bf45fa592d0 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 17 Apr 2026 11:54:15 -0500 Subject: [PATCH 2/3] Fix windows tests --- packages/runner/src/__tests__/options.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runner/src/__tests__/options.test.ts b/packages/runner/src/__tests__/options.test.ts index d8d1bf489..ca3ec86c6 100644 --- a/packages/runner/src/__tests__/options.test.ts +++ b/packages/runner/src/__tests__/options.test.ts @@ -47,7 +47,10 @@ describe('Options', () => { }); expect(actual).toMatchObject>({ - extensionDir: '/abs/path/to/extension2', + extensionDir: + process.platform === 'win32' + ? 'D:\\abs\\path\\to\\extension2' + : '/abs/path/to/extension2', }); }); }); From 8f428475130007eb90a5c4678cd7c620aa3e5256 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 17 Apr 2026 11:57:01 -0500 Subject: [PATCH 3/3] Tweak windows test --- packages/runner/src/__tests__/options.test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/runner/src/__tests__/options.test.ts b/packages/runner/src/__tests__/options.test.ts index ca3ec86c6..86c9ca119 100644 --- a/packages/runner/src/__tests__/options.test.ts +++ b/packages/runner/src/__tests__/options.test.ts @@ -47,10 +47,7 @@ describe('Options', () => { }); expect(actual).toMatchObject>({ - extensionDir: - process.platform === 'win32' - ? 'D:\\abs\\path\\to\\extension2' - : '/abs/path/to/extension2', + extensionDir: resolve('/abs/path/to/extension2'), }); }); });