0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/fixtures/cluster-preload.js
abouthiroppy da96843920 test: refactor cluster-preload.js
PR-URL: https://github.com/nodejs/node/pull/10701
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
2017-01-10 16:57:48 -05:00

13 lines
545 B
JavaScript

const assert = require('assert');
// https://github.com/nodejs/node/issues/1803
// this module is used as a preload module. It should have a parent with the
// module search paths initialized from the current working directory
assert.ok(module.parent);
const expectedPaths = require('module')._nodeModulePaths(process.cwd());
assert.deepStrictEqual(module.parent.paths, expectedPaths);
const cluster = require('cluster');
cluster.isMaster || process.exit(42 + cluster.worker.id); // +42 to distinguish
// from exit(1) for other random reasons