feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.98k stars 743 forks source link

@feathersjs/koa: teardown() fails if setup() was called but listen() was not called #3224

Closed lvivier closed 1 year ago

lvivier commented 1 year ago

Steps to reproduce

The overridden Application#teardown() method in @feathersjs/koa assumes there is a server started and throws a TypeError if there is not one.

If I'm using the app in a migration, a CLI tool, etc. I might not need to start the HTTP server. I'd like to be able to call setup() and then teardown() when I'm done.

Seems to me this worked in v4 with express. Any reason not to add an if (this.server) {} to enable this usage?

Expected behavior

Actual behavior

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

@feathersjs/koa@5.0.4

NodeJS version:

v18.16.0

Operating System:

macOS 12.6.6

Browser Version:

React Native Version:

Module Loader: