Skip to content

Commit 03d7b92

Browse files
committed
update deps and test on node 11
1 parent 0dfe00e commit 03d7b92

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ language: node_js
22

33
node_js:
44
- "8"
5-
- "9"
5+
- "10"
6+
- "11"
67
- "node"
78

89
sudo: false

lib/index.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ internals.addMethod = function (names, fn) {
167167
internals.addMethod(word, method);
168168
});
169169

170-
internals.addMethod('error', function (/*type, message*/) {
170+
internals.addMethod('error', function (...args /*type, message*/) {
171171

172-
const type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : Error;
173-
const lastArg = arguments[1] || arguments[0];
172+
const type = args.length && typeof args[0] !== 'string' && !(args[0] instanceof RegExp) ? args[0] : Error;
173+
const lastArg = args[1] || args[0];
174174
const message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;
175175
const err = this._ref;
176176

@@ -366,13 +366,13 @@ internals.satisfy = function (validator) {
366366
internals.addMethod(['satisfy', 'satisfies'], internals.satisfy);
367367

368368

369-
internals.throw = function (/* type, message */) {
369+
internals.throw = function (...args /* type, message */) {
370370

371371
internals.assert(this, typeof this._ref === 'function', 'Can only assert throw on functions');
372-
internals.assert(this, !this._flags.not || !arguments.length, 'Cannot specify arguments when expecting not to throw');
372+
internals.assert(this, !this._flags.not || !args.length, 'Cannot specify arguments when expecting not to throw');
373373

374-
const type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : null;
375-
const lastArg = arguments[1] || arguments[0];
374+
const type = args.length && typeof args[0] !== 'string' && !(args[0] instanceof RegExp) ? args[0] : null;
375+
const lastArg = args[1] || args[0];
376376
const message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;
377377

378378
let thrown = false;
@@ -402,13 +402,13 @@ internals.throw = function (/* type, message */) {
402402
internals.addMethod(['throw', 'throws'], internals.throw);
403403

404404

405-
internals.reject = async function (/* type, message */) {
405+
internals.reject = async function (...args/* type, message */) {
406406

407407
try {
408408
internals.assert(this, internals.isPromise(this._ref), 'Can only assert reject on promises');
409409

410-
const type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : null;
411-
const lastArg = arguments[1] || arguments[0];
410+
const type = args.length && typeof args[0] !== 'string' && !(args[0] instanceof RegExp) ? args[0] : null;
411+
const lastArg = args[1] || args[0];
412412
const message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null;
413413

414414
let thrown = null;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"hoek": "5.x.x"
1717
},
1818
"devDependencies": {
19-
"lab": "15.x.x",
19+
"lab": "17.x.x",
2020
"markdown-toc": "1.1.x"
2121
},
2222
"scripts": {

test/index.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ describe('expect()', () => {
311311
}
312312

313313
Code.settings.comparePrototypes = origPrototype;
314-
Hoek.assert(exception2.message === 'Expected {} to equal specified value: {}', exception2);
314+
Hoek.assert(exception2.message === `Expected {} to equal specified value: ${Util.format(Object.create(null))}`, exception2);
315315
});
316316

317317
describe('assertion', () => {
@@ -322,7 +322,7 @@ describe('expect()', () => {
322322

323323
const grab = function () {
324324

325-
return arguments;
325+
return arguments; // eslint-disable-line prefer-rest-params
326326
};
327327

328328
try {
@@ -407,7 +407,7 @@ describe('expect()', () => {
407407
it('validates correct type', () => {
408408

409409
try {
410-
Code.expect(new Buffer([1])).to.be.a.buffer();
410+
Code.expect(Buffer.from([1])).to.be.a.buffer();
411411
}
412412
catch (err) {
413413
var exception = err;
@@ -759,7 +759,7 @@ describe('expect()', () => {
759759
it('invalidates incorrect type', () => {
760760

761761
try {
762-
Code.expect(new Buffer([20])).to.be.an.object();
762+
Code.expect(Buffer.from([20])).to.be.an.object();
763763
}
764764
catch (err) {
765765
var exception = err;
@@ -1054,6 +1054,7 @@ describe('expect()', () => {
10541054
catch (err) {
10551055
var exception1 = err;
10561056
}
1057+
10571058
Hoek.assert(exception1.message === 'Can only assert include with a single parameter', exception1);
10581059

10591060
try {
@@ -1239,7 +1240,7 @@ describe('expect()', () => {
12391240
it('validates buffer', () => {
12401241

12411242
try {
1242-
Code.expect(new Buffer('')).to.be.empty();
1243+
Code.expect(Buffer.from('')).to.be.empty();
12431244
}
12441245
catch (err) {
12451246
var exception = err;
@@ -1302,7 +1303,7 @@ describe('expect()', () => {
13021303
it('validates buffer', () => {
13031304

13041305
try {
1305-
Code.expect(new Buffer('a')).to.have.length(1);
1306+
Code.expect(Buffer.from('a')).to.have.length(1);
13061307
}
13071308
catch (err) {
13081309
var exception = err;

0 commit comments

Comments
 (0)