2 // Refs: https://github.com/nodejs/node/issues/4778
3 const common = require('../common');
4 const assert = require('assert');
5 const fs = require('fs');
6 const path = require('path');
7 const file = path.join(common.tmpDir, 'test-extensions.foo.bar');
9 common.refreshTmpDir();
10 fs.writeFileSync(file, '', 'utf8');
11 require.extensions['.foo.bar'] = (module, path) => {};
12 delete require.extensions['.foo.bar'];
13 require.extensions['.bar'] = common.mustCall((module, path) => {
14 assert.strictEqual(module.id, file);
15 assert.strictEqual(path, file);
17 require(path.join(common.tmpDir, 'test-extensions'));