From bc90d5f52e92d317d70f8411b6164e40a46ab0bf Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Tue, 15 Oct 2019 17:23:57 -0400 Subject: [PATCH] stop promise chains --- packages/server/test/support/helpers/e2e.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/server/test/support/helpers/e2e.coffee b/packages/server/test/support/helpers/e2e.coffee index 0bd3fcc0045f..f4d1f4b0d1cf 100644 --- a/packages/server/test/support/helpers/e2e.coffee +++ b/packages/server/test/support/helpers/e2e.coffee @@ -111,6 +111,8 @@ normalizeStdout = (str, options = {}) -> startServer = (obj) -> { onServer, port, https } = obj + console.log('STARTING ON', port) + app = express() if https @@ -118,6 +120,8 @@ startServer = (obj) -> else srv = http.Server(app) + srv.port = port + allowDestroy(srv) app.use(morgan("dev")) @@ -133,7 +137,13 @@ startServer = (obj) -> resolve(srv) +## since the resolved object is a .thenable, it won't get wrapped in a +## Promise, which then leads to the rest of the Promise.chain getting no-op'd +stopPromise = () -> + { then: stopPromise, catch: stopPromise } + stopServer = (srv) -> + console.log('STOPPING ON', srv.port) srv.destroyAsync() copy = -> @@ -398,6 +408,8 @@ module.exports = e2e = { return runAfterEach(ctx._runnable).then -> ctx.skip() + ## dirty-nasty trick to halt Promises chained off e2e.exec + stopPromise() args = ["index.js"].concat(args)