diff --git a/lib/runner.js b/lib/runner.js index c5253c26..43ac1c11 100755 --- a/lib/runner.js +++ b/lib/runner.js @@ -743,7 +743,7 @@ internals.protect = function (item, state, callback) { if (itemResult && itemResult.then instanceof Function) { - itemResult.then(done, done); + itemResult.then(() => done(), done); } else if (!item.fn.length) { finish(new Error(`Function for "${item.title}" should either take a callback argument or return a promise`), 'function signature'); diff --git a/test/runner.js b/test/runner.js index 9152fc65..01246664 100755 --- a/test/runner.js +++ b/test/runner.js @@ -246,6 +246,24 @@ describe('Runner', () => { }); }); + it('should not fail test that returns a resolved promise with a value', (done) => { + + const script = Lab.script({ schedule: false }); + + script.test('a', () => { + + return Promise.resolve('a'); + }); + + Lab.execute(script, {}, null, (err, notebook) => { + + expect(err).not.to.exist(); + expect(notebook.tests).to.have.length(1); + expect(notebook.failures).to.equal(0); + done(); + }); + }); + it('should not fail test that calls the callback without an error', (done) => { const script = Lab.script({ schedule: false });