Exit with error on unhandled rejections in Node tests (#1251)
This commit is contained in:
parent
2000388a80
commit
15ee659c9c
|
@ -3108,17 +3108,17 @@ module.exports = () => describe('Key', function() {
|
||||||
const source = await openpgp.readKey({ armoredKey: priv_key_rsa });
|
const source = await openpgp.readKey({ armoredKey: priv_key_rsa });
|
||||||
const [dest] = await openpgp.readKeys({ armoredKeys: twoKeys });
|
const [dest] = await openpgp.readKeys({ armoredKeys: twoKeys });
|
||||||
expect(dest.isPublic()).to.be.true;
|
expect(dest.isPublic()).to.be.true;
|
||||||
return dest.update(source).then(() => {
|
return dest.update(source).then(async () => {
|
||||||
expect(dest.isPrivate()).to.be.true;
|
expect(dest.isPrivate()).to.be.true;
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
dest.verifyPrimaryKey().then(result => {
|
dest.verifyPrimaryKey().then(async result => {
|
||||||
expect(source.verifyPrimaryKey()).to.eventually.equal(result);
|
await expect(source.verifyPrimaryKey()).to.eventually.equal(result);
|
||||||
}),
|
}),
|
||||||
dest.users[0].verify(dest.primaryKey).then(result => {
|
dest.users[0].verify(dest.primaryKey).then(async result => {
|
||||||
expect(source.users[0].verify(source.primaryKey)).to.eventually.equal(result);
|
await expect(source.users[0].verify(source.primaryKey)).to.eventually.equal(result);
|
||||||
}),
|
}),
|
||||||
dest.subKeys[0].verify(dest.primaryKey).then(result => {
|
dest.subKeys[0].verify(dest.primaryKey).then(async result => {
|
||||||
expect(source.subKeys[0].verify(source.primaryKey)).to.eventually.equal(result);
|
await expect(source.subKeys[0].verify(source.primaryKey)).to.eventually.deep.equal(result);
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,6 +40,11 @@ describe('Unit Tests', function () {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
process.on('unhandledRejection', error => {
|
||||||
|
console.error(error); // eslint-disable-line no-console
|
||||||
|
process.exit(1); // eslint-disable-line no-process-exit
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
require('./crypto')();
|
require('./crypto')();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user