Skip to content

Commit

Permalink
test: avoid empty fixture in module test
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
Trott authored and MylesBorins committed Jun 6, 2018
1 parent c74c83a commit f7886ab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/sequential/test-module-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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}'`);
}

{
Expand Down Expand Up @@ -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': {},
Expand Down

0 comments on commit f7886ab

Please sign in to comment.