summaryrefslogtreecommitdiff
path: root/test/parallel/test-preload-self-referential.js
blob: 2624527deb398472e2472910584c589e797561e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';

const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const { exec } = require('child_process');

const nodeBinary = process.argv[0];

if (!common.isMainThread)
  common.skip('process.chdir is not available in Workers');

const selfRefModule = fixtures.path('self_ref_module');
const fixtureA = fixtures.path('printA.js');

exec(`"${nodeBinary}" -r self_ref "${fixtureA}"`, { cwd: selfRefModule },
     (err, stdout, stderr) => {
       assert.ifError(err);
       assert.strictEqual(stdout, 'A\n');
     });