Skip to content

Commit 2ae72af

Browse files
committed
fix: cleanup tests
1 parent 0ab86d1 commit 2ae72af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/app.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ export const getAppList = (): string[] => {
146146
}
147147

148148
export async function initApp(inOtomiStack?: OtomiStack) {
149-
const lightship = createLightship()
149+
// Only create lightship in production (not in tests)
150+
const lightship = env.isTest ? null : createLightship()
150151
const app = express()
151152
const apiRoutesPath = path.resolve(__dirname, 'api')
152153
await loadSpec()
@@ -176,15 +177,15 @@ export async function initApp(inOtomiStack?: OtomiStack) {
176177
server = app
177178
.listen(PORT, async () => {
178179
debug(`Listening on :::${PORT}`)
179-
lightship.signalReady()
180+
lightship?.signalReady()
180181
// Clone repo after the application is ready to avoid Pod NotReady phenomenon, and thus infinite Pod crash loopback
181182
;(await getSessionStack()).initGit()
182183
})
183184
.on('error', (e) => {
184185
console.error(e)
185-
lightship.shutdown()
186+
lightship?.shutdown()
186187
})
187-
lightship.registerShutdownHandler(() => {
188+
lightship?.registerShutdownHandler(() => {
188189
;(server as Server).close()
189190
})
190191
}

0 commit comments

Comments
 (0)