File tree Expand file tree Collapse file tree 4 files changed +23
-10
lines changed
packages/cli-kit/src/public/node Expand file tree Collapse file tree 4 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export async function identityFqdn(): Promise<string> {
115115 const productionFqdn = 'accounts.shopify.com'
116116 switch ( environment ) {
117117 case 'local' :
118- return new DevServer ( 'identity' ) . host ( )
118+ return new DevServer ( 'identity' ) . host ( { useMockIfNotRunning : true } )
119119 default :
120120 return productionFqdn
121121 }
Original file line number Diff line number Diff line change 1+ import { createServer } from './dev-server-2024.js'
2+ import { describe , expect , test } from 'vitest'
3+
4+ describe ( 'createServer' , ( ) => {
5+ describe ( 'host' , ( ) => {
6+ test ( 'throws when dev server is not running and useMockIfNotRunning is not set' , ( ) => {
7+ const server = createServer ( 'test-project' )
8+ expect ( ( ) => server . host ( ) ) . toThrow ( )
9+ } )
10+
11+ test ( 'does not throw when useMockIfNotRunning is true' , ( ) => {
12+ const server = createServer ( 'test-project' )
13+ expect ( ( ) => server . host ( { useMockIfNotRunning : true } ) ) . not . toThrow ( )
14+ } )
15+ } )
16+ } )
Original file line number Diff line number Diff line change @@ -16,9 +16,12 @@ export function createServer(projectName: string) {
1616 }
1717}
1818
19- function host ( projectName : string , options : HostOptions = { } ) : string {
19+ function host ( projectName : string , options : HostOptions = { useMockIfNotRunning : false } ) : string {
2020 assertCompatibleEnvironment ( )
21- ; ( assertRunningOverride || assertRunning2024 ) ( projectName )
21+
22+ if ( ! options . useMockIfNotRunning ) {
23+ assertRunning2024 ( projectName )
24+ }
2225
2326 const prefix = ( options . nonstandardHostPrefix || projectName ) . replace ( / _ / g, '-' )
2427
@@ -80,10 +83,3 @@ function resolveBackendHost(name: string): string {
8083 return host
8184 }
8285}
83-
84- // Allow overrides for more concise test setup. Meh.
85- let assertRunningOverride : typeof assertRunning2024 | undefined
86-
87- export function setAssertRunning ( override : typeof assertRunningOverride ) {
88- assertRunningOverride = override
89- }
Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ export interface DevServer {
1010
1111export interface HostOptions {
1212 nonstandardHostPrefix ?: string
13+ useMockIfNotRunning ?: boolean
1314}
You can’t perform that action at this time.
0 commit comments