it 'throws ENOENT error when can not find file', (done) ->
p = path.join fixtures, 'asar', 'a.asar', 'file4'
- fs.lstat p, (err, stats) ->
+ stats = fs.lstat p, (err, stats) ->
assert.equal err.code, 'ENOENT'
done()
it 'reads dirs from root', ->
p = path.join fixtures, 'asar', 'a.asar'
dirs = fs.readdirSync p
- assert.deepEqual dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2']
+ assert.deepEqual dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']
it 'reads dirs from a normal dir', ->
p = path.join fixtures, 'asar', 'a.asar', 'dir1'
p = path.join fixtures, 'asar', 'a.asar'
dirs = fs.readdir p, (err, dirs) ->
assert.equal err, null
- assert.deepEqual dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2']
+ assert.deepEqual dirs, ['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']
done()
it 'reads dirs from a normal dir', (done) ->
fs.open p, (err, stats) ->
assert.equal err.code, 'ENOENT'
done()
+
+ describe 'child_process.fork', ->
+ child_process = require 'child_process'
+
+ it 'opens a normal js file', (done) ->
+ child = child_process.fork path.join(fixtures, 'asar', 'a.asar', 'ping.js')
+ child.on 'message', (msg) ->
+ assert.equal msg, 'message'
+ done()
+ child.send 'message'
+
+ it 'throws ENOENT error when can not find file', ->
+ p = path.join fixtures, 'asar', 'a.asar', 'not-exist'
+ throws = -> child_process.fork p
+ assert.throws throws, /ENOENT/