summaryrefslogtreecommitdiff
path: root/test/parallel/test-module-require-depth.js
blob: 12a963e9b6c6be6418f600fc72c48706fcbfd649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Flags: --expose_internals
'use strict';
const common = require('../common');
const assert = require('assert');
const internalModule = require('internal/module');

// Module one loads two too so the expected depth for two is, well, two.
assert.strictEqual(internalModule.requireDepth, 0);
const one = require(`${common.fixturesDir}/module-require-depth/one`);
const two = require(`${common.fixturesDir}/module-require-depth/two`);
assert.deepStrictEqual(one, { requireDepth: 1 });
assert.deepStrictEqual(two, { requireDepth: 2 });
assert.strictEqual(internalModule.requireDepth, 0);