3
var assert = require('assert'),
4
child = require('child_process'),
5
util = require('util'),
6
common = require('../common');
7
if (process.env['TEST_INIT']) {
8
util.print('Loaded successfully!');
10
// change CWD as we do this test so its not dependant on current CWD
11
// being in the test folder
12
process.chdir(__dirname);
15
var envCopy = JSON.parse(JSON.stringify(process.env));
16
envCopy.TEST_INIT = 1;
18
child.exec('"' + process.execPath + '" test-init', {env: envCopy},
19
function(err, stdout, stderr) {
20
assert.equal(stdout, 'Loaded successfully!',
21
'`node test-init` failed!');
23
child.exec('"' + process.execPath + '" test-init.js', {env: envCopy},
24
function(err, stdout, stderr) {
25
assert.equal(stdout, 'Loaded successfully!',
26
'`node test-init.js` failed!');
29
// test-init-index is in fixtures dir as requested by ry, so go there
30
process.chdir(common.fixturesDir);
32
child.exec('"' + process.execPath + '" test-init-index', {env: envCopy},
33
function(err, stdout, stderr) {
34
assert.equal(stdout, 'Loaded successfully!',
35
'`node test-init-index failed!');
38
// ensures that `node fs` does not mistakenly load the native 'fs' module
39
// instead of the desired file and that the fs module loads as
41
process.chdir(common.fixturesDir + '/test-init-native/');
43
child.exec('"' + process.execPath + '" fs', {env: envCopy},
44
function(err, stdout, stderr) {
45
assert.equal(stdout, 'fs loaded successfully',