AP
1 min readJun 17, 2017

--

Anyone successfully used this with libraries that use promises? For example I have some sequelize.js models that I would like an interactive shell with however the db queries are not issued until after I leave the debugger session:

SomeSequelizeModel.count().then(function(val){console.log("count="+val)}, function(err){console.error(err)})
Promise {_bitField: 2097152, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _promise0: undefined, _receiver0: undefined…}

Press “continue” in debugger, debugged script exits, promise code and handlers are executed:

POSTGRES: Executing (default): SELECT count(*) AS “count” FROM “user” AS “user” WHERE “user”.”deleted_at” IS NULL;
count=1

But then you have to restart the debug session again. The only solution I have found is something like the following which allows you to type your async queries like `SomeSequelizeModel.count().then(function(val){console.log(“count=”+val)}, function(err){console.error(err)})` then hit “continue” to allow them to execute and get returned back to the repl:

var Models = require(“../server/models”);
var SomeSequelizeModel = Models.SomeSequelizeModel;
function looper() {
var Tmp = {SomeSequelizeModel};
debugger;
setTimeout(looper, 500);
}
looper();

Is there any better approach?

--

--