diff options
author | Rich Trott <rtrott@gmail.com> | 2018-05-30 15:19:33 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-06-01 23:44:02 +0200 |
commit | c903a9e0c0926921b660c542f921057acd7b3587 (patch) | |
tree | 0422bb69ea51c44711048d36cbf1ecf7df9a05fe /test/sequential/test-module-loading.js | |
parent | de8ef3f954622422ddb41775c06b278f0c8361a5 (diff) | |
download | node-new-c903a9e0c0926921b660c542f921057acd7b3587.tar.gz |
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.
PR-URL: https://github.com/nodejs/node/pull/21044
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/sequential/test-module-loading.js')
-rw-r--r-- | test/sequential/test-module-loading.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index 7bc8428fac..abea73c4aa 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': {}, |