From ae9b891a3904cd0b1017453ccec3f3bc18a1f093 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 15 Feb 2017 15:21:12 -0800 Subject: [PATCH] test: use expectsError in require-invalid-package Use common.expectsError() in place of inline validation function in test-require-invalid-package. PR-URL: https://github.com/nodejs/node/pull/11409 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-require-invalid-package.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-require-invalid-package.js b/test/parallel/test-require-invalid-package.js index 45272cf5c3af9a..54ffaabe2ec3f2 100644 --- a/test/parallel/test-require-invalid-package.js +++ b/test/parallel/test-require-invalid-package.js @@ -1,9 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // Should be an invalid package path. -assert.throws(() => require('package.json'), (err) => { - return err && err.code === 'MODULE_NOT_FOUND'; -}); +assert.throws(() => require('package.json'), + common.expectsError('MODULE_NOT_FOUND') +);