• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const assert = require('assert');
5const fs = require('fs');
6const path = require('path');
7
8const tmpdir = require('../common/tmpdir');
9tmpdir.refresh();
10
11const dirname = path.join(tmpdir.path, '\u4e2d\u6587\u76ee\u5f55');
12fs.mkdirSync(dirname);
13fs.writeFileSync(path.join(dirname, 'file.js'), 'module.exports = 42;');
14fs.writeFileSync(path.join(dirname, 'package.json'),
15                 JSON.stringify({ name: 'test', main: 'file.js' }));
16assert.strictEqual(require(dirname), 42);
17assert.strictEqual(require(path.join(dirname, 'file.js')), 42);
18