mirror of https://github.com/nodejs/node.git
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>pull/21086/head
parent
de8ef3f954
commit
c903a9e0c0
|
@ -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': {},
|
||||
|
|
Loading…
Reference in New Issue