Add asar-supported fs.accessSync implementation

This commit is contained in:
Kevin Sawicki 2016-07-25 11:05:18 -07:00
parent 3ad5504194
commit 30fbe92970
2 changed files with 53 additions and 0 deletions

View file

@ -560,6 +560,29 @@ describe('asar package', function () {
})
})
describe('fs.accessSync', function () {
it('throws an error when called with write mode', function () {
var p = path.join(fixtures, 'asar', 'a.asar', 'file1')
assert.throws(function () {
fs.accessSync(p, fs.constants.R_OK | fs.constants.W_OK)
}, /EACCES/)
})
it('throws an error when called on non-existent file', function () {
var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist')
assert.throws(function () {
fs.accessSync(p)
}, /ENOENT/)
})
it('allows write mode for unpacked files', function () {
var p = path.join(fixtures, 'asar', 'unpack.asar', 'a.txt')
assert.doesNotThrow(function () {
fs.accessSync(p, fs.constants.R_OK | fs.constants.W_OK)
})
})
})
describe('child_process.fork', function () {
it('opens a normal js file', function (done) {
var child = ChildProcess.fork(path.join(fixtures, 'asar', 'a.asar', 'ping.js'))