"use strict"; let assert = require("assert"); describe("Promise test", function() { it('should pass', function(done) { var a = {}; var b = {}; a.key = 124; b.key = 567; let p = new Promise(function(resolve, reject) { setTimeout(function() { resolve(); }, 100) }); p.then(function success() { console.log("success---->", a, b); assert.deepEqual(a, b, "response doesnot match"); done(); }, function error() { console.log("error---->", a, b); assert.deepEqual(a, b, "response doesnot match"); done(); }); }); });
Output: 
I am using node v5.6.0. The test seems to freeze for approval when the values do not match.
I tried to check if there is a problem with assert.deepEqual using setTimeout, but it works fine.
But it does not work when using Promise and freezes if the values do not match.
source share