From ffa668a6df2a7855b238f4c72a31dcd7b273ed57 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 30 May 2018 15:15:25 +0200 Subject: [PATCH 1/3] test: avoid empty fixture in fs test Refactor test-fs-error-messages to use tmpdir for its empty directory rather than using a not-actually-empty directory called "empty" in fixtures. --- test/parallel/test-fs-error-messages.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index 28141f33f62965..f406e8743ed120 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -22,13 +22,17 @@ 'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); +const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const fs = require('fs'); + +tmpdir.refresh(); + const nonexistentFile = fixtures.path('non-existent'); const nonexistentDir = fixtures.path('non-existent', 'foo', 'bar'); const existingFile = fixtures.path('exit.js'); const existingFile2 = fixtures.path('create-file.js'); -const existingDir = fixtures.path('empty'); +const existingDir = tmpdir.path; const existingDir2 = fixtures.path('keys'); const { COPYFILE_EXCL } = fs.constants; const uv = process.binding('uv'); From 079f431c22c9c10cc17bd6807b49ae00351aac1f Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 30 May 2018 15:19:33 +0200 Subject: [PATCH 2/3] test: avoid empty fixture in module test Refactor test-module-loading to use tmpdir for its empty directory rather than using a not-actually-empty directory called "empty" in fixtures. --- test/sequential/test-module-loading.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index 7bc8428fac5939..abea73c4aa616c 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -21,9 +21,11 @@ 'use strict'; const common = require('../common'); +const tmpdir = require('../common/tmpdir'); + const assert = require('assert'); -const path = require('path'); const fs = require('fs'); +const path = require('path'); const backslash = /\\/g; @@ -168,9 +170,10 @@ assert.strictEqual(require('../fixtures/foo').foo, 'ok', // Should not attempt to load a directory try { - require('../fixtures/empty'); + tmpdir.refresh(); + require(tmpdir.path); } catch (err) { - assert.strictEqual(err.message, 'Cannot find module \'../fixtures/empty\''); + assert.strictEqual(err.message, `Cannot find module '${tmpdir.path}'`); } { @@ -284,7 +287,6 @@ try { 'fixtures/registerExt.test': {}, 'fixtures/registerExt.hello.world': {}, 'fixtures/registerExt2.test': {}, - 'fixtures/empty.js': {}, 'fixtures/module-load-order/file1': {}, 'fixtures/module-load-order/file2.js': {}, 'fixtures/module-load-order/file3.node': {}, From 7f736d5e2eefc8ea93fd8fb5c7aeb0efa3006d47 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 30 May 2018 15:19:48 +0200 Subject: [PATCH 3/3] test: remove unused empty fixture The not-quite-empty directory called "empty" in fixtures was replaced in tests with `tmpdir.path` (after calling `tmpdir.refresh()` to ensure that it is empty). The fixture is removed in this commit. --- test/fixtures/empty/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/fixtures/empty/.gitkeep diff --git a/test/fixtures/empty/.gitkeep b/test/fixtures/empty/.gitkeep deleted file mode 100644 index e69de29bb2d1d6..00000000000000