11import { defaultTestConfig , setupIntegrationTest , type IntegrationTest } from "../../helpers.js" ;
2+ import type { UserConfig } from "../../../../src/common/config/userConfig.js" ;
23import { describe } from "vitest" ;
34
45const isMacOSInGitHubActions = process . platform === "darwin" && process . env . GITHUB_ACTIONS === "true" ;
56
67export type IntegrationTestFunction = ( integration : IntegrationTest ) => void ;
78
9+ /**
10+ * Options for Atlas Local integration tests.
11+ */
12+ export interface AtlasLocalIntegrationOptions {
13+ config ?: UserConfig ;
14+ }
15+
816/**
917 * Helper function to setup integration tests for Atlas Local tools.
1018 * Automatically skips tests on macOS in GitHub Actions where Docker is not available.
19+ * Pass options.config to inject a config into the server, otherwise defaultTestConfig is used.
1120 */
12- export function describeWithAtlasLocal ( name : string , fn : IntegrationTestFunction ) : void {
21+ export function describeWithAtlasLocal (
22+ name : string ,
23+ fn : IntegrationTestFunction ,
24+ options ?: AtlasLocalIntegrationOptions
25+ ) : void {
1326 describe . skipIf ( isMacOSInGitHubActions ) ( name , ( ) => {
14- const integration = setupIntegrationTest ( ( ) => defaultTestConfig ) ;
27+ const config = options ?. config ?? defaultTestConfig ;
28+ const integration = setupIntegrationTest ( ( ) => config ) ;
1529 fn ( integration ) ;
1630 } ) ;
1731}
@@ -20,9 +34,14 @@ export function describeWithAtlasLocal(name: string, fn: IntegrationTestFunction
2034 * Helper function to describe tests that should only run on macOS in GitHub Actions.
2135 * Used for testing that Atlas Local tools are properly disabled on unsupported platforms.
2236 */
23- export function describeWithAtlasLocalDisabled ( name : string , fn : IntegrationTestFunction ) : void {
37+ export function describeWithAtlasLocalDisabled (
38+ name : string ,
39+ fn : IntegrationTestFunction ,
40+ options ?: AtlasLocalIntegrationOptions
41+ ) : void {
2442 describe . skipIf ( ! isMacOSInGitHubActions ) ( name , ( ) => {
25- const integration = setupIntegrationTest ( ( ) => defaultTestConfig ) ;
43+ const config = options ?. config ?? defaultTestConfig ;
44+ const integration = setupIntegrationTest ( ( ) => config ) ;
2645 fn ( integration ) ;
2746 } ) ;
2847}
0 commit comments