Roj 2 лет назад
Родитель
Сommit
48f3819cf4

+ 7 - 5
__tests__/crypto/AES.spec.js → __tests__/crypto/AES.spec.ts

@@ -1,5 +1,6 @@
-const AES = require("../../gramjs/crypto/AES");
-const AESModeCTR = require("../../gramjs/crypto/AESCTR");
+import {IGE} from "../../gramjs/crypto/IGE";
+import {CTR} from "../../gramjs/crypto/CTR";
+
 describe("IGE encrypt function", () => {
   test(
     "it should return 4a657a834edc2956ec95b2a42ec8c1f2d1f0a6028ac26fd830ed23855574b4e69dd1a2be2ba18a53a49b879b2" +
@@ -15,7 +16,8 @@ describe("IGE encrypt function", () => {
           "2ba18a53a49b879b245e1065e14b6e8ac5ba9b24befaff3209b77b5f",
         "hex"
       );
-      expect(AES.encryptIge(plainText, key, iv)).toEqual(encrypted);
+     
+      expect(new IGE(key, iv).encryptIge(plainText)).toEqual(encrypted);
     }
   );
 });
@@ -31,7 +33,7 @@ describe("IGE decrypt function", () => {
     const plainText = Buffer.from(
       "this should hold a 64 characters long string. only 10 more left."
     );
-    expect(AES.decryptIge(encrypted, key, iv)).toEqual(plainText);
+    expect(new IGE(key, iv).decryptIge(encrypted)).toEqual(plainText);
   });
 });
 describe("CTR encrypt function", () => {
@@ -41,7 +43,7 @@ describe("CTR encrypt function", () => {
     () => {
       const encryptKey = Buffer.from("the key needs 32 characters long");
       const encryptIv = Buffer.from("the iv does not.");
-      const encryptor = new AESModeCTR(encryptKey, encryptIv);
+      const encryptor = new CTR(encryptKey, encryptIv);
       const firstData = Buffer.from("this can be any length");
       const firstResult = encryptor.encrypt(firstData);
       const secondData = Buffer.from("this also can be anything");

+ 3 - 3
__tests__/crypto/calcKey.spec.js → __tests__/crypto/calcKey.spec.ts

@@ -1,10 +1,10 @@
-const MTProtoState = require("../../gramjs/network/MTProtoState");
+import {MTProtoState} from "../../gramjs/network/MTProtoState";
 
 describe("calcKey function", () => {
   test(
     "it should return 0x93355e3f1f50529b6fb93eaf97f29b69c16345f53621e9d45cd9a11ddfbebac9 and" +
       " 11e94363ad7145222e2fbac4aaa27f01a6d832fb8115e89395bc43e23f868e47",
-    () => {
+    async() => {
       const authKey = Buffer.from(
         "bbf38532a79cd64363b490b3bc5e258adfc1d1a67ef3c6d322caac603f90a15215b609" +
           "0ccb2226b477b24eb3412757d078d53c72b81864d1376ff20eb405a591781726495407628d8d611e37ecd6e23c605b57c5" +
@@ -23,7 +23,7 @@ describe("calcKey function", () => {
         "11e94363ad7145222e2fbac4aaa27f01a6d832fb8115e89395bc43e23f868e47",
         "hex"
       );
-      const { key, iv } = new MTProtoState()._calcKey(authKey, msgKey, false);
+      const { key, iv } = await new MTProtoState()._calcKey(authKey, msgKey, false);
 
       expect([aesKey, aesIv]).toEqual([key, iv]);
     }

+ 5 - 4
__tests__/crypto/factorizator.spec.js → __tests__/crypto/factorizator.spec.ts

@@ -1,13 +1,14 @@
-const Factorizator = require("../../gramjs/crypto/Factorizator");
+import bigInt from 'big-integer';
+import { Factorizator } from "../../gramjs/crypto/Factorizator";
 
 describe("calcKey function", () => {
   test("it should return 0x20a13b25e1726bfc", () => {
-    const input = BigInt(
+    const input = bigInt(
       "325672672642762197972197217945794795197912791579174576454600704764276407047277"
     );
     const { p, q } = Factorizator.factorize(input);
-    const outP = BigInt(19);
-    const outQ = BigInt(
+    const outP = bigInt(19);
+    const outQ = bigInt(
       "17140666981198010419589327260304989220942778504167082971294773934961916160383"
     );
     expect([p, q]).toEqual([outP, outQ]);

+ 14 - 13
__tests__/crypto/readBuffer.spec.js → __tests__/crypto/readBuffer.spec.ts

@@ -1,23 +1,24 @@
-const Helpers = require("../../gramjs/Helpers");
+import bigInt from 'big-integer'
+import * as Helpers from '../../gramjs/Helpers';
 
 describe("readBufferFromBigInt 8 bytes function", () => {
   test("it should return 0x20a13b25e1726bfc", () => {
-    const input = BigInt("-257986242325798624");
+    const input = bigInt("-257986242325798624");
     const output = Buffer.from("20a13b25e1726bfc", "hex");
     expect(Helpers.readBufferFromBigInt(input, 8, true, true)).toEqual(output);
   });
   test("it should return 0xe05ec4da1e8d9403", () => {
-    const input = BigInt("257986242325798624");
+    const input = bigInt("257986242325798624");
     const output = Buffer.from("e05ec4da1e8d9403", "hex");
     expect(Helpers.readBufferFromBigInt(input, 8, true, false)).toEqual(output);
   });
   test("it should return 0xfc6b72e1253ba120", () => {
-    const input = BigInt("-257986242325798624");
+    const input = bigInt("-257986242325798624");
     const output = Buffer.from("fc6b72e1253ba120", "hex");
     expect(Helpers.readBufferFromBigInt(input, 8, false, true)).toEqual(output);
   });
   test("it should return 0x03948d1edac45ee0", () => {
-    const input = BigInt("257986242325798624");
+    const input = bigInt("257986242325798624");
     const output = Buffer.from("03948d1edac45ee0", "hex");
     expect(Helpers.readBufferFromBigInt(input, 8, false, false)).toEqual(
       output
@@ -27,26 +28,26 @@ describe("readBufferFromBigInt 8 bytes function", () => {
 
 describe("readBufferFromBigInt 16 bytes function", () => {
   test("it should return 0x8416c07962dac053b4346df39e5d97ec", () => {
-    const input = BigInt("-25798624232579862436622316998984984956");
+    const input = bigInt("-25798624232579862436622316998984984956");
     const output = Buffer.from("8416c07962dac053b4346df39e5d97ec", "hex");
     expect(Helpers.readBufferFromBigInt(input, 16, true, true)).toEqual(output);
   });
   test("it should return 0x7ce93f869d253fac4bcb920c61a26813", () => {
-    const input = BigInt("25798624232579862436622316998984984956");
+    const input = bigInt("25798624232579862436622316998984984956");
     const output = Buffer.from("7ce93f869d253fac4bcb920c61a26813", "hex");
     expect(Helpers.readBufferFromBigInt(input, 16, true, false)).toEqual(
       output
     );
   });
   test("it should return 0xec975d9ef36d34b453c0da6279c01684", () => {
-    const input = BigInt("-25798624232579862436622316998984984956");
+    const input = bigInt("-25798624232579862436622316998984984956");
     const output = Buffer.from("ec975d9ef36d34b453c0da6279c01684", "hex");
     expect(Helpers.readBufferFromBigInt(input, 16, false, true)).toEqual(
       output
     );
   });
   test("it should return 0x1368a2610c92cb4bac3f259d863fe97c", () => {
-    const input = BigInt("25798624232579862436622316998984984956");
+    const input = bigInt("25798624232579862436622316998984984956");
     const output = Buffer.from("1368a2610c92cb4bac3f259d863fe97c", "hex");
     expect(Helpers.readBufferFromBigInt(input, 16, false, false)).toEqual(
       output
@@ -56,7 +57,7 @@ describe("readBufferFromBigInt 16 bytes function", () => {
 
 describe("readBufferFromBigInt 32 bytes function", () => {
   test("it should return 0x7f113f5e2096936ec90cc4c73cc7bd3c96d20c115bf9ceb05c34232c037ff6c6", () => {
-    const input = BigInt(
+    const input = bigInt(
       "-25798624232579862436622316998984984912345482145214526587420145210501554564737"
     );
     const output = Buffer.from(
@@ -66,7 +67,7 @@ describe("readBufferFromBigInt 32 bytes function", () => {
     expect(Helpers.readBufferFromBigInt(input, 32, true, true)).toEqual(output);
   });
   test("it should return 0x81eec0a1df696c9136f33b38c33842c3692df3eea406314fa3cbdcd3fc800939", () => {
-    const input = BigInt(
+    const input = bigInt(
       "25798624232579862436622316998984984912345482145214526587420145210501554564737"
     );
     const output = Buffer.from(
@@ -78,7 +79,7 @@ describe("readBufferFromBigInt 32 bytes function", () => {
     );
   });
   test("it should return 0xc6f67f032c23345cb0cef95b110cd2963cbdc73cc7c40cc96e9396205e3f117f", () => {
-    const input = BigInt(
+    const input = bigInt(
       "-25798624232579862436622316998984984912345482145214526587420145210501554564737"
     );
     const output = Buffer.from(
@@ -90,7 +91,7 @@ describe("readBufferFromBigInt 32 bytes function", () => {
     );
   });
   test("it should return 0x390980fcd3dccba34f3106a4eef32d69c34238c3383bf336916c69dfa1c0ee81", () => {
-    const input = BigInt(
+    const input = bigInt(
       "25798624232579862436622316998984984912345482145214526587420145210501554564737"
     );
     const output = Buffer.from(

+ 13 - 27
__tests__/extensions/HTML.spec.js → __tests__/extensions/HTML.spec.ts

@@ -1,68 +1,55 @@
-const { HTMLParser } = require("../../gramjs/extensions/HTML");
-const types = require("../../gramjs/tl/types");
+import { HTMLParser } from "../../gramjs/extensions/html";
+import { Api as types } from "../../gramjs/tl/api";
 
 describe("HTMLParser", () => {
-  test("it should construct a new HTMLParser", () => {
-    const parser = new HTMLParser("Hello world");
-    expect(parser.text).toEqual("");
-    expect(parser.entities).toEqual([]);
-  });
-
   describe(".parse", () => {
     test("it should parse bold entities", () => {
-      const parser = new HTMLParser("Hello <strong>world</strong>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("Hello <strong>world</strong>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityBold);
     });
 
     test("it should parse italic entities", () => {
-      const parser = new HTMLParser("Hello <em>world</em>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("Hello <em>world</em>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityItalic);
     });
 
     test("it should parse code entities", () => {
-      const parser = new HTMLParser("Hello <code>world</code>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("Hello <code>world</code>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityCode);
     });
 
     test("it should parse pre entities", () => {
-      const parser = new HTMLParser("Hello <pre>world</pre>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("Hello <pre>world</pre>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityPre);
     });
 
     test("it should parse strike entities", () => {
-      const parser = new HTMLParser("Hello <del>world</del>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("Hello <del>world</del>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityStrike);
     });
 
     test("it should parse link entities", () => {
-      const parser = new HTMLParser(
+      const [text, entities] = HTMLParser.parse(
         'Hello <a href="https://hello.world">world</a>'
-      );
-      const [text, entities] = parser.parse();
+      );;
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityTextUrl);
-      expect(entities[0].url).toEqual("https://hello.world");
+      expect((entities[0] as types.MessageEntityTextUrl).url).toEqual("https://hello.world");
     });
 
     test("it should parse nested entities", () => {
-      const parser = new HTMLParser("Hello <strong><em>world</em></strong>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("Hello <strong><em>world</em></strong>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(2);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityItalic);
@@ -70,8 +57,7 @@ describe("HTMLParser", () => {
     });
 
     test("it should parse multiple entities", () => {
-      const parser = new HTMLParser("<em>Hello</em> <strong>world</strong>");
-      const [text, entities] = parser.parse();
+      const [text, entities] = HTMLParser.parse("<em>Hello</em> <strong>world</strong>");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(2);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityItalic);
@@ -89,7 +75,7 @@ describe("HTMLParser", () => {
         new types.MessageEntityItalic({ offset: 6, length: 5 }),
         new types.MessageEntityStrike({ offset: 12, length: 5 }),
         new types.MessageEntityCode({ offset: 18, length: 5 }),
-        new types.MessageEntityPre({ offset: 24, length: 5 }),
+        new types.MessageEntityPre({ offset: 24, length: 5, language: "" }),
         new types.MessageEntityTextUrl({
           offset: 30,
           length: 5,

+ 12 - 26
__tests__/extensions/Markdown.spec.js → __tests__/extensions/Markdown.spec.ts

@@ -1,74 +1,60 @@
-const { MarkdownParser } = require("../../gramjs/extensions/Markdown");
-const types = require("../../gramjs/tl/types");
+import { MarkdownParser } from "../../gramjs/extensions/markdown";
+import { Api as types } from "../../gramjs/tl/api";
 
 describe("MarkdownParser", () => {
-  test("it should construct a new MarkdownParser", () => {
-    const parser = new MarkdownParser("Hello world");
-    expect(parser.text).toEqual("");
-    expect(parser.entities).toEqual([]);
-  });
-
   describe(".parse", () => {
     test("it should parse bold entities", () => {
-      const parser = new MarkdownParser("Hello **world**");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello **world**");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityBold);
     });
 
     test("it should parse italic entities", () => {
-      const parser = new MarkdownParser("Hello __world__");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello __world__");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityItalic);
     });
 
     test("it should parse code entities", () => {
-      const parser = new MarkdownParser("Hello `world`");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello `world`");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityCode);
     });
 
     test("it should parse pre entities", () => {
-      const parser = new MarkdownParser("Hello ```world```");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello ```world```");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityPre);
     });
 
     test("it should parse strike entities", () => {
-      const parser = new MarkdownParser("Hello ~~world~~");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello ~~world~~");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityStrike);
     });
 
     test("it should parse link entities", () => {
-      const parser = new MarkdownParser("Hello [world](https://hello.world)");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello [world](https://hello.world)")
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityTextUrl);
-      expect(entities[0].url).toEqual("https://hello.world");
+      expect((entities[0] as types.MessageEntityTextUrl).url).toEqual("https://hello.world");
     });
 
     test("it should not parse nested entities", () => {
-      const parser = new MarkdownParser("Hello **__world__**");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("Hello **__world__**");
       expect(text).toEqual("Hello __world__");
       expect(entities.length).toEqual(1);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityBold);
     });
 
     test("it should parse multiple entities", () => {
-      const parser = new MarkdownParser("__Hello__ **world**");
-      const [text, entities] = parser.parse();
+      const [text, entities] = MarkdownParser.parse("__Hello__ **world**");
       expect(text).toEqual("Hello world");
       expect(entities.length).toEqual(2);
       expect(entities[0]).toBeInstanceOf(types.MessageEntityItalic);
@@ -86,7 +72,7 @@ describe("MarkdownParser", () => {
         new types.MessageEntityItalic({ offset: 6, length: 5 }),
         new types.MessageEntityStrike({ offset: 12, length: 5 }),
         new types.MessageEntityCode({ offset: 18, length: 5 }),
-        new types.MessageEntityPre({ offset: 24, length: 5 }),
+        new types.MessageEntityPre({ offset: 24, length: 5, language: "" }),
         new types.MessageEntityTextUrl({
           offset: 30,
           length: 5,

+ 0 - 0
__tests__/extensions/Scanner.spec.js → __tests__/extensions/Scanner.spec.ts


+ 4 - 187
jest.config.js

@@ -1,188 +1,5 @@
-// For a detailed explanation regarding each configuration property, visit:
-// https://jestjs.io/docs/en/configuration.html
-
+/** @type {import('ts-jest').JestConfigWithTsJest} */
 module.exports = {
-  // All imported modules in your tests should be mocked automatically
-  // automock: false,
-
-  // Stop running tests after `n` failures
-  // bail: 0,
-
-  // Respect "browser" field in package.json when resolving modules
-  // browser: false,
-
-  // The directory where Jest should store its cached dependency information
-  // cacheDirectory: "C:\\Users\\painor\\AppData\\Local\\Temp\\jest",
-
-  // Automatically clear mock calls and instances between every test
-  clearMocks: true,
-
-  // Indicates whether the coverage information should be collected while executing the test
-  // collectCoverage: false,
-
-  // An array of glob patterns indicating a set of files for which coverage information should be collected
-  // collectCoverageFrom: null,
-
-  // The directory where Jest should output its coverage files
-  coverageDirectory: "coverage",
-
-  // An array of regexp pattern strings used to skip coverage collection
-  // coveragePathIgnorePatterns: [
-  //   "\\\\node_modules\\\\"
-  // ],
-
-  // A list of reporter names that Jest uses when writing coverage reports
-  // coverageReporters: [
-  //   "json",
-  //   "text",
-  //   "lcov",
-  //   "clover"
-  // ],
-
-  // An object that configures minimum threshold enforcement for coverage results
-  // coverageThreshold: null,
-
-  // A path to a custom dependency extractor
-  // dependencyExtractor: null,
-
-  // Make calling deprecated APIs throw helpful error messages
-  // errorOnDeprecated: false,
-
-  // Force coverage collection from ignored files using an array of glob patterns
-  // forceCoverageMatch: [],
-
-  // A path to a module which exports an async function that is triggered once before all test suites
-  // globalSetup: null,
-
-  // A path to a module which exports an async function that is triggered once after all test suites
-  // globalTeardown: null,
-
-  // A set of global variables that need to be available in all test environments
-  // globals: {},
-
-  // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
-  // maxWorkers: "50%",
-
-  // An array of directory names to be searched recursively up from the requiring module's location
-  // moduleDirectories: [
-  //   "node_modules"
-  // ],
-
-  // An array of file extensions your modules use
-  // moduleFileExtensions: [
-  //   "js",
-  //   "json",
-  //   "jsx",
-  //   "ts",
-  //   "tsx",
-  //   "node"
-  // ],
-
-  // A map from regular expressions to module names that allow to stub out resources with a single module
-  // moduleNameMapper: {},
-
-  // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
-  // modulePathIgnorePatterns: [],
-
-  // Activates notifications for test results
-  // notify: false,
-
-  // An enum that specifies notification mode. Requires { notify: true }
-  // notifyMode: "failure-change",
-
-  // A preset that is used as a base for Jest's configuration
-  // preset: null,
-
-  // Run tests from one or more projects
-  // projects: null,
-
-  // Use this configuration option to add custom reporters to Jest
-  // reporters: undefined,
-
-  // Automatically reset mock state between every test
-  // resetMocks: false,
-
-  // Reset the module registry before running each individual test
-  // resetModules: false,
-
-  // A path to a custom resolver
-  // resolver: null,
-
-  // Automatically restore mock state between every test
-  // restoreMocks: false,
-
-  // The root directory that Jest should scan for tests and modules within
-  // rootDir: null,
-
-  // A list of paths to directories that Jest should use to search for files in
-  // roots: [
-  //   "<rootDir>"
-  // ],
-
-  // Allows you to use a custom runner instead of Jest's default test runner
-  // runner: "jest-runner",
-
-  // The paths to modules that run some code to configure or set up the testing environment before each test
-  // setupFiles: [],
-
-  // A list of paths to modules that run some code to configure or set up the testing framework before each test
-  // setupFilesAfterEnv: [],
-
-  // A list of paths to snapshot serializer modules Jest should use for snapshot testing
-  // snapshotSerializers: [],
-
-  // The test environment that will be used for testing
-  testEnvironment: "node",
-
-  // Options that will be passed to the testEnvironment
-  // testEnvironmentOptions: {},
-
-  // Adds a location field to test results
-  // testLocationInResults: false,
-
-  // The glob patterns Jest uses to detect test files
-  // testMatch: [
-  //   "**/__tests__/**/*.[jt]s?(x)",
-  //   "**/?(*.)+(spec|test).[tj]s?(x)"
-  // ],
-
-  // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
-  // testPathIgnorePatterns: [
-  //   "\\\\node_modules\\\\"
-  // ],
-
-  // The regexp pattern or array of patterns that Jest uses to detect test files
-  // testRegex: [],
-
-  // This option allows the use of a custom results processor
-  // testResultsProcessor: null,
-
-  // This option allows use of a custom test runner
-  // testRunner: "jasmine2",
-
-  // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
-  // testURL: "http://localhost",
-
-  // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
-  // timers: "real",
-
-  // A map from regular expressions to paths to transformers
-  // transform: null,
-
-  // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
-  // transformIgnorePatterns: [
-  //   "\\\\node_modules\\\\"
-  // ],
-
-  // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
-  // unmockedModulePathPatterns: undefined,
-
-  // Indicates whether each individual test should be reported during the run
-  // verbose: null,
-
-  // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
-  // watchPathIgnorePatterns: [],
-
-  // Whether to use watchman for file crawling
-  // watchman: true,
-};
+  preset: 'ts-jest',
+  testEnvironment: 'node',
+};

Разница между файлами не показана из-за своего большого размера
+ 343 - 253
package-lock.json


+ 6 - 4
package.json

@@ -33,16 +33,18 @@
     "@babel/core": "^7.12.13",
     "@babel/plugin-proposal-class-properties": "^7.12.13",
     "@babel/preset-env": "^7.12.16",
+    "@types/jest": "^29.5.1",
     "@types/mime": "^2.0.3",
     "@types/node": "^15.12.0",
     "@types/node-localstorage": "^1.3.0",
     "@types/pako": "^1.0.1",
     "@types/websocket": "^1.0.4",
     "babel-loader": "^8.2.2",
-    "jest": "^27.2.5",
+    "jest": "^29.5.0",
     "os-browserify": "^0.3.0",
     "prettier": "2.3.1",
     "process": "^0.11.10",
+    "ts-jest": "^29.1.0",
     "ts-loader": "^8.0.16",
     "ts-node": "^9.1.1",
     "typedoc": "^0.22.11",
@@ -59,13 +61,13 @@
     "buffer": "^6.0.3",
     "htmlparser2": "^6.1.0",
     "mime": "^3.0.0",
+    "node-localstorage": "^2.2.1",
     "pako": "^2.0.3",
     "path-browserify": "^1.0.1",
     "real-cancellable-promise": "^1.1.1",
+    "socks": "^2.6.2",
     "store2": "^2.13.0",
     "ts-custom-error": "^3.2.0",
-    "websocket": "^1.0.34",
-    "node-localstorage": "^2.2.1",
-    "socks": "^2.6.2"
+    "websocket": "^1.0.34"
   }
 }

Некоторые файлы не были показаны из-за большого количества измененных файлов