mardi 25 septembre 2018

Basic hapijs/lab test fails asking for a callback argument or return a promise

The very basic test in hapijs/lab fails:

'use strict';
const Code = require('code');
const expect = Code.expect;
const Lab = require('lab');
const lab = exports.lab = Lab.script();

lab.experiment('math', () => {
    lab.test('returns true when 1 + 1 equals 2', () => {
        expect(1 + 1).to.equal(2);
    });
});

with this message:

  1) math returns true when 1 + 1 equals 2:
      Function for "math returns true when 1 + 1 equals 2" should either take a callback argument or return a promise
      at Immediate.setImmediate [as _onImmediate] (/home/ubuntu/projects/service/node_modules/lab/lib/runner.js:755:20)
      at runCallback (timers.js:810:20)
      at tryOnImmediate (timers.js:768:5)
      at processImmediate [as _immediateCallback] (timers.js:745:5)
1 of 1 tests failed
Test duration: 29 ms
Assertions count: 0 (verbosity: 0.00)

The test is straight from Lab documentation. Any idea what is going wrong?

Aucun commentaire:

Enregistrer un commentaire