Use node-runas for testing native modules.

This commit is contained in:
Cheng Zhao 2013-12-17 12:00:21 +08:00
Родитель e07e26ca76
Коммит 1d88b31edd
3 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -8,10 +8,7 @@
"mocha": "~1.13.0",
"walkdir": "~0.0.7",
"runas": "0.3.0",
"formidable": "~1.0.14",
"unzip": "~0.1.9",
"time": "0.10.0"
"formidable": "~1.0.14"
},
"private": true,

Просмотреть файл

@ -2,5 +2,5 @@ process.on('uncaughtException', function(err) {
process.send(err.message);
});
require('time');
require('runas');
process.send('ok');

Просмотреть файл

@ -13,16 +13,13 @@ describe 'third-party module', ->
.pipe(unzip.Parse())
.on('close', done)
describe 'time', ->
describe 'runas', ->
it 'can be required in renderer', ->
time = require 'time'
now = new time.Date()
now.setTimezone 'America/Los_Angeles'
assert.equal now.getTimezone(), 'America/Los_Angeles'
require 'runas'
it 'can be required in node binary', (done) ->
time = path.join fixtures, 'module', 'time.js'
child = require('child_process').fork time
runas = path.join fixtures, 'module', 'runas.js'
child = require('child_process').fork runas
child.on 'message', (msg) ->
assert.equal msg, 'ok'
done()