Fix so util test on 7zip will log 7zip output on errors
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed

This commit is contained in:
Jonatan Nilsson 2022-01-27 18:29:54 +00:00
parent f008af597d
commit 47b8ac2ebb

View file

@ -202,7 +202,16 @@ t.describe('#extractFile()', function() {
assert.isRejected(fs.stat(util.getPathFromRoot('./testapp/file2.txt'))),
])
await util.extractFile(util.getPathFromRoot('./testapp/example.7z'))
let log = ''
try {
await util.extractFile(util.getPathFromRoot('./testapp/example.7z'), function(msg) {
log += msg + '\n'
})
} catch (err) {
console.log(log)
console.log(err)
throw err
}
let stats = await Promise.all([
fs.stat(util.getPathFromRoot('./testapp/file1.txt')),
@ -218,7 +227,16 @@ t.describe('#extractFile()', function() {
assert.isRejected(fs.stat(util.getPathFromRoot('./testapp/file2.txt'))),
])
await util.extractFile(util.getPathFromRoot('./testapp/example.tar.gz'))
let log = ''
try {
await util.extractFile(util.getPathFromRoot('./testapp/example.tar.gz'), function(msg) {
log += msg + '\n'
})
} catch (err) {
console.log(log)
console.log(err)
throw err
}
let stats = await Promise.all([
fs.stat(util.getPathFromRoot('./testapp/file1.txt')),
@ -232,7 +250,14 @@ t.describe('#extractFile()', function() {
t.test('should stream the process of extracting', async function() {
let output = ''
try {
await util.extractFile(util.getPathFromRoot('./testapp/example.tar.gz'), function(msg) { output += msg + '\n' })
} catch (err) {
console.log(output)
console.log(err)
throw err
}
assert.match(output, /Extracting archive\:.+example.tar.gz/)
assert.match(output, /1 file, 123 bytes/)