Lines Matching full:require
23 const common = require('../common');
24 const tmpdir = require('../common/tmpdir');
26 const assert = require('assert');
27 const fs = require('fs');
28 const path = require('path');
37 assert.strictEqual(require.main.id, '.');
38 assert.strictEqual(require.main, module);
42 require('../fixtures/not-main-module.js');
45 // Require a file with a request that includes the extension
46 const a_js = require('../fixtures/a.js');
51 // Require a file without any extensions
52 const foo_no_ext = require('../fixtures/foo');
56 const a = require('../fixtures/a');
57 const d = require('../fixtures/b/d');
58 const d2 = require('../fixtures/b/d');
61 const c = require('../fixtures/b/c');
63 const d3 = require(path.join(__dirname, '../fixtures/b/d'));
65 const d4 = require('../fixtures/b/d');
93 const one = require('../fixtures/nested-index/one');
94 const two = require('../fixtures/nested-index/two');
100 const three = require('../fixtures/nested-index/three');
101 const threeFolder = require('../fixtures/nested-index/three/');
102 const threeIndex = require('../fixtures/nested-index/three/index.js');
107 assert.strictEqual(require('../fixtures/packages/index').ok, 'ok');
108 assert.strictEqual(require('../fixtures/packages/main').ok, 'ok');
109 assert.strictEqual(require('../fixtures/packages/main-index').ok, 'ok');
110 assert.strictEqual(require('../fixtures/packages/missing-main').ok, 'ok');
112 () => require('../fixtures/packages/missing-main-no-index'),
122 function() { require('../fixtures/packages/unparseable'); },
128 const root = require('../fixtures/cycles/root');
129 const foo = require('../fixtures/cycles/folder/foo');
137 require('../fixtures/node_modules/foo');
142 const my_path = require('../fixtures/path');
145 assert.throws(function() { require('./utils'); },
151 require('../fixtures/throws_error');
160 require.extensions['.test'] = function(module, filename) {
168 assert.strictEqual(require('../fixtures/registerExt').test, 'passed');
170 assert.strictEqual(require('../fixtures/registerExt.hello.world').test,
174 require.extensions['.test'] = function(module) {
180 assert.strictEqual(require('../fixtures/registerExt2').custom, 'passed');
182 assert.strictEqual(require('../fixtures/foo').foo, 'ok');
188 require(tmpdir.path);
199 require.extensions['.reg'] = require.extensions['.js'];
200 require.extensions['.reg2'] = require.extensions['.js'];
202 assert.strictEqual(require(`${loadOrder}file1`).file1, 'file1');
203 assert.strictEqual(require(`${loadOrder}file2`).file2, 'file2.js');
205 () => require(`${loadOrder}file3`),
207 // Not a real .node module, but we know we require'd the right thing.
217 assert.strictEqual(require(`${loadOrder}file4`).file4, 'file4.reg');
218 assert.strictEqual(require(`${loadOrder}file5`).file5, 'file5.reg2');
219 assert.strictEqual(require(`${loadOrder}file6`).file6, 'file6/index.js');
221 () => require(`${loadOrder}file7`),
232 assert.strictEqual(require(`${loadOrder}file8`).file8, 'file8/index.reg');
233 assert.strictEqual(require(`${loadOrder}file9`).file9, 'file9/index.reg2');
237 // Make sure that module.require() is the same as
238 // doing require() inside of that module.
239 const parent = require('../fixtures/module-require/parent/');
240 const child = require('../fixtures/module-require/child/');
245 // Loading JSON files with require()
247 const json = require('../fixtures/packages/main/package.json');
315 'fixtures/module-require/parent/index.js': {
316 'fixtures/module-require/child/index.js': {
317 'fixtures/module-require/child/node_modules/target.js': {}
349 assert.strictEqual(require('../fixtures/utf8-bom.js'), 42);
350 assert.strictEqual(require('../fixtures/utf8-bom.json'), 42);
355 require('../fixtures/utf8-bom-shebang-shebang.js');
357 assert.strictEqual(require('../fixtures/utf8-shebang-bom.js'), 42);
362 require('../fixtures/test-error-first-line-offset.js');