mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-18 22:28:56 +00:00
Update to Mocha v10 in tests, declare lib as module and add exports to package.json
Mocha v10 requires the lib to be esm compliant. ESM mandates the use of file extensions in imports, so to minimize the changes (for now), we rely on the flag `experimental-specifier-resolution=node` and on `ts-node` (needed only for Node 20). Breaking changes: downstream bundlers might be affected by the package.json changes depending on how they load the library. NB: legacy package.json entrypoints are still available.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
const { use: chaiUse, expect } = require('chai');
|
||||
chaiUse(require('chai-as-promised'));
|
||||
import { use as chaiUse, expect } from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
chaiUse(chaiAsPromised);
|
||||
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : await import('openpgp');
|
||||
|
||||
const password = 'I am a password';
|
||||
|
||||
@@ -38,7 +39,7 @@ Xg==
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = () => describe('Decrypt and decompress message tests', function () {
|
||||
export default () => describe('Decrypt and decompress message tests', function () {
|
||||
|
||||
function runTest(key, test) {
|
||||
it(`Decrypts message compressed with ${key}`, async function () {
|
||||
|
||||
Reference in New Issue
Block a user