Add specs for ELECTRON_NO_ASAR env var
This commit is contained in:
parent
656ee0d9c3
commit
8897a7a926
2 changed files with 50 additions and 0 deletions
|
@ -753,6 +753,41 @@ describe('asar package', function () {
|
||||||
assert.equal(process.noAsar, false)
|
assert.equal(process.noAsar, false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('process.env.ELECTRON_NO_ASAR', function () {
|
||||||
|
it('disables asar support in forked processes', function (done) {
|
||||||
|
const forked = ChildProcess.fork(path.join(__dirname, 'fixtures', 'module', 'no-asar.js'), [], {
|
||||||
|
env: {
|
||||||
|
ELECTRON_NO_ASAR: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
forked.on('message', function (stats) {
|
||||||
|
assert.equal(stats.isFile, true)
|
||||||
|
assert.equal(stats.size, 778)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('disables asar support in spawned processes', function (done) {
|
||||||
|
const spawned = ChildProcess.spawn(process.execPath, [path.join(__dirname, 'fixtures', 'module', 'no-asar.js')], {
|
||||||
|
env: {
|
||||||
|
ELECTRON_NO_ASAR: true,
|
||||||
|
ELECTRON_RUN_AS_NODE: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let output = ''
|
||||||
|
spawned.stdout.on('data', function (data) {
|
||||||
|
output += data
|
||||||
|
})
|
||||||
|
spawned.stdout.on('close', function () {
|
||||||
|
stats = JSON.parse(output)
|
||||||
|
assert.equal(stats.isFile, true)
|
||||||
|
assert.equal(stats.size, 778)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('asar protocol', function () {
|
describe('asar protocol', function () {
|
||||||
|
|
15
spec/fixtures/module/no-asar.js
vendored
Normal file
15
spec/fixtures/module/no-asar.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const stats = fs.statSync(path.join(__dirname, '..', 'asar', 'a.asar'))
|
||||||
|
|
||||||
|
const details = {
|
||||||
|
isFile: stats.isFile(),
|
||||||
|
size: stats.size
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.send != null) {
|
||||||
|
process.send(details)
|
||||||
|
} else {
|
||||||
|
console.log(JSON.stringify(details))
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue