From 0bcbcca21c1eeba18381c14c7b1f49d4247b08df Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 16 Jun 2017 09:58:25 -0700 Subject: [PATCH] test: refactor test-fs-watchfile * use `common.mustNotCall()` to confirm callback is not called * reorder modules to conform with test-writing guide * match full error message in `assert.throws()` PR-URL: https://github.com/nodejs/node/pull/13721 Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell --- test/parallel/test-fs-watchfile.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index f583eb8989c06f..c99510fcbb4fe9 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -1,21 +1,21 @@ 'use strict'; - const common = require('../common'); + +const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const assert = require('assert'); // Basic usage tests. assert.throws(function() { fs.watchFile('./some-file'); -}, /"watchFile\(\)" requires a listener function/); +}, /^Error: "watchFile\(\)" requires a listener function$/); assert.throws(function() { fs.watchFile('./another-file', {}, 'bad listener'); -}, /"watchFile\(\)" requires a listener function/); +}, /^Error: "watchFile\(\)" requires a listener function$/); assert.throws(function() { - fs.watchFile(new Object(), common.noop); + fs.watchFile(new Object(), common.mustNotCall()); }, /Path must be a string/); const enoentFile = path.join(common.tmpDir, 'non-existent-file');