diff options
author | Rich Trott <rtrott@gmail.com> | 2017-06-16 09:58:25 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-06-19 11:00:33 -0700 |
commit | fd9a30f10ed6fdb797c840b84fe3298f064f1d6b (patch) | |
tree | 5c0698df16b5c362dd2656e7bd43978f923e0fd2 /test/parallel/test-fs-watchfile.js | |
parent | 24ecc331e2e65403231358f61a9794885323e8eb (diff) | |
download | android-node-v8-fd9a30f10ed6fdb797c840b84fe3298f064f1d6b.tar.gz android-node-v8-fd9a30f10ed6fdb797c840b84fe3298f064f1d6b.tar.bz2 android-node-v8-fd9a30f10ed6fdb797c840b84fe3298f064f1d6b.zip |
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 <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-watchfile.js')
-rw-r--r-- | test/parallel/test-fs-watchfile.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index 4434f3f65f..35ac9b88e1 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()); }, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError})); const enoentFile = path.join(common.tmpDir, 'non-existent-file'); |