From bf6ce47259ebfe9f6349c223cc1735726aee062d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 24 Dec 2017 22:38:11 -0800 Subject: test: move tmpdir to submodule of common Move tmpdir functionality to its own module (common/tmpdir). PR-URL: https://github.com/nodejs/node/pull/17856 Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock Reviewed-By: Ruben Bridgewater Reviewed-By: Joyee Cheung --- test/parallel/test-fs-watchfile.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'test/parallel/test-fs-watchfile.js') diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index 163eac5ae9..3c24ae84ac 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -5,6 +5,8 @@ const assert = require('assert'); const fs = require('fs'); const path = require('path'); +const tmpdir = require('../common/tmpdir'); + // Basic usage tests. common.expectsError( () => { @@ -28,7 +30,7 @@ common.expectsError(function() { fs.watchFile(new Object(), common.mustNotCall()); }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError }); -const enoentFile = path.join(common.tmpDir, 'non-existent-file'); +const enoentFile = path.join(tmpdir.path, 'non-existent-file'); const expectedStatObject = new fs.Stats( 0, // dev 0, // mode @@ -46,7 +48,7 @@ const expectedStatObject = new fs.Stats( Date.UTC(1970, 0, 1, 0, 0, 0) // birthtime ); -common.refreshTmpDir(); +tmpdir.refresh(); // If the file initially didn't exist, and gets created at a later point of // time, the callback should be invoked again with proper values in stat object @@ -80,7 +82,7 @@ watcher.start(); // should not crash // Watch events should callback with a filename on supported systems. // Omitting AIX. It works but not reliably. if (common.isLinux || common.isOSX || common.isWindows) { - const dir = path.join(common.tmpDir, 'watch'); + const dir = path.join(tmpdir.path, 'watch'); fs.mkdir(dir, common.mustCall(function(err) { if (err) assert.fail(err); -- cgit v1.2.3