spec: Fix failing tests on win32
This commit is contained in:
parent
0d50e08ed1
commit
c691094aa1
1 changed files with 10 additions and 8 deletions
|
@ -424,6 +424,8 @@ describe 'asar package', ->
|
|||
assert.equal internalModuleReadFile(p).toString().trim(), 'a'
|
||||
|
||||
describe 'process.noAsar', ->
|
||||
errorName = if process.platform is 'win32' then 'ENOENT' else 'ENOTDIR'
|
||||
|
||||
beforeEach ->
|
||||
process.noAsar = true
|
||||
afterEach ->
|
||||
|
@ -432,22 +434,22 @@ describe 'asar package', ->
|
|||
it 'disables asar support in sync API', ->
|
||||
file = path.join fixtures, 'asar', 'a.asar', 'file1'
|
||||
dir = path.join fixtures, 'asar', 'a.asar', 'dir1'
|
||||
assert.throws (-> fs.readFileSync file), /ENOTDIR/
|
||||
assert.throws (-> fs.lstatSync file), /ENOTDIR/
|
||||
assert.throws (-> fs.realpathSync file), /ENOTDIR/
|
||||
assert.throws (-> fs.readdirSync dir), /ENOTDIR/
|
||||
assert.throws (-> fs.readFileSync file), new RegExp(errorName)
|
||||
assert.throws (-> fs.lstatSync file), new RegExp(errorName)
|
||||
assert.throws (-> fs.realpathSync file), new RegExp(errorName)
|
||||
assert.throws (-> fs.readdirSync dir), new RegExp(errorName)
|
||||
|
||||
it 'disables asar support in async API', (done) ->
|
||||
file = path.join fixtures, 'asar', 'a.asar', 'file1'
|
||||
dir = path.join fixtures, 'asar', 'a.asar', 'dir1'
|
||||
fs.readFile file, (error) ->
|
||||
assert.equal error.code, 'ENOTDIR'
|
||||
assert.equal error.code, errorName
|
||||
fs.lstat file, (error) ->
|
||||
assert.equal error.code, 'ENOTDIR'
|
||||
assert.equal error.code, errorName
|
||||
fs.realpath file, (error) ->
|
||||
assert.equal error.code, 'ENOTDIR'
|
||||
assert.equal error.code, errorName
|
||||
fs.readdir dir, (error) ->
|
||||
assert.equal error.code, 'ENOTDIR'
|
||||
assert.equal error.code, errorName
|
||||
done()
|
||||
|
||||
it 'treats *.asar as normal file', ->
|
||||
|
|
Loading…
Reference in a new issue